summaryrefslogtreecommitdiff
path: root/third_party/resample
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-04-07 14:53:15 +0000
committerBenny Prijono <bennylp@teluu.com>2007-04-07 14:53:15 +0000
commitca07a9833149d270d1e5b44cfa381ac6ac03e39c (patch)
tree0d1297c8326f76aec00e068795ed1505047c63a7 /third_party/resample
parent81d1b2797aa3945c529d57f9ddf6179ec2b392a4 (diff)
Moved resample to third_party directory
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/split-3rd-party@1170 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'third_party/resample')
-rw-r--r--third_party/resample/AUTHORS2
-rw-r--r--third_party/resample/COPYING463
-rw-r--r--third_party/resample/ChangeLog15
-rw-r--r--third_party/resample/INSTALL242
-rw-r--r--third_party/resample/Makefile.am4
-rw-r--r--third_party/resample/Makefile.in580
-rw-r--r--third_party/resample/NEWS4
-rw-r--r--third_party/resample/README154
-rw-r--r--third_party/resample/aclocal.m4850
-rw-r--r--third_party/resample/bootstrap31
-rw-r--r--third_party/resample/config.h.in175
-rw-r--r--third_party/resample/configure7440
-rw-r--r--third_party/resample/configure.in50
-rw-r--r--third_party/resample/depcomp530
-rw-r--r--third_party/resample/install-sh323
-rw-r--r--third_party/resample/man/Makefile.am2
-rw-r--r--third_party/resample/man/Makefile.in330
-rw-r--r--third_party/resample/man/resample.1115
-rw-r--r--third_party/resample/man/windowfilter.127
-rw-r--r--third_party/resample/missing360
-rw-r--r--third_party/resample/sndlib-20/_sndlib.h603
-rw-r--r--third_party/resample/sndlib-20/audio.c9867
-rw-r--r--third_party/resample/sndlib-20/configure13033
-rw-r--r--third_party/resample/sndlib-20/headers.c5797
-rw-r--r--third_party/resample/sndlib-20/io.c1513
-rw-r--r--third_party/resample/sndlib-20/makefile.in88
-rw-r--r--third_party/resample/sndlib-20/mus-config.h103
-rw-r--r--third_party/resample/sndlib-20/sndins/Makefile.in61
-rw-r--r--third_party/resample/sndlib-20/sndlib-strings.h150
-rw-r--r--third_party/resample/sndlib-20/sndlib.h457
-rw-r--r--third_party/resample/sndlib-20/sound.c1072
-rw-r--r--third_party/resample/src/Makefile.am22
-rw-r--r--third_party/resample/src/Makefile.in478
-rw-r--r--third_party/resample/src/filterkit.c631
-rw-r--r--third_party/resample/src/filterkit.h159
-rw-r--r--third_party/resample/src/largefilter.h16411
-rw-r--r--third_party/resample/src/resample.c238
-rw-r--r--third_party/resample/src/resample.h86
-rw-r--r--third_party/resample/src/resamplesubs.c520
-rw-r--r--third_party/resample/src/smallfilter.h4617
-rw-r--r--third_party/resample/src/sndlibextra.c90
-rw-r--r--third_party/resample/src/sndlibextra.h48
-rw-r--r--third_party/resample/src/stdefs.h59
-rw-r--r--third_party/resample/src/windowfilter.c114
44 files changed, 67914 insertions, 0 deletions
diff --git a/third_party/resample/AUTHORS b/third_party/resample/AUTHORS
new file mode 100644
index 00000000..2e6a06d7
--- /dev/null
+++ b/third_party/resample/AUTHORS
@@ -0,0 +1,2 @@
+Julius Smith (http://ccrma.stanford.edu/~jos/)
+Chris Fraley, and others (see ChangeLog and resample man page).
diff --git a/third_party/resample/COPYING b/third_party/resample/COPYING
new file mode 100644
index 00000000..4ccd6ccf
--- /dev/null
+++ b/third_party/resample/COPYING
@@ -0,0 +1,463 @@
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[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
+
diff --git a/third_party/resample/ChangeLog b/third_party/resample/ChangeLog
new file mode 100644
index 00000000..75e98214
--- /dev/null
+++ b/third_party/resample/ChangeLog
@@ -0,0 +1,15 @@
+VERSION HISTORY
+
+Ver Changes
+----- -------
+1.8.1 Switched to using autotools (configure, etc.)
+ Updated to sndlib-20, using more of the high-level API.
+1.8 Cleared up more compiler warnings (Fedora Core 4, OSS case).
+ Absorbed bugfix (for a small fixed memory leak) in the file
+ resample-fix.dif from resample-1.7-114 in the SUSE distribution.
+1.7 Cleared up all Linux compiler warnings (RH-7.2), and any others reported.
+ Added 'make test' for simple regression testing. <jos@ccrma.stanford.edu>
+1.6 Port to sndlib version 10, incorporation of needed sndlib files.
+1.5 Port to sndlib version 7 headers.
+1.4 Port to sndlib version 6 by John Gibson <jgg9c@virginia.edu>.
+*.* Older, now-unsupport NeXT versions
diff --git a/third_party/resample/INSTALL b/third_party/resample/INSTALL
new file mode 100644
index 00000000..ce8738d2
--- /dev/null
+++ b/third_party/resample/INSTALL
@@ -0,0 +1,242 @@
+Installation Instructions
+*************************
+./configure
+make install
+
+GENERIC Installation Instructions
+*********************************
+(installed by GNU Autotools)
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script). Here is a another example:
+
+ /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
diff --git a/third_party/resample/Makefile.am b/third_party/resample/Makefile.am
new file mode 100644
index 00000000..e4fec3ab
--- /dev/null
+++ b/third_party/resample/Makefile.am
@@ -0,0 +1,4 @@
+## Process this file with automake to produce Makefile.in
+
+EXTRA_DIST = configure bootstrap
+SUBDIRS = src man
diff --git a/third_party/resample/Makefile.in b/third_party/resample/Makefile.in
new file mode 100644
index 00000000..346a493b
--- /dev/null
+++ b/third_party/resample/Makefile.in
@@ -0,0 +1,580 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(top_srcdir)/configure $(top_srcdir)/sndlib-20/makefile.in \
+ $(top_srcdir)/sndlib-20/sndins/Makefile.in AUTHORS COPYING \
+ ChangeLog INSTALL NEWS depcomp install-sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = sndlib-20/makefile sndlib-20/sndins/Makefile
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+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_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_DIST = configure bootstrap
+SUBDIRS = src man
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ 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)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+sndlib-20/makefile: $(top_builddir)/config.status $(top_srcdir)/sndlib-20/makefile.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+sndlib-20/sndins/Makefile: $(top_builddir)/config.status $(top_srcdir)/sndlib-20/sndins/Makefile.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+uninstall-info-am:
+
+# 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.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; 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; \
+ (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"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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 || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/sndlib-20 $(distdir)/sndlib-20/sndins
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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 \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -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 $(SHELL) $(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__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__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) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(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
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { 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 config.h
+installdirs: installdirs-recursive
+installdirs-am:
+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:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+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
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-recursive ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-generic \
+ distclean-hdr distclean-recursive distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-info-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/third_party/resample/NEWS b/third_party/resample/NEWS
new file mode 100644
index 00000000..ac0b6811
--- /dev/null
+++ b/third_party/resample/NEWS
@@ -0,0 +1,4 @@
+For an orientation, see the
+Digital Audio Resampling Home Page:
+http://ccrma.stanford.edu/~jos/resample/.
+
diff --git a/third_party/resample/README b/third_party/resample/README
new file mode 100644
index 00000000..345dd66f
--- /dev/null
+++ b/third_party/resample/README
@@ -0,0 +1,154 @@
+README file for resample-1.x.tgz from the
+Digital Audio Resampling Home Page located at
+http://ccrma.stanford.edu/~jos/resample/.
+
+SOFTWARE FOR SAMPLING-RATE CONVERSION AND FIR DIGITAL FILTER DESIGN
+
+For installation instructions, read the INSTALL file in this directory.
+
+The resample program "resamples" a soundfile to change its sampling
+rate. For example, it can be used to convert the sampling rate from
+48 kHz (used by DAT machines) to 44.1 kHz (the standard sampling rate
+for Compact Discs). The command line for this operation would look
+something like
+
+ resample -by 0.91875 dat.snd cd.snd
+
+or, more simply,
+
+ resample -to 44100 dat.snd cd.snd
+
+Any reasonable sampling rate can be converted to any other.
+
+The windowfilter program designs Finite-Impulse-Response (FIR) digital
+filters by the so-called "window method." In this method, the ideal
+impulse response (a sinc function) is "windowed" by a Kaiser window (a
+popular window used in spectrum analysis).
+
+The resample program uses 32-bit fixed-point arithmetic: 16-bits data
+and 16-bits coefficients. The input soundfile must be 16-bit mono or
+stereo (interleaved) audio data.
+
+SNDLIB
+
+The program uses elements of Bill Schottstaedt's sndlib sound file
+library. This means resample can read many different kinds of sound
+file header (AIFF, WAV, NeXT, IRCAM, etc.).
+
+The sndlib files used by resample are included in this directory to
+ensure stability. The latest version of sndlib should be available as
+
+ ftp://ccrma-ftp.stanford.edu/pub/Lisp/sndlib.tar.gz
+
+See sndlib.html in the sndlib distribution for documentation of SNDLIB.
+
+CONTENTS of ./src directory
+
+resample.c Sampling-rate conversion program.
+resample.1 Manual page for resample. Try "nroff -man resample.1".
+resamplesubs.c Subroutines used by resample.
+resample.h Configuration constants for the sampling rate converter.
+stdefs.h Machine-dependent definitions, useful constants and macros.
+
+windowfilter.c Program for designing FIR digital filters used by resample.
+windowfilter.1 Manual page for windowfilter.
+filterkit.c Library for filter design, application, and file management.
+filterkit.h Declarations (procedure prototypes) for the filterkit library.
+
+README This file.
+README.deemph A word about deemphasis filtering.
+LGPL GNU Lesser General Public License (LGPL)
+
+SNDLIB files:
+ io.c
+ audio.c
+ headers.c
+ sound.c
+ sndlib.h
+ sndlib-strings.h
+
+COPYING
+
+SNDLIB files are Copyright 2000 by Bill Schottstaedt <bil@ccrma.stanford.edu>.
+
+The remaining files in this package, unless otherwise noted, are
+Copyright 1994-2006 by Julius O. Smith III <jos@ccrma.stanford.edu>,
+all rights reserved. Permission to use and copy is granted subject to
+the terms of the "GNU Lesser General Public License" (LGPL) as
+published by the Free Software Foundation; either version 2.1 of the
+License, or any later version. In addition, we request that a copy of
+any modified files be sent by email to jos@ccrma.stanford.edu so that
+we may incorporate them into the CCRMA 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.
+
+FILTERKIT CONTENTS
+
+ LpFilter() - Calculates the filter coeffs for a Kaiser-windowed
+ low-pass filter with a given roll-off frequency. These
+ coeffs are stored into a array of doubles.
+
+ writeFilter() - Writes a filter to a file.
+
+ makeFilter() - A section of the original SAIL program. Calls
+ LpFilter() to create a filter, then scales the double
+ coeffs into a array of half words.
+
+ readFilter() - Reads a filter from a file.
+
+ FilterUp() - Applies a filter to a given sample when up-converting.
+
+ FilterUD() - Applies a filter to a given sample when up- or down-
+ converting. Both are repoductions of the original SAIL
+ program.
+
+ initZerox() - Initialization routine for the zerox() function. Must
+ be called before zerox() is called. This routine loads
+ the correct filter so zerox() can use it.
+
+ zerox() - Given a pointer into a sample, finds a zero-crossing on the
+ interval [pointer-1:pointer+2] by iteration.
+
+ Query() - Ask the user for a yes/no question with prompt, default,
+ and optional help.
+
+ GetUShort() - Ask the user for a unsigned short with prompt, default,
+ and optional help.
+
+ GetDouble() - Ask the user for a double with prompt, default, and
+ optional help.
+
+ GetString() - Ask the user for a string with prompt, default, and
+ optional help.
+
+
+FILTER FILE FORMAT
+
+ File Name: "F" Nmult "T" Nhc ".filter"
+ example: "F13T8.filter" and "F27T8.filter"
+
+ Structure of File:
+ "ScaleFactor" LpScl
+ "Length" Nwing
+ "Coeffs:"
+ Imp[0]
+ Imp[1]
+ :
+ Imp[Nwing-1]
+ "Differences:"
+ ImpD[0]
+ ImpD[1]
+ :
+ ImpD[Nwing-1]
+ EOF
+
+ where: Something enclosed in "" indicates specific characters in the file.
+ Nmult, Nwing, Imp[], and ImpD[] are variables (HWORD)
+ Npc is a conversion constant.
+ EOF is the end of the file.
+
+ See writeFilter() and readFilter() in "filterkit.c" for more details.
+
diff --git a/third_party/resample/aclocal.m4 b/third_party/resample/aclocal.m4
new file mode 100644
index 00000000..aef181a6
--- /dev/null
+++ b/third_party/resample/aclocal.m4
@@ -0,0 +1,850 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 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.
+
+# Copyright (C) 2002, 2003, 2005 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.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 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, 2000, 2001, 2003, 2004, 2005
+# 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.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+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, 2000, 2001, 2002, 2003, 2004, 2005
+# 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.
+
+# serial 8
+
+# 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", "GCJ", or "OBJC".
+# 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
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$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'.
+ 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
+ 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 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ 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
+ ;;
+ none) break ;;
+ esac
+ # 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.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} 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,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# 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.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; 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.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /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"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/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, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# 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.
+
+# serial 12
+
+# 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.
+
+# 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.58])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
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+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],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])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)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# 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)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# 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_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 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
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 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.
+
+# serial 2
+
+# 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, 2002, 2003, 2005 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.
+
+# serial 3
+
+# 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 done
+.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
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+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, 1999, 2000, 2001, 2003, 2005
+# 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.
+
+# serial 4
+
+# 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 supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 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_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 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.
+
+# serial 3
+
+# _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],
+[AC_FOREACH([_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])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# 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.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# 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 (
+ 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
+ rm -f conftest.file
+ 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
+
+ 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)])
+
+# Copyright (C) 2001, 2003, 2005 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="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 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.
+
+# serial 2
+
+# _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.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+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])
+ 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
+
diff --git a/third_party/resample/bootstrap b/third_party/resample/bootstrap
new file mode 100644
index 00000000..5e522ff3
--- /dev/null
+++ b/third_party/resample/bootstrap
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+#cd sndlib-20
+#configure
+#cd ..
+echo=on
+if test -e configure.in; then \
+ echo 'autoscan not run'; \
+else \
+ echo 'autoscan'; \
+ autoscan; \
+ echo 'autoscan'; \
+ mv configure.scan configure.in; \
+ echo AM_INIT_AUTOMAKE >> configure.in; \
+fi
+
+rm -f config.cache
+rm -f acconfig.h
+echo "- aclocal."
+#aclocal -I m4
+aclocal
+echo "- autoconf."
+autoconf
+echo "- autoheader."
+autoheader
+echo "- automake."
+automake -a
+#exit
+./configure
+make
+#make check
diff --git a/third_party/resample/config.h.in b/third_party/resample/config.h.in
new file mode 100644
index 00000000..7eececf4
--- /dev/null
+++ b/third_party/resample/config.h.in
@@ -0,0 +1,175 @@
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the `atexit' function. */
+#undef HAVE_ATEXIT
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `pathconf' function. */
+#undef HAVE_PATHCONF
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#undef HAVE_REALLOC
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+ zero-length file name argument. */
+#undef HAVE_STAT_EMPTY_STRING_BUG
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
+/* 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 `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
+/* 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 the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_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/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+ slash. */
+#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+
+/* 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 version of this package. */
+#undef PACKAGE_VERSION
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
diff --git a/third_party/resample/configure b/third_party/resample/configure
new file mode 100644
index 00000000..3cb7ad17
--- /dev/null
+++ b/third_party/resample/configure
@@ -0,0 +1,7440 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for resample 1.8.1.
+#
+# Report bugs to <resample-bugs@w3k.org>.
+#
+# Copyright (C) 2003 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 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+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; 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
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ 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
+
+ ;;
+ 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
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # 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 sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# 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'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='resample'
+PACKAGE_TARNAME='resample'
+PACKAGE_VERSION='1.8.1'
+PACKAGE_STRING='resample 1.8.1'
+PACKAGE_BUGREPORT='resample-bugs@w3k.org'
+
+ac_unique_file="src/smallfilter.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB CPP EGREP ALLOCA LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# 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.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+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
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_option in
+
+ -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 | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$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 ;;
+
+ -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 ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ 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 ;;
+
+ -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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=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 ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ 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'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+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
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ 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
+
+
+# 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 its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ 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
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# 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 resample 1.8.1 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 \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+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]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --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]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_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
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of resample 1.8.1:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+
+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>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+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 <resample-bugs@w3k.org>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style 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
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+resample configure 1.8.1
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 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 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by resample $as_me 1.8.1, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+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`
+hostinfo = `(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=.
+ echo "PATH: $as_dir"
+done
+
+} >&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_sep=
+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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$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
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >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
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ 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.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+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 `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+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
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`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.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+am__api_version="1.9"
+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
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# 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.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_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
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+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. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$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'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# 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 (
+ 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
+ rm -f conftest.file
+ 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".
+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+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 $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+all:
+ @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ SET_MAKE=
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+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=resample
+ VERSION=1.8.1
+
+
+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"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+# (also removed testdir for now)
+# END modified/added by jos
+
+ ac_config_headers="$ac_config_headers config.h"
+
+
+# Checks for programs.
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_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"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+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
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out 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.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; 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 | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$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
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* 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 -std1 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 -std1. */
+int osf4_cc_array ['\x00' == 0 ? 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
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext 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
+DEPDIR="${am__leading_dot}deps"
+
+ ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-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='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CC" am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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'.
+ 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
+ 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 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ 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
+ ;;
+ none) break ;;
+ esac
+ # 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.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} 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
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$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
+
+
+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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+# 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.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_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
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+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. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$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'
+
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-lm':
+
+
+echo "$as_me:$LINENO: checking for main in -lm" >&5
+echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+main ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_m_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
+echo "${ECHO_T}$ac_cv_lib_m_main" >&6
+if test $ac_cv_lib_m_main = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+
+
+# Checks for header files.
+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
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f 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
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+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
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f 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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.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))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+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=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+
+
+for ac_header in fcntl.h limits.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to resample-bugs@w3k.org ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
+echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6
+if test "${ac_cv_header_stdbool_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <stdbool.h>
+#ifndef bool
+# error bool is not defined
+#endif
+#ifndef false
+# error false is not defined
+#endif
+#if false
+# error false is not 0
+#endif
+#ifndef true
+# error true is not defined
+#endif
+#if true != 1
+# error true is not 1
+#endif
+#ifndef __bool_true_false_are_defined
+# error __bool_true_false_are_defined is not defined
+#endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) -0.5 == true ? 1 : -1];
+ bool e = &s;
+ char f[(_Bool) -0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+
+int
+main ()
+{
+ return !a + !b + !c + !d + !e + !f + !g + !h + !i;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdbool_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdbool_h=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6
+echo "$as_me:$LINENO: checking for _Bool" >&5
+echo $ECHO_N "checking for _Bool... $ECHO_C" >&6
+if test "${ac_cv_type__Bool+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((_Bool *) 0)
+ return 0;
+if (sizeof (_Bool))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type__Bool=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type__Bool=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
+echo "${ECHO_T}$ac_cv_type__Bool" >&6
+if test $ac_cv_type__Bool = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STDBOOL_H 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for mode_t" >&5
+echo $ECHO_N "checking for mode_t... $ECHO_C" >&6
+if test "${ac_cv_type_mode_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((mode_t *) 0)
+ return 0;
+if (sizeof (mode_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_mode_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_mode_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
+echo "${ECHO_T}$ac_cv_type_mode_t" >&6
+if test $ac_cv_type_mode_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+if test "${ac_cv_type_off_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((off_t *) 0)
+ return 0;
+if (sizeof (off_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_off_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_off_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6
+if test $ac_cv_type_off_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
+if test "${ac_cv_type_pid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((pid_t *) 0)
+ return 0;
+if (sizeof (pid_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_pid_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_pid_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6
+if test $ac_cv_type_pid_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+ return 0;
+if (sizeof (size_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_size_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_size_t=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
+
+fi
+
+
+# Checks for library functions.
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+echo "$as_me:$LINENO: checking for working alloca.h" >&5
+echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6
+if test "${ac_cv_working_alloca_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_working_alloca_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_working_alloca_h=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
+echo "${ECHO_T}$ac_cv_working_alloca_h" >&6
+if test $ac_cv_working_alloca_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA_H 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for alloca" >&5
+echo $ECHO_N "checking for alloca... $ECHO_C" >&6
+if test "${ac_cv_func_alloca_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_alloca_works=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_alloca_works=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
+echo "${ECHO_T}$ac_cv_func_alloca_works" >&6
+
+if test $ac_cv_func_alloca_works = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA 1
+_ACEOF
+
+else
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble. Some versions do not even contain alloca or
+# contain a buggy version. If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=alloca.$ac_objext
+
+cat >>confdefs.h <<\_ACEOF
+#define C_ALLOCA 1
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
+echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6
+if test "${ac_cv_os_cray+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "webecray" >/dev/null 2>&1; then
+ ac_cv_os_cray=yes
+else
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
+echo "${ECHO_T}$ac_cv_os_cray" >&6
+if test $ac_cv_os_cray = yes; then
+ for ac_func in _getb67 GETB67 getb67; do
+ as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); 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 $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* 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_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+ break
+fi
+
+ done
+fi
+
+echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
+echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6
+if test "${ac_cv_c_stack_direction+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_stack_direction=0
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+int
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+ exit (find_stack_direction () < 0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_stack_direction=1
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_stack_direction=-1
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
+echo "${ECHO_T}$ac_cv_c_stack_direction" >&6
+
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+if test $ac_cv_c_compiler_gnu = yes; then
+ echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_pattern="Autoconf.*'x'"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sgtty.h>
+Autoconf TIOCGETP
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
+ ac_cv_prog_gcc_traditional=yes
+else
+ ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+ if test $ac_cv_prog_gcc_traditional = no; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
+ if test $ac_cv_prog_gcc_traditional = yes; then
+ CC="$CC -traditional"
+ fi
+fi
+
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to resample-bugs@w3k.org ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
+echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_malloc_0_nonnull=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if STDC_HEADERS || HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+exit (malloc (0) ? 0 : 1);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_malloc_0_nonnull=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
+if test $ac_cv_func_malloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 1
+_ACEOF
+
+else
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 0
+_ACEOF
+
+ case $LIBOBJS in
+ "malloc.$ac_objext" | \
+ *" malloc.$ac_objext" | \
+ "malloc.$ac_objext "* | \
+ *" malloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define malloc rpl_malloc
+_ACEOF
+
+fi
+
+
+
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to resample-bugs@w3k.org ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5
+echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6
+if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_realloc_0_nonnull=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if STDC_HEADERS || HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *realloc ();
+#endif
+
+int
+main ()
+{
+exit (realloc (0, 0) ? 0 : 1);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_realloc_0_nonnull=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_realloc_0_nonnull=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6
+if test $ac_cv_func_realloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_REALLOC 1
+_ACEOF
+
+else
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_REALLOC 0
+_ACEOF
+
+ case $LIBOBJS in
+ "realloc.$ac_objext" | \
+ *" realloc.$ac_objext" | \
+ "realloc.$ac_objext "* | \
+ *" realloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS realloc.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define realloc rpl_realloc
+_ACEOF
+
+fi
+
+
+
+echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
+echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6
+if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ rm -f conftest.sym conftest.file
+echo >conftest.file
+if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ /* Linux will dereference the symlink and fail.
+ That is better in the sense that it means we will not
+ have to compile and use the lstat wrapper. */
+ exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+else
+ # If the `ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f conftest.sym conftest.file
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6
+
+test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+
+if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+ case $LIBOBJS in
+ "lstat.$ac_objext" | \
+ *" lstat.$ac_objext" | \
+ "lstat.$ac_objext "* | \
+ *" lstat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
+esac
+
+fi
+
+echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
+echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6
+if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_stat_empty_string_bug=yes
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ exit (stat ("", &sbuf) ? 1 : 0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_stat_empty_string_bug=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_stat_empty_string_bug=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
+echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6
+if test $ac_cv_func_stat_empty_string_bug = yes; then
+ case $LIBOBJS in
+ "stat.$ac_objext" | \
+ *" stat.$ac_objext" | \
+ "stat.$ac_objext "* | \
+ *" stat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STAT_EMPTY_STRING_BUG 1
+_ACEOF
+
+fi
+
+
+for ac_func in strftime
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); 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 $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* 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_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ # strftime is in -lintl on SCO UNIX.
+echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
+echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6
+if test "${ac_cv_lib_intl_strftime+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char strftime ();
+int
+main ()
+{
+strftime ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_intl_strftime=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_intl_strftime=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
+echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6
+if test $ac_cv_lib_intl_strftime = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRFTIME 1
+_ACEOF
+
+LIBS="-lintl $LIBS"
+fi
+
+fi
+done
+
+
+for ac_func in vprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); 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 $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* 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_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+echo "$as_me:$LINENO: checking for _doprnt" >&5
+echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6
+if test "${ac_cv_func__doprnt+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define _doprnt innocuous__doprnt
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt (); 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 _doprnt
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _doprnt ();
+/* 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__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+char (*f) () = _doprnt;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != _doprnt;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func__doprnt=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func__doprnt=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
+echo "${ECHO_T}$ac_cv_func__doprnt" >&6
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOPRNT 1
+_ACEOF
+
+fi
+
+fi
+done
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in atexit floor getcwd memmove memset pathconf pow sqrt strdup strerror strtol
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); 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 $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* 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_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+ ac_config_files="$ac_config_files Makefile man/Makefile sndlib-20/makefile sndlib-20/sndins/Makefile src/Makefile"
+
+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, don't put newlines in cache variables' values.
+# 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.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *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 \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ 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}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ 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[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $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}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# 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+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; 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
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ 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
+
+ ;;
+ 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
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # 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 sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# 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'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by resample $as_me 1.8.1, which was
+generated by GNU Autoconf 2.59. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -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
+ --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 <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+resample config.status 1.8.1
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+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=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ 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
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
+ "sndlib-20/makefile" ) CONFIG_FILES="$CONFIG_FILES sndlib-20/makefile" ;;
+ "sndlib-20/sndins/Makefile" ) CONFIG_FILES="$CONFIG_FILES sndlib-20/sndins/Makefile" ;;
+ "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ 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 to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@ALLOCA@,$ALLOCA,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+ esac
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # 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. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ # Do quote $f, to prevent DOS paths from being IFS'd.
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status. Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #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.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # 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. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated by configure. */" >$tmp/config.h
+ else
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
+ fi
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
+ fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $ac_file | $ac_file:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X$ac_file : 'X\(//\)[^/]' \| \
+ X$ac_file : 'X\(//\)$' \| \
+ X$ac_file : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; 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.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+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"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p $dirpart/$fdir
+ else
+ as_dir=$dirpart/$fdir
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+ esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# 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 || { (exit 1); exit 1; }
+fi
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+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='resample'
+ VERSION='1.8.1'
+
+
+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"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# 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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+depcc="$CC" am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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'.
+ 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
+ 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 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ 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
+ ;;
+ none) break ;;
+ esac
+ # 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.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} 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
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$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
+
+
+
diff --git a/third_party/resample/configure.in b/third_party/resample/configure.in
new file mode 100644
index 00000000..ae13f30d
--- /dev/null
+++ b/third_party/resample/configure.in
@@ -0,0 +1,50 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.59)
+# BEGIN modified/added by jos (all else written by autoscan)
+AC_INIT([resample],[1.8.1],[resample-bugs@w3k.org])
+AM_INIT_AUTOMAKE(resample,1.8.1)
+# (also removed testdir for now)
+# END modified/added by jos
+AC_CONFIG_SRCDIR([src/smallfilter.h])
+AC_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PROG_INSTALL
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-lm':
+AC_CHECK_LIB([m], [main])
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_CONST
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_FUNC_ALLOCA
+AC_PROG_GCC_TRADITIONAL
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_FUNC_STAT
+AC_FUNC_STRFTIME
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([atexit floor getcwd memmove memset pathconf pow sqrt strdup strerror strtol])
+
+AC_CONFIG_FILES([Makefile
+ man/Makefile
+ sndlib-20/makefile
+ sndlib-20/sndins/Makefile
+ src/Makefile])
+AC_OUTPUT
+AM_INIT_AUTOMAKE
diff --git a/third_party/resample/depcomp b/third_party/resample/depcomp
new file mode 100644
index 00000000..04701da5
--- /dev/null
+++ b/third_party/resample/depcomp
@@ -0,0 +1,530 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, 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.
+
+# 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 outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+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"
+
+# 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
+
+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.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## 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).
+## - 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 -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## 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.
+ tr ' ' '
+' < "$tmpdepfile" |
+## 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.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -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 -eq 0; then :
+ else
+ 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 ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+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.
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+ stat=$?
+
+ if test -f "$tmpdepfile"; then :
+ else
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`
+ tmpdepfile="$stripped.u"
+ fi
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ outname="$stripped.o"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ 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"
+ ;;
+
+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.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mecanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in 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.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#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 $1 != '--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:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ 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 $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ 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.
+ -*|$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"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ 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 $1 != '--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, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+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-end: "$"
+# End:
diff --git a/third_party/resample/install-sh b/third_party/resample/install-sh
new file mode 100644
index 00000000..4d4a9519
--- /dev/null
+++ b/third_party/resample/install-sh
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# 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. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+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:
+-c (ignored)
+-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.
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+ case $1 in
+ -c) shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
+ shift
+ shift
+ continue;;
+
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ *) # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ test -n "$dir_arg$dstarg" && break
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+ break;;
+ esac
+done
+
+if test -z "$1"; 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
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ src=
+
+ if test -d "$dst"; then
+ mkdircmd=:
+ chmodcmd=
+ else
+ mkdircmd=$mkdirprog
+ fi
+ 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 "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
+
+ # 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: $dstarg: Is a directory" >&2
+ exit 1
+ fi
+ dst=$dst/`basename "$src"`
+ fi
+ fi
+
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+ # Make sure that the destination directory exists.
+
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
+
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ shift
+ IFS=$oIFS
+
+ pathcomp=
+
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
+ shift
+ if test ! -d "$pathcomp"; then
+ $mkdirprog "$pathcomp"
+ # mkdir can fail with a `File exist' error in case several
+ # install-sh are creating the directory concurrently. This
+ # is OK.
+ test -d "$pathcomp" || exit
+ fi
+ pathcomp=$pathcomp/
+ done
+ fi
+
+ if test -n "$dir_arg"; then
+ $doit $mkdircmd "$dst" \
+ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+ else
+ dstfile=`basename "$dst"`
+
+ # 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
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Copy the file name to the temp name.
+ $doit $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 "$dsttmp"; } &&
+
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 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.
+ {
+ if test -f "$dstdir/$dstfile"; then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+ || {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit 1
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+ }
+ }
+ fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+ (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/third_party/resample/man/Makefile.am b/third_party/resample/man/Makefile.am
new file mode 100644
index 00000000..eca52a18
--- /dev/null
+++ b/third_party/resample/man/Makefile.am
@@ -0,0 +1,2 @@
+man_MANS = resample.1 windowfilter.1
+EXTRA_DIST = $(man_MANS)
diff --git a/third_party/resample/man/Makefile.in b/third_party/resample/man/Makefile.in
new file mode 100644
index 00000000..c3828b2e
--- /dev/null
+++ b/third_party/resample/man/Makefile.in
@@ -0,0 +1,330 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+subdir = man
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)"
+NROFF = nroff
+MANS = $(man_MANS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+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_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+man_MANS = resample.1 windowfilter.1
+EXTRA_DIST = $(man_MANS)
+all: all-am
+
+.SUFFIXES:
+$(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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu man/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
+uninstall-info-am:
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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 $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(man1dir)"; 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
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-man1 install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+ uninstall-am uninstall-info-am uninstall-man uninstall-man1
+
+# 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/third_party/resample/man/resample.1 b/third_party/resample/man/resample.1
new file mode 100644
index 00000000..7a85565b
--- /dev/null
+++ b/third_party/resample/man/resample.1
@@ -0,0 +1,115 @@
+.TH RESAMPLE 1 "5 Jan 2006" "CCRMA"
+.SH NAME
+resample \- resample a 16-bit mono or stereo sound file by an arbitrary factor
+
+.SH SYNOPSIS
+\fBresample\fR
+[-by factor]
+[-to newSrate]
+[-f filterFile]
+[-n]
+[-l]
+[-trace]
+[-version]
+inputFile
+[outputFile]
+
+.SH DESCRIPTION
+The \fBresample\fR program takes a 16-bit mono or stereo sound file
+and performs bandlimited interpolation to produce an output sound file
+have a desired new sampling rate. The output file is in the same
+format as the input.
+
+.SH OPTIONS
+
+.IP \fB\-toSrate\fR
+This option or "-byFactor" is required. Specify new sampling rate in
+samples per second. The conversion factor is implied and will be set
+to the new sampling rate divided by the sampling rate of the input
+soundfile.
+
+.IP \fB\-byFactor\fR
+Specify conversion factor. This option or "-toSrate" is required.
+The conversion factor is the amount by which the sampling rate is
+changed. If the sampling rate of the input signal is Srate1, then the
+sampling rate of the output is factor*Srate1. For example, a factor
+of 2.0 increases the sampling rate by a factor of 2, giving twice as
+many samples in the output signal as in the input. The fractional
+part of the conversion factor is accurate to 15 bits. This is
+sufficiently accurate that humans should not be able to hear any error
+whatsoever in the pitch of resampled sounds.
+
+.IP \fB\-filterFile\fR
+Change the resampling filter from its default. Such a filter file can
+be designed by the \fBwindowfilter (1)\fR program (included with the
+\fBresample\fR distribution). The preloaded filter file requires an
+oversampling factor of at least 20% to avoid aliasing (in other words,
+its "transition band" as a lowpass filter is at least 20% of the
+useable frequency range in the sampled signal); the stop-band
+attenuation is approximately 80 dB.
+
+.IP \fB\-noFilterInterp\fR
+By default, the resampling filter table is linearly interpolated to
+provide high audio quality at arbitrary sampling-rate conversion
+factors. This option turns off filter interpolation, thus cutting the
+number of multiply-adds in half in the inner loop (for most conversion
+factors).
+
+.IP \fB\-linearInterpolation\fR
+Select plain linear interpolation for resampling (which means
+resampling filter table is not used at all). This option is very fast,
+but the output quality is poor unless the signal is already heavily
+oversampled. Do not confuse linear interpolation of the signal with
+linear interpolation of the resampling-filter-table which is
+controlled by the "noFilterInterp" option.
+
+.IP \fB\-terse\fR
+Disable informational printout.
+
+.IP \fB\-version\fR
+Print program version.
+
+.SH EXAMPLE
+To convert the sampling rate from 48 kHz (used by DAT machines) to
+44.1 kHz (the standard sampling rate for Compact Discs), the command
+line would look something like
+
+ resample -to 44100 dat.snd cd.snd
+or
+ resample -by 0.91875 dat.snd cd.snd
+
+Any reasonable sampling rate can be converted to any other. (Note
+that, in this example, if you have obtained a direct-digital transfer
+from DAT or CD, you probably have some pre-emphasis filtering which
+should be canceled using a digital filter. See README.deemph in the
+\fBresample\fR release for further information)
+
+.SH REFERENCES
+Source code and further documentation may be found at the Digital
+Audio Resampling Home Page (DARHP) located at
+
+ http://ccrma.stanford.edu/~jos/resample/
+
+.SH HISTORY
+The first version of this software was written by Julius O. Smith III
+<jos /at/ ccrma /dot/ stanford /dot/ edu> at CCRMA
+<http://ccrma.stanford.edu> in 1981. It was called SRCONV and was
+written in SAIL for PDP-10 compatible machines (see the DARHP for that
+code). The algorithm was first published in
+
+Smith, Julius O. and Phil Gossett. ``A Flexible Sampling-Rate
+Conversion Method,'' Proceedings (2): 19.4.1-19.4.4, IEEE Conference
+on Acoustics, Speech, and Signal Processing, San Diego, March 1984.
+
+An expanded tutorial based on this paper is available at the DARHP.
+
+Circa 1988, the SRCONV program was translated from SAIL to C by
+Christopher Lee Fraley working with Roger Dannenberg at CMU.
+
+Since then, the C version has been maintained by jos.
+
+Sndlib support was added 6/99 by John Gibson <jgg9c@virginia.edu>.
+
+The \fBresample\fR program is free software distributed in accordance
+with the Lesser GNU Public License (LGPL). There is NO warranty; not
+even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/third_party/resample/man/windowfilter.1 b/third_party/resample/man/windowfilter.1
new file mode 100644
index 00000000..ead219d2
--- /dev/null
+++ b/third_party/resample/man/windowfilter.1
@@ -0,0 +1,27 @@
+.TH WINDOWFILTER 1 "19 Jun 2002" "CCRMA"
+.SH NAME
+windowfilter \- design an FIR digital filter by the window method
+
+.SH DESCRIPTION
+The \fBwindowfilter\fR program designs an FIR digital filter for use
+with the \fBresample\fR program. Just run the program and type ? at
+its prompts to get an explanation of its options.
+
+.SH REFERENCES
+
+Digital Signal Processing Committee, ed., \fBPrograms for Digital
+Signal Processing\fR, IEEE Press, New York, 1979.
+
+J. F. Kaiser, "Using the I0-sinh Window Function," Proc. IEEE
+Int. Symp. on Circuits and Syst., April 22-25, pp. 20-23, 1974.
+
+F. J. Harris, "On the Use of Windows for Harmonic Analysis with the
+Discrete Fourier Transform," Proceedings of the IEEE, vol. 66, no. 1,
+pp. 51-83. Jan. 1978.
+
+A. H. Nuttall, "Some Windows with Very Good Sidelobe Behavior," IEEE
+Transactions on Acoustics, Speech, and Signal Processing,
+vol. ASSP-29, no. 1, pp. 84-91, Feb. 1981.
+
+L. R. Rabiner and B. Gold, \fBTheory and Application of Digital Signal
+Processing,\fR Prentice-Hall Inc., Englewood Cliffs, NJ, 1975.
diff --git a/third_party/resample/missing b/third_party/resample/missing
new file mode 100644
index 00000000..894e786e
--- /dev/null
+++ b/third_party/resample/missing
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, 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.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+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
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case "$firstarg" in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case "$firstarg" in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/third_party/resample/sndlib-20/_sndlib.h b/third_party/resample/sndlib-20/_sndlib.h
new file mode 100644
index 00000000..560290ec
--- /dev/null
+++ b/third_party/resample/sndlib-20/_sndlib.h
@@ -0,0 +1,603 @@
+#ifndef SNDLIB_H
+#define SNDLIB_H
+
+#define SNDLIB_VERSION 20
+#define SNDLIB_REVISION 0
+#define SNDLIB_DATE "28-Mar-06"
+
+#include <stdio.h>
+#include <mus-config.h>
+
+#if HAVE_UNISTD_H && (!(defined(_MSC_VER)))
+ #include <unistd.h>
+#endif
+
+#include <sys/types.h>
+
+#ifndef __cplusplus
+#if HAVE_STDBOOL_H
+ #include <stdbool.h>
+#else
+#ifndef true
+ #define bool int
+ #define true 1
+ #define false 0
+#endif
+#endif
+#endif
+
+#if (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T > 4)) || (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
+ #if (SIZEOF_OFF_T == SIZEOF_LONG)
+ #define OFF_TD "%ld"
+ #else
+ #define OFF_TD "%lld"
+ #endif
+#else
+ #define OFF_TD "%d"
+#endif
+
+#ifndef MUS_LITTLE_ENDIAN
+ #if WORDS_BIGENDIAN
+ #define MUS_LITTLE_ENDIAN 0
+ #else
+ #define MUS_LITTLE_ENDIAN 1
+ #endif
+#endif
+
+#ifndef c__FUNCTION__
+#if (HAVE___FUNC__) || (defined(__STDC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
+ #define c__FUNCTION__ __func__
+#else
+#ifdef __GNUC__
+ #define c__FUNCTION__ __FUNCTION__
+#else
+ #define c__FUNCTION__ ""
+#endif
+#endif
+#endif
+
+#if (!defined(M_PI))
+ #define M_PI 3.14159265358979323846264338327
+ #define M_PI_2 (M_PI / 2.0)
+#endif
+
+#define POWER_OF_2_P(x) ((((x) - 1) & (x)) == 0)
+/* from sys/param.h */
+
+#ifndef SEEK_SET
+ #define SEEK_SET 0
+ #define SEEK_END 2
+#endif
+
+#if (!SNDLIB_USE_FLOATS)
+ #define mus_sample_t int
+ #ifndef MUS_SAMPLE_BITS
+ #define MUS_SAMPLE_BITS 24
+ #endif
+ #define MUS_SAMPLE_0 0
+ #define MUS_BYTE_TO_SAMPLE(n) ((mus_sample_t)((n) << (MUS_SAMPLE_BITS - 8)))
+ #define MUS_SAMPLE_TO_BYTE(n) ((n) >> (MUS_SAMPLE_BITS - 8))
+ #define MUS_SHORT_TO_SAMPLE(n) ((mus_sample_t)((n) << (MUS_SAMPLE_BITS - 16)))
+ #define MUS_SAMPLE_TO_SHORT(n) ((short)((n) >> (MUS_SAMPLE_BITS - 16)))
+ #if (MUS_SAMPLE_BITS < 24)
+ #define MUS_INT24_TO_SAMPLE(n) ((mus_sample_t)((n) >> (24 - MUS_SAMPLE_BITS)))
+ #define MUS_SAMPLE_TO_INT24(n) ((int)((n) << (24 - MUS_SAMPLE_BITS)))
+ #else
+ #define MUS_INT24_TO_SAMPLE(n) ((mus_sample_t)((n) << (MUS_SAMPLE_BITS - 24)))
+ #define MUS_SAMPLE_TO_INT24(n) ((int)((n) >> (MUS_SAMPLE_BITS - 24)))
+ #endif
+ #define MUS_INT_TO_SAMPLE(n) ((mus_sample_t)(n))
+ #define MUS_SAMPLE_TO_INT(n) ((int)(n))
+ /* these are for direct read/write (no cross-image assumption is made about 32 bit int scaling) */
+ #define MUS_FLOAT_TO_FIX ((MUS_SAMPLE_BITS < 32) ? (1 << (MUS_SAMPLE_BITS - 1)) : 0x7fffffff)
+ #define MUS_FIX_TO_FLOAT (1.0 / (float)(MUS_FLOAT_TO_FIX))
+ #define MUS_FLOAT_TO_SAMPLE(n) ((mus_sample_t)((n) * MUS_FLOAT_TO_FIX))
+ #define MUS_SAMPLE_TO_FLOAT(n) ((float)((n) * MUS_FIX_TO_FLOAT))
+ #define MUS_DOUBLE_TO_SAMPLE(n) ((mus_sample_t)((n) * MUS_FLOAT_TO_FIX))
+ #define MUS_SAMPLE_TO_DOUBLE(n) ((double)((n) * MUS_FIX_TO_FLOAT))
+ #define MUS_SAMPLE_MAX ((mus_sample_t)((MUS_SAMPLE_BITS < 32) ? (MUS_FLOAT_TO_FIX - 1) : 0x7fffffff))
+ #define MUS_SAMPLE_MIN ((mus_sample_t)((MUS_SAMPLE_BITS < 32) ? (-(MUS_FLOAT_TO_FIX)) : -0x7fffffff))
+ #define mus_sample_abs(Sample) abs(Sample)
+#else
+ #define mus_sample_t Float
+ #ifndef MUS_SAMPLE_BITS
+ #define MUS_SAMPLE_BITS 24
+ #endif
+ #define MUS_SAMPLE_0 0.0
+ #define MUS_BYTE_TO_SAMPLE(n) ((mus_sample_t)((Float)(n) / (Float)(1 << 7)))
+ #define MUS_SHORT_TO_SAMPLE(n) ((mus_sample_t)((Float)(n) / (Float)(1 << 15)))
+ #define MUS_INT_TO_SAMPLE(n) ((mus_sample_t)((Float)(n) / (Float)(1 << (MUS_SAMPLE_BITS - 1))))
+ #define MUS_INT24_TO_SAMPLE(n) ((mus_sample_t)((Float)(n) / (Float)(1 << 23)))
+ #define MUS_FLOAT_TO_FIX 1.0
+ #define MUS_FIX_TO_FLOAT 1.0
+ #define MUS_FLOAT_TO_SAMPLE(n) ((mus_sample_t)(n))
+ #define MUS_DOUBLE_TO_SAMPLE(n) ((mus_sample_t)(n))
+ #define MUS_SAMPLE_TO_FLOAT(n) ((Float)(n))
+ #define MUS_SAMPLE_TO_DOUBLE(n) ((double)(n))
+ #define MUS_SAMPLE_TO_INT(n) ((int)((n) * (1 << (MUS_SAMPLE_BITS - 1))))
+ #define MUS_SAMPLE_TO_INT24(n) ((int)((n) * (1 << 23)))
+ #define MUS_SAMPLE_TO_SHORT(n) ((short)((n) * (1 << 15)))
+ #define MUS_SAMPLE_TO_BYTE(n) ((char)((n) * (1 << 7)))
+ #define MUS_SAMPLE_MAX 0.99999
+ #define MUS_SAMPLE_MIN (-1.0)
+ #define mus_sample_abs(Sample) fabs(Sample)
+#endif
+
+enum {MUS_UNSUPPORTED, MUS_NEXT, MUS_AIFC, MUS_RIFF, MUS_BICSF, MUS_NIST, MUS_INRS, MUS_ESPS, MUS_SVX, MUS_VOC,
+ MUS_SNDT, MUS_RAW, MUS_SMP, MUS_AVR, MUS_IRCAM, MUS_SD1, MUS_SPPACK, MUS_MUS10, MUS_HCOM, MUS_PSION, MUS_MAUD,
+ MUS_IEEE, MUS_MATLAB, MUS_ADC, MUS_MIDI, MUS_SOUNDFONT, MUS_GRAVIS, MUS_COMDISCO, MUS_GOLDWAVE, MUS_SRFS,
+ MUS_MIDI_SAMPLE_DUMP, MUS_DIAMONDWARE, MUS_ADF, MUS_SBSTUDIOII, MUS_DELUSION,
+ MUS_FARANDOLE, MUS_SAMPLE_DUMP, MUS_ULTRATRACKER, MUS_YAMAHA_SY85, MUS_YAMAHA_TX16W, MUS_DIGIPLAYER,
+ MUS_COVOX, MUS_AVI, MUS_OMF, MUS_QUICKTIME, MUS_ASF, MUS_YAMAHA_SY99, MUS_KURZWEIL_2000,
+ MUS_AIFF, MUS_PAF, MUS_CSL, MUS_FILE_SAMP, MUS_PVF, MUS_SOUNDFORGE, MUS_TWINVQ, MUS_AKAI4,
+ MUS_IMPULSETRACKER, MUS_KORG, MUS_NVF, MUS_MAUI, MUS_SDIF, MUS_OGG, MUS_FLAC, MUS_SPEEX, MUS_MPEG,
+ MUS_SHORTEN, MUS_TTA, MUS_WAVPACK,
+ MUS_NUM_HEADER_TYPES};
+
+#if defined(__GNUC__) && (!(defined(__cplusplus)))
+ #define MUS_HEADER_TYPE_OK(n) ({ int _sndlib_h_0 = n; ((_sndlib_h_0 > MUS_UNSUPPORTED) && (_sndlib_h_0 <= MUS_MAUI)); })
+#else
+ #define MUS_HEADER_TYPE_OK(n) (((n) > MUS_UNSUPPORTED) && ((n) <= MUS_MAUI))
+#endif
+
+enum {MUS_UNKNOWN, MUS_BSHORT, MUS_MULAW, MUS_BYTE, MUS_BFLOAT, MUS_BINT, MUS_ALAW, MUS_UBYTE, MUS_B24INT,
+ MUS_BDOUBLE, MUS_LSHORT, MUS_LINT, MUS_LFLOAT, MUS_LDOUBLE, MUS_UBSHORT, MUS_ULSHORT, MUS_L24INT,
+ MUS_BINTN, MUS_LINTN, MUS_BFLOAT_UNSCALED, MUS_LFLOAT_UNSCALED, MUS_BDOUBLE_UNSCALED, MUS_LDOUBLE_UNSCALED,
+ MUS_NUM_DATA_FORMATS};
+
+/* MUS_LINTN and MUS_BINTN refer to 32 bit ints with 31 bits of "fraction" -- the data is "left justified" */
+/* "unscaled" means the float value is used directly (i.e. not as -1.0 to 1.0, but (probably) -32768.0 to 32768.0) */
+
+#if defined(__GNUC__) && (!(defined(__cplusplus)))
+ #define MUS_DATA_FORMAT_OK(n) ({ int _sndlib_h_1 = n; ((_sndlib_h_1 > MUS_UNKNOWN) && (_sndlib_h_1 < MUS_NUM_DATA_FORMATS)); })
+#else
+ #define MUS_DATA_FORMAT_OK(n) (((n) > MUS_UNKNOWN) && ((n) < MUS_NUM_DATA_FORMATS))
+#endif
+
+#if MUS_MAC_OSX
+ #if MUS_LITTLE_ENDIAN
+ #define MUS_AUDIO_COMPATIBLE_FORMAT MUS_LFLOAT
+ #else
+ #define MUS_AUDIO_COMPATIBLE_FORMAT MUS_BFLOAT
+ #endif
+#else
+ #if MUS_LITTLE_ENDIAN
+ #define MUS_AUDIO_COMPATIBLE_FORMAT MUS_LSHORT
+ #else
+ #define MUS_AUDIO_COMPATIBLE_FORMAT MUS_BSHORT
+ #endif
+#endif
+
+#define MUS_NIST_SHORTPACK 2
+#define MUS_AIFF_IMA_ADPCM 99
+
+#define MUS_AUDIO_PACK_SYSTEM(n) ((n) << 16)
+#define MUS_AUDIO_SYSTEM(n) (((n) >> 16) & 0xffff)
+#define MUS_AUDIO_DEVICE(n) ((n) & 0xffff)
+
+enum {MUS_AUDIO_DEFAULT, MUS_AUDIO_DUPLEX_DEFAULT, MUS_AUDIO_ADAT_IN, MUS_AUDIO_AES_IN, MUS_AUDIO_LINE_OUT,
+ MUS_AUDIO_LINE_IN, MUS_AUDIO_MICROPHONE, MUS_AUDIO_SPEAKERS, MUS_AUDIO_DIGITAL_IN, MUS_AUDIO_DIGITAL_OUT,
+ MUS_AUDIO_DAC_OUT, MUS_AUDIO_ADAT_OUT, MUS_AUDIO_AES_OUT, MUS_AUDIO_DAC_FILTER, MUS_AUDIO_MIXER,
+ MUS_AUDIO_LINE1, MUS_AUDIO_LINE2, MUS_AUDIO_LINE3, MUS_AUDIO_AUX_INPUT, MUS_AUDIO_CD,
+ MUS_AUDIO_AUX_OUTPUT, MUS_AUDIO_SPDIF_IN, MUS_AUDIO_SPDIF_OUT, MUS_AUDIO_AMP, MUS_AUDIO_SRATE,
+ MUS_AUDIO_CHANNEL, MUS_AUDIO_FORMAT, MUS_AUDIO_IMIX, MUS_AUDIO_IGAIN, MUS_AUDIO_RECLEV,
+ MUS_AUDIO_PCM, MUS_AUDIO_PCM2, MUS_AUDIO_OGAIN, MUS_AUDIO_LINE, MUS_AUDIO_SYNTH,
+ MUS_AUDIO_BASS, MUS_AUDIO_TREBLE, MUS_AUDIO_PORT, MUS_AUDIO_SAMPLES_PER_CHANNEL,
+ MUS_AUDIO_DIRECTION
+};
+/* Snd's recorder uses MUS_AUDIO_DIRECTION to find the size of this list */
+
+#if defined(__GNUC__) && (!(defined(__cplusplus)))
+ #define MUS_AUDIO_DEVICE_OK(a) ({ int _sndlib_h_2 = a; ((_sndlib_h_2 >= MUS_AUDIO_DEFAULT) && (_sndlib_h_2 <= MUS_AUDIO_DIRECTION)); })
+#else
+ #define MUS_AUDIO_DEVICE_OK(a) (((a) >= MUS_AUDIO_DEFAULT) && ((a) <= MUS_AUDIO_DIRECTION))
+#endif
+
+#define MUS_ERROR -1
+
+enum {MUS_NO_ERROR, MUS_NO_FREQUENCY, MUS_NO_PHASE, MUS_NO_GEN, MUS_NO_LENGTH,
+ MUS_NO_FREE, MUS_NO_DESCRIBE, MUS_NO_DATA, MUS_NO_SCALER,
+ MUS_MEMORY_ALLOCATION_FAILED, MUS_UNSTABLE_TWO_POLE_ERROR,
+ MUS_CANT_OPEN_FILE, MUS_NO_SAMPLE_INPUT, MUS_NO_SAMPLE_OUTPUT,
+ MUS_NO_SUCH_CHANNEL, MUS_NO_FILE_NAME_PROVIDED, MUS_NO_LOCATION, MUS_NO_CHANNEL,
+ MUS_NO_SUCH_FFT_WINDOW, MUS_UNSUPPORTED_DATA_FORMAT, MUS_HEADER_READ_FAILED,
+ MUS_UNSUPPORTED_HEADER_TYPE,
+ MUS_FILE_DESCRIPTORS_NOT_INITIALIZED, MUS_NOT_A_SOUND_FILE, MUS_FILE_CLOSED, MUS_WRITE_ERROR,
+ MUS_HEADER_WRITE_FAILED, MUS_CANT_OPEN_TEMP_FILE, MUS_INTERRUPTED, MUS_BAD_ENVELOPE,
+
+ MUS_AUDIO_CHANNELS_NOT_AVAILABLE, MUS_AUDIO_SRATE_NOT_AVAILABLE, MUS_AUDIO_FORMAT_NOT_AVAILABLE,
+ MUS_AUDIO_NO_INPUT_AVAILABLE, MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ MUS_AUDIO_NO_LINES_AVAILABLE, MUS_AUDIO_WRITE_ERROR, MUS_AUDIO_SIZE_NOT_AVAILABLE, MUS_AUDIO_DEVICE_NOT_AVAILABLE,
+ MUS_AUDIO_CANT_CLOSE, MUS_AUDIO_CANT_OPEN, MUS_AUDIO_READ_ERROR, MUS_AUDIO_AMP_NOT_AVAILABLE,
+ MUS_AUDIO_CANT_WRITE, MUS_AUDIO_CANT_READ, MUS_AUDIO_NO_READ_PERMISSION,
+ MUS_CANT_CLOSE_FILE, MUS_ARG_OUT_OF_RANGE,
+ MUS_MIDI_OPEN_ERROR, MUS_MIDI_READ_ERROR, MUS_MIDI_WRITE_ERROR, MUS_MIDI_CLOSE_ERROR, MUS_MIDI_INIT_ERROR, MUS_MIDI_MISC_ERROR,
+
+ MUS_NO_CHANNELS, MUS_NO_HOP, MUS_NO_WIDTH, MUS_NO_FILE_NAME, MUS_NO_RAMP, MUS_NO_RUN,
+ MUS_NO_INCREMENT, MUS_NO_OFFSET,
+ MUS_NO_XCOEFF, MUS_NO_YCOEFF, MUS_NO_XCOEFFS, MUS_NO_YCOEFFS, MUS_NO_RESET,
+ MUS_INITIAL_ERROR_TAG};
+
+/* keep this list in sync with mus_error_names in sound.c and snd-test.scm|rb */
+
+#if MUS_DEBUGGING
+ #define CALLOC(a, b) mem_calloc((a), (b), c__FUNCTION__, __FILE__, __LINE__)
+ #define MALLOC(a) mem_malloc((a), c__FUNCTION__, __FILE__, __LINE__)
+#ifndef __cplusplus
+ #define FREE(a) a = mem_free(a, c__FUNCTION__, __FILE__, __LINE__)
+#else
+ #define FREE(a) mem_free(a, c__FUNCTION__, __FILE__, __LINE__)
+#endif
+ #define REALLOC(a, b) mem_realloc(a, (b), c__FUNCTION__, __FILE__, __LINE__)
+#else
+ #define CALLOC(a, b) calloc((size_t)(a), (size_t)(b))
+ #define MALLOC(a) malloc((size_t)(a))
+ #define FREE(a) free(a)
+ #define REALLOC(a, b) realloc(a, (size_t)(b))
+#endif
+
+#if MUS_WINDOZE
+ #ifdef FOPEN
+ #undef FOPEN
+ #endif
+ #if USE_SND
+ #define OPEN(File, Flags, Mode) snd_open((File), (Flags), 0)
+ #else
+ #define OPEN(File, Flags, Mode) open((File), (Flags))
+ #endif
+#else
+ #if USE_SND
+ #define OPEN(File, Flags, Mode) snd_open((File), (Flags), (Mode))
+ #else
+ #define OPEN(File, Flags, Mode) open((File), (Flags), (Mode))
+ #endif
+#endif
+
+#if USE_SND
+ #define FOPEN(File, Flags) snd_fopen((File), (Flags))
+ #define CREAT(File, Flags) snd_creat((File), (Flags))
+ #define REMOVE(OldF) snd_remove(OldF, IGNORE_CACHE)
+ #define STRERROR(Err) snd_io_strerror()
+ #define CLOSE(Fd, Name) snd_close(Fd, Name)
+ #define FCLOSE(Fd, Name) snd_fclose(Fd, Name)
+#else
+ #define FOPEN(File, Flags) fopen((File), (Flags))
+ #define CREAT(File, Flags) creat((File), (Flags))
+ #define REMOVE(OldF) remove(OldF)
+ #define STRERROR(Err) strerror(Err)
+ #define CLOSE(Fd, Name) close(Fd)
+ #define FCLOSE(Fd, Name) fclose(Fd)
+#endif
+
+#ifndef S_setB
+ #if HAVE_RUBY
+ #define S_setB "set_"
+ #endif
+ #if HAVE_SCHEME
+ #define S_setB "set! "
+ #endif
+ #if HAVE_FORTH
+ #define S_setB "set-"
+ #endif
+ #if (!HAVE_EXTENSION_LANGUAGE)
+ #define S_setB "set-"
+ #endif
+#endif
+
+#define MUS_LOOP_INFO_SIZE 8
+
+#ifndef Float
+ #define Float float
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* -------- sound.c -------- */
+
+#ifdef __GNUC__
+ int mus_error(int error, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+ void mus_print(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+ char *mus_format(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+ void mus_snprintf(char *buffer, int buffer_len, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
+#else
+ int mus_error(int error, const char *format, ...);
+ void mus_print(const char *format, ...);
+ char *mus_format(const char *format, ...);
+ void mus_snprintf(char *buffer, int buffer_len, const char *format, ...);
+#endif
+
+typedef void mus_error_handler_t(int type, char *msg);
+mus_error_handler_t *mus_error_set_handler (mus_error_handler_t *new_error_handler);
+int mus_make_error(char *error_name);
+const char *mus_error_type_to_string(int err);
+
+typedef void mus_print_handler_t(char *msg);
+mus_print_handler_t *mus_print_set_handler (mus_print_handler_t *new_print_handler);
+
+off_t mus_sound_samples(const char *arg);
+off_t mus_sound_frames(const char *arg);
+int mus_sound_datum_size(const char *arg);
+off_t mus_sound_data_location(const char *arg);
+int mus_sound_chans(const char *arg);
+int mus_sound_srate(const char *arg);
+int mus_sound_header_type(const char *arg);
+int mus_sound_data_format(const char *arg);
+int mus_sound_original_format(const char *arg);
+off_t mus_sound_comment_start(const char *arg);
+off_t mus_sound_comment_end(const char *arg);
+off_t mus_sound_length(const char *arg);
+int mus_sound_fact_samples(const char *arg);
+time_t mus_sound_write_date(const char *arg);
+int mus_sound_type_specifier(const char *arg);
+int mus_sound_block_align(const char *arg);
+int mus_sound_bits_per_sample(const char *arg);
+
+int mus_sound_set_chans(const char *arg, int val);
+int mus_sound_set_srate(const char *arg, int val);
+int mus_sound_set_header_type(const char *arg, int val);
+int mus_sound_set_data_format(const char *arg, int val);
+int mus_sound_set_data_location(const char *arg, off_t val);
+int mus_sound_set_samples(const char *arg, off_t val);
+
+const char *mus_header_type_name(int type);
+const char *mus_data_format_name(int format);
+char *mus_header_type_to_string(int type);
+char *mus_data_format_to_string(int format);
+const char *mus_data_format_short_name(int format);
+char *mus_sound_comment(const char *name);
+int mus_bytes_per_sample(int format);
+float mus_sound_duration(const char *arg);
+int mus_sound_initialize(void);
+int mus_sample_bits(void);
+int mus_sound_override_header(const char *arg, int srate, int chans, int format, int type, off_t location, off_t size);
+int mus_sound_forget(const char *name);
+int mus_sound_prune(void);
+void mus_sound_report_cache(FILE *fp);
+int *mus_sound_loop_info(const char *arg);
+void mus_sound_set_loop_info(const char *arg, int *loop);
+
+int mus_sound_open_input(const char *arg);
+int mus_sound_open_output(const char *arg, int srate, int chans, int data_format, int header_type, const char *comment);
+int mus_sound_reopen_output(const char *arg, int chans, int format, int type, off_t data_loc);
+int mus_sound_close_input(int fd);
+int mus_sound_close_output(int fd, off_t bytes_of_data);
+#define mus_sound_seek_frame(Ifd, Frm) mus_file_seek_frame(Ifd, Frm)
+#define mus_sound_read(Fd, Beg, End, Chans, Bufs) mus_file_read(Fd, Beg, End, Chans, Bufs)
+#define mus_sound_write(Fd, Beg, End, Chans, Bufs) mus_file_write(Fd, Beg, End, Chans, Bufs)
+
+off_t mus_sound_maxamps(const char *ifile, int chans, mus_sample_t *vals, off_t *times);
+int mus_sound_set_maxamps(const char *ifile, int chans, mus_sample_t *vals, off_t *times);
+bool mus_sound_maxamp_exists(const char *ifile);
+int mus_file_to_array(const char *filename, int chan, int start, int samples, mus_sample_t *array);
+int mus_array_to_file(const char *filename, mus_sample_t *ddata, int len, int srate, int channels);
+char *mus_array_to_file_with_error(const char *filename, mus_sample_t *ddata, int len, int srate, int channels);
+int mus_file_to_float_array(const char *filename, int chan, off_t start, int samples, Float *array);
+int mus_float_array_to_file(const char *filename, Float *ddata, int len, int srate, int channels);
+
+
+
+/* -------- audio.c -------- */
+
+#if (HAVE_OSS || HAVE_ALSA || HAVE_JACK)
+ #define ALSA_API 0
+ #define OSS_API 1
+ #define JACK_API 2
+#endif
+
+void mus_audio_describe(void);
+char *mus_audio_report(void);
+int mus_audio_open_output(int dev, int srate, int chans, int format, int size);
+int mus_audio_open_input(int dev, int srate, int chans, int format, int size);
+int mus_audio_write(int line, char *buf, int bytes);
+int mus_audio_close(int line);
+int mus_audio_read(int line, char *buf, int bytes);
+
+int mus_audio_write_buffers(int line, int frames, int chans, mus_sample_t **bufs, int output_format, bool clipped);
+int mus_audio_read_buffers(int line, int frames, int chans, mus_sample_t **bufs, int input_format);
+
+int mus_audio_mixer_read(int dev, int field, int chan, float *val);
+int mus_audio_mixer_write(int dev, int field, int chan, float *val);
+int mus_audio_initialize(void);
+
+#if HAVE_OSS || HAVE_ALSA
+ int mus_audio_reinitialize(void); /* 29-Aug-01 for CLM/Snd bugfix? */
+ char *mus_alsa_playback_device(void);
+ char *mus_alsa_set_playback_device(const char *name);
+ char *mus_alsa_capture_device(void);
+ char *mus_alsa_set_capture_device(const char *name);
+ char *mus_alsa_device(void);
+ char *mus_alsa_set_device(const char *name);
+ int mus_alsa_buffer_size(void);
+ int mus_alsa_set_buffer_size(int size);
+ int mus_alsa_buffers(void);
+ int mus_alsa_set_buffers(int num);
+ bool mus_alsa_squelch_warning(void);
+ bool mus_alsa_set_squelch_warning(bool val);
+ int mus_audio_api(void);
+ void mus_oss_set_buffers(int num, int size);
+#endif
+
+int mus_audio_systems(void);
+char *mus_audio_system_name(int sys);
+char *mus_audio_moniker(void);
+int mus_audio_compatible_format(int dev);
+
+#if MUS_SUN
+ void mus_sun_set_outputs(int speakers, int headphones, int line_out);
+#endif
+
+#if MUS_NETBSD
+ void mus_netbsd_set_outputs(int speakers, int headphones, int line_out);
+#endif
+
+#if (!HAVE_STRERROR)
+ char *strerror(int errnum);
+#endif
+
+
+
+/* -------- io.c -------- */
+
+int mus_file_open_descriptors(int tfd, const char *arg, int df, int ds, off_t dl, int dc, int dt);
+int mus_file_open_read(const char *arg);
+bool mus_file_probe(const char *arg);
+int mus_file_open_write(const char *arg);
+int mus_file_create(const char *arg);
+int mus_file_reopen_write(const char *arg);
+ int mus_file_close(int fd);
+off_t mus_file_seek_frame(int tfd, off_t frame);
+int mus_file_read(int fd, int beg, int end, int chans, mus_sample_t **bufs);
+int mus_file_read_chans(int fd, int beg, int end, int chans, mus_sample_t **bufs, mus_sample_t **cm);
+int mus_file_write(int tfd, int beg, int end, int chans, mus_sample_t **bufs);
+int mus_file_read_any(int tfd, int beg, int chans, int nints, mus_sample_t **bufs, mus_sample_t **cm);
+int mus_file_read_file(int tfd, int beg, int chans, int nints, mus_sample_t **bufs);
+int mus_file_read_buffer(int charbuf_data_format, int beg, int chans, int nints, mus_sample_t **bufs, char *charbuf);
+int mus_file_write_file(int tfd, int beg, int end, int chans, mus_sample_t **bufs);
+int mus_file_write_buffer(int charbuf_data_format, int beg, int end, int chans, mus_sample_t **bufs, char *charbuf, bool clipped);
+char *mus_expand_filename(const char *name);
+char *mus_getcwd(void);
+
+bool mus_clipping(void);
+bool mus_set_clipping(bool new_value);
+bool mus_file_clipping(int tfd);
+int mus_file_set_clipping(int tfd, bool clipped);
+
+int mus_file_set_header_type(int tfd, int type);
+int mus_file_header_type(int tfd);
+char *mus_file_fd_name(int tfd);
+int mus_file_set_chans(int tfd, int chans);
+
+Float mus_file_prescaler(int tfd);
+Float mus_file_set_prescaler(int tfd, Float val);
+Float mus_prescaler(void);
+Float mus_set_prescaler(Float new_value);
+
+void mus_bint_to_char(unsigned char *j, int x);
+int mus_char_to_bint(const unsigned char *inp);
+void mus_lint_to_char(unsigned char *j, int x);
+int mus_char_to_lint(const unsigned char *inp);
+int mus_char_to_uninterpreted_int(const unsigned char *inp);
+void mus_bfloat_to_char(unsigned char *j, float x);
+float mus_char_to_bfloat(const unsigned char *inp);
+void mus_lfloat_to_char(unsigned char *j, float x);
+float mus_char_to_lfloat(const unsigned char *inp);
+void mus_bshort_to_char(unsigned char *j, short x);
+short mus_char_to_bshort(const unsigned char *inp);
+void mus_lshort_to_char(unsigned char *j, short x);
+short mus_char_to_lshort(const unsigned char *inp);
+void mus_ubshort_to_char(unsigned char *j, unsigned short x);
+unsigned short mus_char_to_ubshort(const unsigned char *inp);
+void mus_ulshort_to_char(unsigned char *j, unsigned short x);
+unsigned short mus_char_to_ulshort(const unsigned char *inp);
+double mus_char_to_ldouble(const unsigned char *inp);
+double mus_char_to_bdouble(const unsigned char *inp);
+void mus_bdouble_to_char(unsigned char *j, double x);
+void mus_ldouble_to_char(unsigned char *j, double x);
+unsigned int mus_char_to_ubint(const unsigned char *inp);
+unsigned int mus_char_to_ulint(const unsigned char *inp);
+
+int mus_iclamp(int lo, int val, int hi);
+off_t mus_oclamp(off_t lo, off_t val, off_t hi);
+Float mus_fclamp(Float lo, Float val, Float hi);
+
+/* for CLM */
+/* these are needed to clear a saved lisp image to the just-initialized state */
+void mus_reset_io_c(void);
+void mus_reset_headers_c(void);
+void mus_reset_audio_c(void);
+
+
+
+/* -------- headers.c -------- */
+
+off_t mus_header_samples(void);
+off_t mus_header_data_location(void);
+int mus_header_chans(void);
+int mus_header_srate(void);
+int mus_header_type(void);
+int mus_header_format(void);
+off_t mus_header_comment_start(void);
+off_t mus_header_comment_end(void);
+int mus_header_type_specifier(void);
+int mus_header_bits_per_sample(void);
+int mus_header_fact_samples(void);
+int mus_header_block_align(void);
+int mus_header_loop_mode(int which);
+int mus_header_loop_start(int which);
+int mus_header_loop_end(int which);
+int mus_header_mark_position(int id);
+int mus_header_base_note(void);
+int mus_header_base_detune(void);
+void mus_header_set_raw_defaults(int sr, int chn, int frm);
+void mus_header_raw_defaults(int *sr, int *chn, int *frm);
+off_t mus_header_true_length(void);
+int mus_header_original_format(void);
+off_t mus_samples_to_bytes(int format, off_t size);
+off_t mus_bytes_to_samples(int format, off_t size);
+int mus_header_write_next_header(int chan, int srate, int chans, int loc, int siz, int format, const char *comment, int len);
+int mus_header_read(const char *name);
+int mus_header_write(const char *name, int type, int srate, int chans, off_t loc, off_t size_in_samples, int format, const char *comment, int len);
+off_t mus_header_aux_comment_start(int n);
+off_t mus_header_aux_comment_end(int n);
+int mus_header_initialize(void);
+bool mus_header_writable(int type, int format);
+void mus_header_set_aiff_loop_info(int *data);
+int mus_header_sf2_entries(void);
+char *mus_header_sf2_name(int n);
+int mus_header_sf2_start(int n);
+int mus_header_sf2_end(int n);
+int mus_header_sf2_loop_start(int n);
+int mus_header_sf2_loop_end(int n);
+const char *mus_header_original_format_name(int format, int type);
+bool mus_header_no_header(const char *name);
+
+char *mus_header_riff_aux_comment(const char *name, off_t *starts, off_t *ends);
+char *mus_header_aiff_aux_comment(const char *name, off_t *starts, off_t *ends);
+
+int mus_header_change_chans(const char *filename, int type, int new_chans);
+int mus_header_change_srate(const char *filename, int type, int new_srate);
+int mus_header_change_type(const char *filename, int new_type, int new_format);
+int mus_header_change_format(const char *filename, int type, int new_format);
+int mus_header_change_location(const char *filename, int type, off_t new_location);
+int mus_header_change_comment(const char *filename, int type, char *new_comment);
+int mus_header_change_data_size(const char *filename, int type, off_t bytes);
+
+typedef void mus_header_write_hook_t(const char *filename);
+mus_header_write_hook_t *mus_header_write_set_hook(mus_header_write_hook_t *new_hook);
+
+
+/* -------- midi.c -------- */
+int mus_midi_open_read(const char *name);
+int mus_midi_open_write(const char *name);
+int mus_midi_close(int line);
+int mus_midi_read(int line, unsigned char *buffer, int bytes);
+int mus_midi_write(int line, unsigned char *buffer, int bytes);
+char *mus_midi_device_name(int sysdev);
+char *mus_midi_describe(void);
+#if HAVE_EXTENSION_LANGUAGE
+ void mus_midi_init(void);
+#endif
+
+
+#if MUS_DEBUGGING
+ /* snd-utils.c (only used in conjunction with Snd's memory tracking functions) */
+ void *mem_calloc(int len, int size, const char *func, const char *file, int line);
+ void *mem_malloc(int len, const char *func, const char *file, int line);
+ void *mem_free(void *ptr, const char *func, const char *file, int line);
+ void *mem_realloc(void *ptr, int size, const char *func, const char *file, int line);
+#endif
+
+#if (!HAVE_STRDUP)
+char *strdup(const char *str);
+#endif
+#if (!HAVE_FILENO)
+int fileno(FILE *fp);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/third_party/resample/sndlib-20/audio.c b/third_party/resample/sndlib-20/audio.c
new file mode 100644
index 00000000..32649bb3
--- /dev/null
+++ b/third_party/resample/sndlib-20/audio.c
@@ -0,0 +1,9867 @@
+/* Audio hardware handlers (SGI, OSS, ALSA, Sun, Windows, Mac OSX, Jack, ESD, HPUX, NetBSD) */
+
+/*
+ * layout of this file:
+ * error handlers
+ * SGI new and old audio library
+ * OSS (with Sam 9407 support)
+ * ALSA
+ * Sun (has switches for OpenBSD, but they're untested)
+ * Windows 95/98
+ * OSX
+ * ESD
+ * JACK
+ * HPUX
+ * NetBSD
+ * audio describers
+ */
+
+/*
+ * void mus_audio_describe(void) describes the audio hardware state.
+ * char *mus_audio_report(void) returns the same information as a string.
+ *
+ * int mus_audio_open_output(int dev, int srate, int chans, int format, int size)
+ * int mus_audio_open_input(int dev, int srate, int chans, int format, int size)
+ * int mus_audio_write(int line, char *buf, int bytes)
+ * int mus_audio_close(int line)
+ * int mus_audio_read(int line, char *buf, int bytes)
+ *
+ * int mus_audio_mixer_read(int dev, int field, int chan, float *val)
+ * int mus_audio_mixer_write(int dev, int field, int chan, float *val)
+ * int mus_audio_initialize(void) does whatever is needed to get set up
+ * int mus_audio_systems(void) returns number of separate complete audio systems (soundcards essentially)
+ * AUDIO_SYSTEM(n) selects the nth card (counting from 0), AUDIO_SYSTEM(0) is always the default
+ * char *mus_audio_system_name(int system) returns some user-recognizable (?) name for the given card (don't free)
+ * char *mus_audio_moniker(void) returns some brief description of the overall audio setup (don't free return string).
+ */
+
+/* error handling is tricky here -- higher levels are using many calls as probes, so
+ * the "error" is a sign of non-existence, not a true error. So, for nearly all
+ * cases, I'll use mus_print, not mus_error.
+ */
+
+#include <mus-config.h>
+
+#if USE_SND && MUS_MAC_OSX && USE_MOTIF
+ #undef USE_MOTIF
+ #define USE_NO_GUI 1
+ /* Xt's Boolean (/usr/include/X11/Intrinsic.h = char) collides with MacTypes.h Boolean, (actually,
+ * unsigned char in /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFBase.h)
+ * but we want snd.h for other stuff, so, if Motif is in use, don't load its headers at this time
+ * perhaps we could use the -funsigned-char switch in gcc
+ */
+#endif
+
+#if USE_SND && MUS_MAC_OSX && HAVE_RUBY
+ /* if using Ruby, OpenTransport.h T_* definitions collide with Ruby's -- it isn't needed here, so... */
+ #define REDEFINE_HAVE_RUBY 1
+ #undef HAVE_RUBY
+#endif
+
+#if USE_SND
+ #include "snd.h"
+#else
+ #define PRINT_BUFFER_SIZE 512
+ #define LABEL_BUFFER_SIZE 64
+#endif
+
+#if USE_SND && MUS_MAC_OSX
+ #define USE_MOTIF 1
+ #undef USE_NO_GUI
+ #if REDEFINE_HAVE_RUBY
+ #define HAVE_RUBY 1
+ #endif
+#endif
+
+#include <math.h>
+#include <stdio.h>
+#if HAVE_FCNTL_H
+ #include <fcntl.h>
+#endif
+#include <errno.h>
+#include <stdlib.h>
+#if (defined(HAVE_LIBC_H) && (!defined(HAVE_UNISTD_H)))
+ #include <libc.h>
+#else
+ #if (!(defined(_MSC_VER)))
+ #include <unistd.h>
+ #endif
+#endif
+#if HAVE_STRING_H
+ #include <string.h>
+#endif
+
+#if HAVE_SAM_9407
+ #include <sys/sam9407.h>
+#endif
+
+#ifdef MUS_MAC_OSX
+#include <CoreServices/CoreServices.h>
+#include <CoreAudio/CoreAudio.h>
+/* these pull in stdbool.h apparently, so they have to precede sndlib.h */
+#endif
+
+#include "_sndlib.h"
+#include "sndlib-strings.h"
+
+#if (!HAVE_STRERROR)
+char *strerror(int errnum)
+{
+ char *strerrbuf;
+ strerrbuf = (char *)CALLOC(LABEL_BUFFER_SIZE, sizeof(char));
+ mus_snprintf(strerrbuf, LABEL_BUFFER_SIZE, "io err %d", errnum);
+ return(strerrbuf);
+}
+#endif
+
+#define MUS_STANDARD_ERROR(Error_Type, Error_Message) \
+ mus_print("%s\n [%s[%d] %s]", Error_Message, __FILE__, __LINE__, c__FUNCTION__)
+
+#define MUS_STANDARD_IO_ERROR(Error_Type, IO_Func, IO_Name) \
+ mus_print("%s %s: %s\n [%s[%d] %s]", IO_Func, IO_Name, strerror(errno), __FILE__, __LINE__, c__FUNCTION__)
+
+
+static char *version_name = NULL;
+static bool audio_initialized = false;
+
+static const char *mus_audio_device_names[] = {
+ S_mus_audio_default, S_mus_audio_duplex_default, S_mus_audio_adat_in, S_mus_audio_aes_in, S_mus_audio_line_out,
+ S_mus_audio_line_in, S_mus_audio_microphone, S_mus_audio_speakers, S_mus_audio_digital_in, S_mus_audio_digital_out,
+ S_mus_audio_dac_out, S_mus_audio_adat_out, S_mus_audio_aes_out, S_mus_audio_dac_filter, S_mus_audio_mixer,
+ S_mus_audio_line1, S_mus_audio_line2, S_mus_audio_line3, S_mus_audio_aux_input, S_mus_audio_cd,
+ S_mus_audio_aux_output, S_mus_audio_spdif_in, S_mus_audio_spdif_out, S_mus_audio_amp, S_mus_audio_srate,
+ S_mus_audio_channel, S_mus_audio_format, S_mus_audio_imix, S_mus_audio_igain, S_mus_audio_reclev,
+ S_mus_audio_pcm, S_mus_audio_pcm2, S_mus_audio_ogain, S_mus_audio_line, S_mus_audio_synth,
+ S_mus_audio_bass, S_mus_audio_treble, S_mus_audio_port, S_mus_audio_samples_per_channel,
+ S_mus_audio_direction
+};
+
+static const char *mus_audio_device_name(int dev)
+{
+ if (MUS_AUDIO_DEVICE_OK(dev))
+ return(mus_audio_device_names[dev]);
+ return("invalid device");
+}
+
+#if (!HAVE_OSS) || (HAVE_ALSA)
+static const char *mus_audio_format_names[] = {
+ "unknown", S_mus_bshort, S_mus_mulaw, S_mus_byte, S_mus_bfloat, S_mus_bint, S_mus_alaw, S_mus_ubyte, S_mus_b24int,
+ S_mus_bdouble, S_mus_lshort, S_mus_lint, S_mus_lfloat, S_mus_ldouble, S_mus_ubshort, S_mus_ulshort, S_mus_l24int,
+ S_mus_bintn, S_mus_lintn
+};
+
+static const char *mus_audio_format_name(int fr)
+{
+ if (MUS_DATA_FORMAT_OK(fr))
+ return(mus_audio_format_names[fr]);
+ return("invalid format");
+}
+#endif
+
+static char *audio_strbuf = NULL; /* previous name "strbuf" collides with Mac OSX global! */
+static void pprint(char *str);
+
+int device_channels(int dev);
+int device_gains(int dev);
+
+int device_channels(int dev)
+{
+ float val[4];
+#if USE_SND && MUS_DEBUGGING
+ XEN res;
+ res = XEN_EVAL_C_STRING("(if (defined? 'debugging-device-channels) debugging-device-channels 0)");
+ if (XEN_INTEGER_P(res))
+ {
+ int chans;
+ chans = XEN_TO_C_INT(res);
+ if (chans > 0) return(chans);
+ }
+#endif
+ mus_audio_mixer_read(dev, MUS_AUDIO_CHANNEL, 0, val);
+ return((int)val[0]);
+}
+
+int device_gains(int ur_dev)
+{
+ float val[4];
+ int err;
+ int dev;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ /* to get hardware gains, read device amp_field and error = none */
+ if ((dev == MUS_AUDIO_DAC_FILTER) || (dev == MUS_AUDIO_MIXER))
+ {
+ err = mus_audio_mixer_read(ur_dev, MUS_AUDIO_CHANNEL, 0, val);
+#ifdef HAVE_ALSA
+ if (err != MUS_NO_ERROR) return(0);
+#endif
+ return((int)val[0]);
+ }
+ err = mus_audio_mixer_read(ur_dev, MUS_AUDIO_AMP, 0, val);
+ if (err != MUS_NO_ERROR) return(0);
+ return(device_channels(ur_dev));
+}
+
+
+
+/* ------------------------------- SGI ----------------------------------------- */
+
+#ifdef MUS_SGI
+#define AUDIO_OK
+
+#include <audio.h>
+
+int mus_audio_systems(void) {return(1);} /* I think more than 1 is possible, but don't have a case to test with */
+
+char *mus_audio_system_name(int system) {return("SGI");}
+
+char *mus_audio_moniker(void)
+{
+#ifdef AL_RESOURCE
+ return("New SGI audio");
+#else
+ return("Old SGI audio");
+#endif
+}
+
+#ifndef AL_RESOURCE
+static char *alGetErrorString(int err)
+{
+ switch (err)
+ {
+ case AL_BAD_NOT_IMPLEMENTED: return("not implemented yet"); break;
+ case AL_BAD_PORT: return("tried to use an invalid port"); break;
+ case AL_BAD_CONFIG: return("tried to use an invalid configuration"); break;
+ case AL_BAD_DEVICE: return("tried to use an invalid device"); break;
+ case AL_BAD_DEVICE_ACCESS: return("unable to access the device"); break;
+ case AL_BAD_DIRECTION: return("invalid direction given for port"); break;
+ case AL_BAD_OUT_OF_MEM: return("operation has run out of memory"); break;
+ case AL_BAD_NO_PORTS: return("not able to allocate a port"); break;
+ case AL_BAD_WIDTH: return("invalid sample width given"); break;
+ case AL_BAD_ILLEGAL_STATE: return("an invalid state has occurred"); break;
+ case AL_BAD_QSIZE: return("attempt to set an invalid queue size"); break;
+ case AL_BAD_FILLPOINT: return("attempt to set an invalid fillpoint"); break;
+ case AL_BAD_BUFFER_NULL: return("null buffer pointer"); break;
+ case AL_BAD_COUNT_NEG: return("negative count"); break;
+ case AL_BAD_PVBUFFER: return("param/val buffer doesn't make sense"); break;
+ case AL_BAD_BUFFERLENGTH_NEG: return("negative buffer length"); break;
+ case AL_BAD_BUFFERLENGTH_ODD: return("odd length parameter/value buffer"); break;
+ case AL_BAD_CHANNELS: return("invalid channel specifier"); break;
+ case AL_BAD_PARAM: return("invalid parameter"); break;
+ case AL_BAD_SAMPFMT: return("attempt to set invalid sample format"); break;
+ case AL_BAD_RATE: return("invalid sample rate token"); break;
+ case AL_BAD_TRANSFER_SIZE: return("invalid size for sample read/write"); break;
+ case AL_BAD_FLOATMAX: return("invalid size for floatmax"); break;
+ case AL_BAD_PORTSTYLE: return("invalid port style"); break;
+ default: return("");
+ }
+}
+#endif
+
+static char *sgi_err_buf = NULL;
+static mus_print_handler_t *old_handler = NULL;
+
+static void sgi_mus_print(char *msg)
+{
+ int oserr = oserror();
+ if (oserr)
+ {
+ if (sgi_err_buf == NULL) sgi_err_buf = (char *)CALLOC(PRINT_BUFFER_SIZE, sizeof(char));
+ mus_snprintf(sgi_err_buf, PRINT_BUFFER_SIZE, "%s [%s]", msg, alGetErrorString(oserr));
+ (*old_handler)(sgi_err_buf);
+ }
+ else (*old_handler)(msg);
+}
+
+static void start_sgi_print(void)
+{
+ if (old_handler != sgi_mus_print)
+ old_handler = mus_print_set_handler(sgi_mus_print);
+}
+
+static void end_sgi_print(void)
+{
+ if (old_handler != sgi_mus_print)
+ mus_print_set_handler(old_handler);
+ else mus_print_set_handler(NULL);
+}
+
+
+#if AL_RESOURCE
+ #define al_free(Line) alFreeConfig(config[Line])
+ #define al_newconfig() alNewConfig()
+ #define al_setsampfmt(Line, Format) alSetSampFmt(Line, Format)
+ #define al_setchannels(Line, Chans) alSetChannels(Line, Chans)
+ #define al_setwidth(Line, Width) alSetWidth(Line, Width)
+ #define al_setqueuesize(Line, Size) alSetQueueSize(Line, Size)
+ #define al_openport(Name, Flag, Line) alOpenPort(Name, Flag, Line)
+ #define al_getfilled(Port) alGetFilled(Port)
+ #define al_closeport(Port) alClosePort(Port)
+ #define al_freeconfig(Config) alFreeConfig(Config)
+#else
+ #define al_free(Line) ALfreeconfig(config[Line]);
+ #define al_newconfig() ALnewconfig()
+ #define al_setsampfmt(Line, Format) ALsetsampfmt(Line, Format)
+ #define al_setchannels(Line, Chans) ALsetchannels(Line, Chans)
+ #define al_setwidth(Line, Width) ALsetwidth(Line, Width)
+ #define al_setqueuesize(Line, Size) ALsetqueuesize(Line, Size)
+ #define al_openport(Name, Flag, Line) ALopenport(Name, Flag, Line)
+ #define al_getfilled(Port) ALgetfilled(Port)
+ #define al_closeport(Port) ALcloseport(Port)
+ #define al_freeconfig(Config) ALfreeconfig(Config)
+#endif
+
+
+#define RETURN_ERROR_EXIT(Error_Type, Audio_Line, Ur_Error_Message) \
+ do { \
+ char *Error_Message; Error_Message = Ur_Error_Message; \
+ if (Audio_Line != -1) al_free(Audio_Line); \
+ if (Error_Message) \
+ { \
+ MUS_STANDARD_ERROR(Error_Type, Error_Message); FREE(Error_Message); \
+ } \
+ else MUS_STANDARD_ERROR(Error_Type, mus_error_type_to_string(Error_Type)); \
+ end_sgi_print(); \
+ return(MUS_ERROR); \
+ } while (false)
+
+
+#ifdef AL_RESOURCE
+
+static int check_queue_size(int size, int chans)
+{
+ if (size > chans * 1024)
+ return(size);
+ else return(chans * 1024);
+}
+
+#else
+
+#define STEREO_QUEUE_MIN_SIZE 1024
+#define STEREO_QUEUE_MIN_CHOICE 1024
+/* docs say 510 or 512, but they die with "File size limit exceeded" %$@#!(& */
+#define MONO_QUEUE_MIN_SIZE 1019
+#define MONO_QUEUE_MIN_CHOICE 1024
+#define STEREO_QUEUE_MAX_SIZE 131069
+#define STEREO_QUEUE_MAX_CHOICE 65536
+#define MONO_QUEUE_MAX_SIZE 262139
+#define MONO_QUEUE_MAX_CHOICE 131072
+/* if these limits are not followed, the damned thing dumps core and dies */
+
+static int check_queue_size(int size, int chans)
+{
+ if ((chans == 1) && (size > MONO_QUEUE_MAX_SIZE)) return(MONO_QUEUE_MAX_CHOICE);
+ if ((chans == 1) && (size < MONO_QUEUE_MIN_SIZE)) return(MONO_QUEUE_MIN_CHOICE);
+ if ((chans > 1) && (size > STEREO_QUEUE_MAX_SIZE)) return(STEREO_QUEUE_MAX_CHOICE);
+ if ((chans > 1) && (size < STEREO_QUEUE_MIN_SIZE)) return(STEREO_QUEUE_MIN_CHOICE);
+ return(size);
+}
+
+static void check_quad(int device, int channels)
+{
+ long sr[2];
+ /* if quad, make sure we are set up for it, else make sure we aren't (perhaps the latter is unnecessary) */
+ /* in 4 channel mode, stereo mic and line-in are 4 inputs, headphones/speakers and stereo line-out are the 4 outputs */
+ sr[0] = AL_CHANNEL_MODE;
+ ALgetparams(device, sr, 2);
+ if ((channels == 4) && (sr[1] != AL_4CHANNEL))
+ {
+ sr[1] = AL_4CHANNEL;
+ ALsetparams(device, sr, 2);
+ }
+ else
+ {
+ if ((channels != 4) && (sr[1] != AL_STEREO))
+ {
+ sr[1] = AL_STEREO;
+ ALsetparams(device, sr, 2);
+ }
+ }
+}
+#endif
+
+#define IO_LINES 8
+static ALconfig *config = NULL;
+static ALport *port = NULL;
+static int *line_in_use = NULL;
+static int *channels = NULL;
+static long *device = NULL;
+static int *datum_size = NULL;
+static int *line_out = NULL;
+
+int mus_audio_initialize(void)
+{
+ if (!audio_initialized)
+ {
+ audio_initialized = true;
+ config = (ALconfig *)CALLOC(IO_LINES, sizeof(ALconfig));
+ port = (ALport *)CALLOC(IO_LINES, sizeof(ALport));
+ line_in_use = (int *)CALLOC(IO_LINES, sizeof(int));
+ channels = (int *)CALLOC(IO_LINES, sizeof(int));
+ device = (long *)CALLOC(IO_LINES, sizeof(long));
+ datum_size = (int *)CALLOC(IO_LINES, sizeof(int));
+ line_out = (int *)CALLOC(IO_LINES, sizeof(int));
+ }
+ return(MUS_NO_ERROR);
+}
+
+#ifdef AL_RESOURCE
+static int to_al_interface_or_device(int dev, int which)
+{
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DUPLEX_DEFAULT: return(AL_DEFAULT_OUTPUT); break;
+ case MUS_AUDIO_DAC_OUT:
+ case MUS_AUDIO_SPEAKERS: return(alGetResourceByName(AL_SYSTEM, "Analog Out", which)); break;
+ case MUS_AUDIO_MICROPHONE: return(alGetResourceByName(AL_SYSTEM, "Microphone", which)); break;
+ case MUS_AUDIO_ADAT_IN: return(alGetResourceByName(AL_SYSTEM, "ADAT In", which)); break;
+ case MUS_AUDIO_AES_IN: return(alGetResourceByName(AL_SYSTEM, "AES In", which)); break;
+ case MUS_AUDIO_ADAT_OUT: return(alGetResourceByName(AL_SYSTEM, "ADAT Out", which)); break;
+ case MUS_AUDIO_DIGITAL_OUT:
+ case MUS_AUDIO_AES_OUT: return(alGetResourceByName(AL_SYSTEM, "AES Out", which)); break;
+ case MUS_AUDIO_LINE_IN: return(alGetResourceByName(AL_SYSTEM, "Line In", which)); break;
+ case MUS_AUDIO_LINE_OUT: return(alGetResourceByName(AL_SYSTEM, "Line Out2", which)); break; /* ?? */
+ /* case MUS_AUDIO_DIGITAL_IN: return(alGetResourceByName(AL_SYSTEM, "DAC2 In", which)); break; */ /* this is analog in ?? */
+ }
+ return(MUS_ERROR);
+}
+
+static int to_al_device(int dev)
+{
+ return(to_al_interface_or_device(dev, AL_DEVICE_TYPE));
+}
+
+static int to_al_interface(int dev)
+{
+ return(to_al_interface_or_device(dev, AL_INTERFACE_TYPE));
+}
+#endif
+
+#include <stdio.h>
+
+/* just a placeholder for now */
+int find_audio_output(int chans)
+{
+#ifdef AL_RESOURCE
+ ALvalue x[32];
+ ALpv y;
+ int n, i;
+ y.param = AL_INTERFACE;
+ y.value.i = AL_DIGITAL_IF_TYPE;
+ n = alQueryValues(AL_SYSTEM, AL_DEFAULT_OUTPUT, x, 32, &y, 1);
+ for (i = 0; i < n; i++)
+ {
+ y.param = AL_CHANNELS;
+ alGetParams(x[i].i, &y, 1);
+ if (chans <= y.value.i) return(x[i].i);
+ }
+#endif
+ return(MUS_ERROR);
+}
+
+static int to_sgi_format(int frm)
+{
+ switch (frm)
+ {
+ case MUS_BYTE:
+ case MUS_BSHORT:
+ case MUS_B24INT: return(AL_SAMPFMT_TWOSCOMP); break;
+ case MUS_BFLOAT: return(AL_SAMPFMT_FLOAT); break;
+ case MUS_BDOUBLE: return(AL_SAMPFMT_DOUBLE); break;
+ }
+ return(MUS_ERROR);
+}
+
+int mus_audio_open_output(int ur_dev, int srate, int chans, int format, int requested_size)
+{
+#ifdef AL_RESOURCE
+ ALpv z[2];
+#endif
+ long sr[2];
+ int i, line, size, width, sgi_format, dev;
+ start_sgi_print();
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ line = -1;
+ for (i = 0; i < IO_LINES; i++)
+ if (line_in_use[i] == 0)
+ {
+ line = i;
+ break;
+ }
+ if (line == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_NO_LINES_AVAILABLE, line,
+ "no free audio lines?");
+ channels[line] = chans;
+ line_out[line] = 1;
+
+ if (requested_size == 0)
+ size = 1024 * chans;
+ else size = check_queue_size(requested_size, chans);
+ /* if (chans > 2) size = 65536; */ /* for temp adat code */
+
+ datum_size[line] = mus_bytes_per_sample(format);
+ if (datum_size[line] == 3)
+ width = AL_SAMPLE_24;
+ else
+ {
+ if (datum_size[line] == 1)
+ width = AL_SAMPLE_8;
+ else width = AL_SAMPLE_16;
+ }
+ sgi_format = to_sgi_format(format);
+ if (sgi_format == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, -1,
+ mus_format("format %d (%s) not supported by SGI",
+ format,
+ mus_audio_format_name(format)));
+#ifdef AL_RESOURCE
+ if (dev == MUS_AUDIO_DEFAULT)
+ device[line] = AL_DEFAULT_OUTPUT;
+ else device[line] = to_al_device(dev);
+ if (!(device[line]))
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, -1,
+ mus_format("device %d (%s) not available",
+ dev,
+ mus_audio_device_name(dev)));
+#if 0
+ if (device_channels(dev) < chans) /* look for some device that can play this file */
+ device[line] = find_audio_output(chans);
+ if (device[line] == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, -1,
+ mus_format("can't find %d channel device",
+ chans));
+#endif
+ if ((chans == 4) && (dev == MUS_AUDIO_DAC_OUT))
+ { /* kludge around a bug in the new audio library */
+ sr[0] = AL_CHANNEL_MODE;
+ sr[1] = AL_4CHANNEL;
+ ALsetparams(AL_DEFAULT_DEVICE, sr, 2);
+ }
+ z[0].param = AL_RATE;
+ z[0].value.ll = alDoubleToFixed((double)srate);
+ z[1].param = AL_MASTER_CLOCK;
+ /* z[1].value.i = AL_CRYSTAL_MCLK_TYPE; */
+ z[1].value.i = AL_MCLK_TYPE; /* was AL_CRYSTAL_MCLK_TYPE -- digital I/O perhaps needs AL_VARIABLE_MCLK_TYPE */
+ if (alSetParams(device[line], z, 2) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, -1,
+ mus_format("can't set srate of %s to %d",
+ mus_audio_device_name(dev),
+ srate));
+#else
+ device[line] = AL_DEFAULT_DEVICE;
+ check_quad(device[line], chans);
+ sr[0] = AL_OUTPUT_RATE;
+ sr[1] = srate;
+ if (ALsetparams(device[line], sr, 2) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, -1,
+ mus_format("can't set srate of %s to %d",
+ mus_audio_device_name(dev),
+ srate));
+#endif
+
+ config[line] = al_newconfig();
+ if (!(config[line]))
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, -1,
+ "can't allocate audio configuration?");
+ if ((al_setsampfmt(config[line], sgi_format) == -1) ||
+ (al_setwidth(config[line], width) == -1)) /* this is a no-op in the float and double cases */
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, line,
+ mus_format("audio format %d (%s, SGI: %d) not available on device %d (%s)",
+ format, mus_audio_format_name(format), sgi_format,
+ dev,
+ mus_audio_device_name(dev)));
+ if (al_setchannels(config[line], chans) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, line,
+ mus_format("can't get %d channels on device %d (%s)",
+ chans, dev, mus_audio_device_name(dev)));
+
+ /* set queue size probably needs a check first for legal queue sizes given the current desired device */
+ /* in new AL, I'm assuming above (check_queue_size) that it needs at least 1024 per chan */
+ if (al_setqueuesize(config[line], size) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SIZE_NOT_AVAILABLE, line,
+ mus_format("can't get queue size %d on device %d (%s) (chans: %d, requested_size: %d)",
+ size, dev,
+ mus_audio_device_name(dev),
+ chans, requested_size));
+
+#ifdef AL_RESOURCE
+ if (alSetDevice(config[line], device[line]) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, line,
+ mus_format("can't get device %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+#endif
+
+ port[line] = al_openport("dac", "w", config[line]);
+ if (!(port[line]))
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, line,
+ mus_format("can't open output port on device %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+ line_in_use[line] = 1;
+ end_sgi_print();
+ return(line);
+}
+
+int mus_audio_write(int line, char *buf, int bytes)
+{
+ start_sgi_print();
+#ifdef AL_RESOURCE
+ if (alWriteFrames(port[line], (short *)buf, bytes / (channels[line] * datum_size[line])))
+#else
+ if (ALwritesamps(port[line], (short *)buf, bytes / datum_size[line]))
+#endif
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ "write error");
+ end_sgi_print();
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_close(int line)
+{
+ int err;
+ start_sgi_print();
+ if (line_in_use[line])
+ {
+ if (line_out[line])
+ while (al_getfilled(port[line]) > 0)
+ sginap(1);
+ err = ((al_closeport(port[line])) ||
+ (al_freeconfig(config[line])));
+ line_in_use[line] = 0;
+ if (err)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_CLOSE, -1,
+ mus_format("can't close audio port %p (line %d)",
+ port[line], line));
+ }
+ end_sgi_print();
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_open_input(int ur_dev, int srate, int chans, int format, int requested_size)
+{
+ int dev;
+#ifdef AL_RESOURCE
+ ALpv pv;
+ ALpv x[2];
+#else
+ long sr[2];
+ int resind;
+#endif
+ int i, line, sgi_format;
+ start_sgi_print();
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ line = -1;
+ for (i = 0; i < IO_LINES; i++)
+ if (line_in_use[i] == 0)
+ {
+ line = i;
+ break;
+ }
+ if (line == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_NO_LINES_AVAILABLE, -1,
+ "no free audio lines?");
+ channels[line] = chans;
+ line_out[line] = 0;
+ datum_size[line] = mus_bytes_per_sample(format);
+#ifdef AL_RESOURCE
+ if (dev == MUS_AUDIO_DEFAULT)
+ device[line] = AL_DEFAULT_INPUT;
+ else
+ {
+ int itf;
+ device[line] = to_al_device(dev);
+ itf = to_al_interface(dev);
+ if (itf)
+ {
+ pv.param = AL_INTERFACE;
+ pv.value.i = itf;
+ if (alSetParams(device[line], &pv, 1) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, -1,
+ mus_format("can't set up device %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+ }
+ }
+ if (!(device[line]))
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, -1,
+ mus_format("can't get input device %d (%s)",
+ dev, mus_audio_device_name(dev)));
+ x[0].param = AL_RATE;
+ x[0].value.ll = alDoubleToFixed((double)srate);
+ x[1].param = AL_MASTER_CLOCK;
+ x[1].value.i = AL_MCLK_TYPE; /* AL_CRYSTAL_MCLK_TYPE; */
+ if (alSetParams(device[line], x, 2) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, -1,
+ mus_format("can't set srate of %s to %d",
+ mus_audio_device_name(dev),
+ srate));
+#else
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ case MUS_AUDIO_MICROPHONE: resind = AL_INPUT_MIC; break;
+ case MUS_AUDIO_LINE_IN: resind = AL_INPUT_LINE; break;
+ case MUS_AUDIO_DIGITAL_IN: resind = AL_INPUT_DIGITAL; break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, -1,
+ mus_format("audio input device %d (%s) not available",
+ dev,
+ mus_audio_device_name(dev)));
+ break;
+ }
+ device[line] = AL_DEFAULT_DEVICE;
+ sr[0] = AL_INPUT_SOURCE;
+ sr[1] = resind;
+ if (ALsetparams(device[line], sr, 2) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, -1,
+ mus_format("can't set up input device %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+ check_quad(device[line], chans);
+ sr[0] = AL_INPUT_RATE;
+ sr[1] = srate;
+ if (ALsetparams(device[line], sr, 2) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, -1,
+ mus_format("can't set srate of %s to %d",
+ mus_audio_device_name(dev),
+ srate));
+#endif
+
+ config[line] = al_newconfig();
+ if (!(config[line]))
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, -1,
+ "can't allocate audio configuration?");
+ sgi_format = to_sgi_format(format);
+ if (sgi_format == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, -1,
+ mus_format("format %d (%s) not supported by SGI",
+ format,
+ mus_audio_format_name(format)));
+ if ((al_setsampfmt(config[line], sgi_format) == -1) ||
+ (al_setwidth(config[line], (datum_size[line] == 2) ? AL_SAMPLE_16 : AL_SAMPLE_8) == -1))
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, line,
+ mus_format("audio format %d (%s, SGI: %d) not available on device %d (%s)",
+ format,
+ mus_audio_format_name(format), sgi_format,
+ dev,
+ mus_audio_device_name(dev)));
+ if (al_setchannels(config[line], chans) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, line,
+ mus_format("can't get %d channels on device %d (%s)",
+ chans, dev,
+ mus_audio_device_name(dev)));
+
+#ifdef AL_RESOURCE
+ if (alSetDevice(config[line], device[line]) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, line,
+ mus_format("can't get device %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+#endif
+
+ port[line] = al_openport("adc", "r", config[line]);
+ if (!(port[line]))
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, line,
+ mus_format("can't open input port on device %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+ line_in_use[line] = 1;
+ end_sgi_print();
+ return(line);
+}
+
+int mus_audio_read(int line, char *buf, int bytes)
+{
+ start_sgi_print();
+#ifdef AL_RESOURCE
+ if (alReadFrames(port[line], (short *)buf, bytes / (channels[line] * datum_size[line])))
+#else
+ if (ALreadsamps(port[line], (short *)buf, bytes / datum_size[line]))
+#endif
+ RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ "read error");
+ end_sgi_print();
+ return(MUS_NO_ERROR);
+}
+
+
+#ifdef AL_RESOURCE
+/* borrowed from /usr/share/src/dmedia/audio/printdevs.c with modifications */
+
+#define MAX_CHANNELS 8
+
+static float dB_to_linear(float val)
+{
+ if (val == 0.0) return(1.0);
+ return(pow(10.0, val / 20.0));
+}
+
+static float dB_to_normalized(float val, float lo, float hi)
+{
+ float linlo;
+ if (hi <= lo) return(1.0);
+ linlo = dB_to_linear(lo);
+ return((dB_to_linear(val) - linlo) / (dB_to_linear(hi) - linlo));
+}
+
+static float normalized_to_dB(float val_norm, float lo_dB, float hi_dB)
+{
+ if (hi_dB <= lo_dB) return(0.0);
+ return(lo_dB + (hi_dB - lo_dB) * val_norm);
+}
+
+int mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ ALpv x[4];
+ ALparamInfo pinf;
+ ALfixed g[MAX_CHANNELS];
+ int rv = 0, i, dev;
+ start_sgi_print();
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ if (field != MUS_AUDIO_PORT)
+ {
+ rv = to_al_device(dev);
+ if (!rv)
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, -1,
+ mus_format("can't read %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ }
+ switch (field)
+ {
+ case MUS_AUDIO_PORT:
+ /* in this case, chan == length of incoming val array. Number of devices is returned as val[0],
+ * and the rest of the available area (if needed) is filled with the device ids.
+ */
+ i = 0;
+ if (alGetResourceByName(AL_SYSTEM, "Microphone", AL_DEVICE_TYPE) != 0) {if ((i + 1) < chan) val[i + 1] = MUS_AUDIO_MICROPHONE; i++;}
+ if (alGetResourceByName(AL_SYSTEM, "Analog Out", AL_DEVICE_TYPE) != 0) {if ((i + 1) < chan) val[i + 1] = MUS_AUDIO_DAC_OUT; i++;}
+ if (alGetResourceByName(AL_SYSTEM, "ADAT In", AL_DEVICE_TYPE) != 0) {if ((i + 1) < chan) val[i + 1] = MUS_AUDIO_ADAT_IN; i++;}
+ if (alGetResourceByName(AL_SYSTEM, "AES In", AL_DEVICE_TYPE) != 0) {if ((i + 1) < chan) val[i + 1] = MUS_AUDIO_AES_IN; i++;}
+ if (alGetResourceByName(AL_SYSTEM, "ADAT Out", AL_DEVICE_TYPE) != 0) {if ((i + 1) < chan) val[i + 1] = MUS_AUDIO_ADAT_OUT; i++;}
+ if (alGetResourceByName(AL_SYSTEM, "AES Out", AL_DEVICE_TYPE) != 0) {if ((i + 1) < chan) val[i + 1] = MUS_AUDIO_AES_OUT; i++;}
+ if (alGetResourceByName(AL_SYSTEM, "Line In", AL_DEVICE_TYPE) != 0) {if ((i + 1) < chan) val[i + 1] = MUS_AUDIO_LINE_IN; i++;}
+ /* if (alGetResourceByName(AL_SYSTEM, "DAC2 In", AL_DEVICE_TYPE) != 0) {if ((i + 1) < chan) val[i + 1] = MUS_AUDIO_DIGITAL_IN; i++;} */
+ val[0] = i;
+ break;
+ case MUS_AUDIO_FORMAT:
+ val[0] = 1;
+ if (chan > 1) val[1] = MUS_BSHORT;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ x[0].param = AL_CHANNELS;
+ if (alGetParams(rv, x, 1) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ mus_format("can't read channel setting of %s",
+ mus_audio_device_name(dev)));
+ val[0] = (float)(x[0].value.i);
+ break;
+ case MUS_AUDIO_SRATE:
+ x[0].param = AL_RATE;
+ if (alGetParams(rv, x, 1) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ mus_format("can't read srate setting of %s",
+ mus_audio_device_name(dev)));
+ val[0] = (float)(x[0].value.i);
+ break;
+ case MUS_AUDIO_AMP:
+ if (alGetParamInfo(rv, AL_GAIN, &pinf) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ mus_format("can't read gain settings of %s",
+ mus_audio_device_name(dev)));
+ if (pinf.min.ll == pinf.max.ll)
+ RETURN_ERROR_EXIT(MUS_AUDIO_AMP_NOT_AVAILABLE, -1,
+ mus_format("%s's gain apparently can't be set",
+ mus_audio_device_name(dev)));
+ /* this ridiculous thing is in dB with completely arbitrary min and max values */
+ x[0].param = AL_GAIN;
+ x[0].value.ptr = g;
+ x[0].sizeIn = MAX_CHANNELS;
+ alGetParams(rv, x, 1);
+ if (x[0].sizeOut <= chan)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, -1,
+ mus_format("can't read gain settings of %s channel %d",
+ mus_audio_device_name(dev), chan));
+ val[0] = dB_to_normalized(alFixedToDouble(g[chan]),
+ alFixedToDouble(pinf.min.ll),
+ alFixedToDouble(pinf.max.ll));
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, -1,
+ mus_format("can't read %s setting of %s",
+ mus_audio_device_name(field),
+ mus_audio_device_name(dev)));
+ break;
+ }
+ end_sgi_print();
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ /* each field coming in assumes 0.0 to 1.0 as the range */
+ ALpv x[4];
+ ALparamInfo pinf;
+ ALfixed g[MAX_CHANNELS];
+ int rv, dev;
+ start_sgi_print();
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ rv = to_al_device(dev);
+ if (!rv) RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, -1,
+ mus_format("can't write %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ switch (field)
+ {
+ case MUS_AUDIO_SRATE:
+ x[0].param = AL_RATE;
+ x[0].value.i = (int)val[0];
+ x[1].param = AL_MASTER_CLOCK;
+ x[1].value.i = AL_CRYSTAL_MCLK_TYPE;
+ alSetParams(rv, x, 2);
+ break;
+ case MUS_AUDIO_AMP:
+ /* need to change normalized linear value into dB between (dB) lo and hi */
+ if (alGetParamInfo(rv, AL_GAIN, &pinf) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ mus_format("can't write gain settings of %s",
+ mus_audio_device_name(dev)));
+ /* I think we need to read all channels here, change the one we care about, then write all channels */
+ x[0].param = AL_GAIN;
+ x[0].value.ptr = g;
+ x[0].sizeIn = MAX_CHANNELS;
+ alGetParams(rv, x, 1);
+ if (x[0].sizeOut <= chan)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, -1,
+ mus_format("can't write gain settings of %s channel %d",
+ mus_audio_device_name(dev),
+ chan));
+ g[chan] = alDoubleToFixed(normalized_to_dB(val[0],
+ alFixedToDouble(pinf.min.ll),
+ alFixedToDouble(pinf.max.ll)));
+ if (alSetParams(rv, x, 1) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("can't write gain settings of %s",
+ mus_audio_device_name(dev)));
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, -1,
+ mus_format("can't write %s setting of %s",
+ mus_audio_device_name(field),
+ mus_audio_device_name(dev)));
+ break;
+ }
+ end_sgi_print();
+ return(MUS_NO_ERROR);
+}
+
+#define STRING_SIZE 32
+static void dump_resources(ALvalue *x, int rv)
+{
+ ALpv y[4];
+ ALparamInfo pinf;
+ ALfixed g[MAX_CHANNELS];
+ char dn[STRING_SIZE];
+ char dl[STRING_SIZE];
+ int i, k;
+ ALvalue z[16];
+ int nres;
+ for (i = 0; i < rv; i++)
+ {
+ y[0].param = AL_LABEL;
+ y[0].value.ptr = dl;
+ y[0].sizeIn = STRING_SIZE;
+ y[1].param = AL_NAME;
+ y[1].value.ptr = dn;
+ y[1].sizeIn = STRING_SIZE;
+ y[2].param = AL_CHANNELS;
+ y[3].param = AL_RATE;
+ alGetParams(x[i].i, y, 5);
+ if (alIsSubtype(AL_DEVICE_TYPE, x[i].i))
+ {
+ alGetParamInfo(x[i].i, AL_GAIN, &pinf);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "\nDevice: %s (%s), srate: %d, chans: %d",
+ dn, dl,
+ y[3].value.i,
+ y[2].value.i);
+ pprint(audio_strbuf);
+ if (pinf.min.ll != pinf.max.ll)
+ {
+ ALpv yy;
+ yy.param = AL_GAIN;
+ yy.value.ptr = g;
+ yy.sizeIn = MAX_CHANNELS;
+ alGetParams(x[i].i, &yy, 1);
+ pprint(" amps:[");
+ for (k = 0; k < yy.sizeOut; k++)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%.2f",
+ dB_to_normalized(alFixedToDouble(g[k]),
+ alFixedToDouble(pinf.min.ll),
+ alFixedToDouble(pinf.max.ll)));
+ pprint(audio_strbuf);
+ if (k < (yy.sizeOut - 1)) pprint(" ");
+ }
+ pprint("]");
+ }
+ pprint("\n");
+ if ((nres= alQueryValues(x[i].i, AL_INTERFACE, z, 16, 0, 0)) >= 0)
+ dump_resources(z, nres);
+ else mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "query failed: %s\n", alGetErrorString(oserror()));
+ pprint(audio_strbuf);
+ }
+ else
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s (%s), chans: %d\n", dn, dl, y[2].value.i);
+ pprint(audio_strbuf);
+ }
+ }
+}
+
+static void describe_audio_state_1(void)
+{
+ int rv;
+ ALvalue x[16];
+ pprint("Devices and Interfaces on this system:\n");
+ rv= alQueryValues(AL_SYSTEM, AL_DEVICES, x, 16, 0, 0);
+ if (rv > 0)
+ dump_resources(x, rv);
+}
+
+
+#else
+
+/* old audio library */
+
+#define MAX_VOLUME 255
+
+static int decode_field(int dev, int field, int chan)
+{
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DAC_OUT:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ case MUS_AUDIO_SPEAKERS:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ return((chan == 0) ? AL_LEFT_SPEAKER_GAIN : AL_RIGHT_SPEAKER_GAIN);
+ break;
+ case MUS_AUDIO_SRATE:
+ return(AL_OUTPUT_RATE);
+ break;
+ }
+ break;
+ case MUS_AUDIO_LINE_OUT:
+ switch (field)
+ {
+ case MUS_AUDIO_SRATE:
+ return(AL_OUTPUT_RATE); /* ? */
+ break;
+ }
+ break;
+ case MUS_AUDIO_DIGITAL_OUT:
+ if (field == MUS_AUDIO_SRATE)
+ return(AL_OUTPUT_RATE);
+ break;
+ case MUS_AUDIO_DIGITAL_IN:
+ if (field == MUS_AUDIO_SRATE)
+ return(AL_INPUT_RATE);
+ break;
+ case MUS_AUDIO_LINE_IN:
+ if (field == MUS_AUDIO_AMP)
+ return((chan == 0) ? AL_LEFT_INPUT_ATTEN : AL_RIGHT_INPUT_ATTEN);
+ else
+ if (field == MUS_AUDIO_SRATE)
+ return(AL_INPUT_RATE);
+ break;
+ case MUS_AUDIO_MICROPHONE:
+ if (field == MUS_AUDIO_AMP)
+ return((chan == 0) ? AL_LEFT2_INPUT_ATTEN : AL_RIGHT2_INPUT_ATTEN);
+ else
+ if (field == MUS_AUDIO_SRATE)
+ return(AL_INPUT_RATE);
+ break;
+ }
+ return(MUS_ERROR);
+}
+
+int mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ long pb[4];
+ long fld;
+ int dev, err = MUS_NO_ERROR;
+ start_sgi_print();
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ switch (field)
+ {
+ case MUS_AUDIO_CHANNEL:
+ val[0] = 4;
+ break;
+ case MUS_AUDIO_FORMAT:
+ val[0] = 1;
+ if (chan > 1) val[1] = MUS_BSHORT;
+ break;
+ case MUS_AUDIO_PORT:
+ /* how to tell which machine we're on? */
+ val[0] = 4;
+ if (chan > 1) val[1] = MUS_AUDIO_LINE_IN;
+ if (chan > 2) val[2] = MUS_AUDIO_MICROPHONE;
+ if (chan > 3) val[3] = MUS_AUDIO_DIGITAL_IN;
+ if (chan > 4) val[4] = MUS_AUDIO_DAC_OUT;
+ /* does this order work for digital input as well? (i.e. does it replace the microphone)? */
+ break;
+ case MUS_AUDIO_AMP:
+ fld = decode_field(dev, field, chan);
+ if (fld != MUS_ERROR)
+ {
+ pb[0] = fld;
+ if (ALgetparams(AL_DEFAULT_DEVICE, pb, 2))
+ RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ mus_format("can't read gain settings of %s",
+ mus_audio_device_name(dev)));
+ if ((fld == AL_LEFT_SPEAKER_GAIN) ||
+ (fld == AL_RIGHT_SPEAKER_GAIN))
+ val[0] = ((float)pb[1]) / ((float)MAX_VOLUME);
+ else val[0] = 1.0 - ((float)pb[1]) / ((float)MAX_VOLUME);
+ }
+ else err = MUS_ERROR;
+ break;
+ case MUS_AUDIO_SRATE:
+ fld = decode_field(dev, field, chan);
+ if (fld != MUS_ERROR)
+ {
+ pb[0] = fld;
+ if (ALgetparams(AL_DEFAULT_DEVICE, pb, 2))
+ RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ mus_format("can't read srate setting of %s",
+ mus_audio_device_name(dev)));
+ val[0] = pb[1];
+ }
+ else err = MUS_ERROR;
+ break;
+ default:
+ err = MUS_ERROR;
+ break;
+ }
+ if (err == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, -1,
+ mus_format("can't read %s setting of %s",
+ mus_audio_device_name(field),
+ mus_audio_device_name(dev)));
+ end_sgi_print();
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ long pb[4];
+ long fld;
+ int dev, err = MUS_NO_ERROR;
+ start_sgi_print();
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ switch (field)
+ {
+ case MUS_AUDIO_PORT:
+ if (dev == MUS_AUDIO_DEFAULT)
+ {
+ pb[0] = AL_CHANNEL_MODE;
+ pb[1] = ((chan == MUS_AUDIO_DIGITAL_IN) ? AL_STEREO : AL_4CHANNEL);
+ pb[2] = AL_INPUT_SOURCE;
+ pb[3] = ((chan == MUS_AUDIO_DIGITAL_IN) ? AL_INPUT_DIGITAL : AL_INPUT_MIC);
+ if (ALsetparams(AL_DEFAULT_DEVICE, pb, 4))
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("can't set mode and source of %s",
+ mus_audio_device_name(dev)));
+ }
+ else err = MUS_ERROR;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ if (dev == MUS_AUDIO_MICROPHONE)
+ {
+ pb[0] = AL_MIC_MODE;
+ pb[1] = ((chan == 2) ? AL_STEREO : AL_MONO);
+ if (ALsetparams(AL_DEFAULT_DEVICE, pb, 2))
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("can't set microphone to be %s",
+ (chan == 2) ? "stereo" : "mono"));
+ }
+ else
+ {
+ if (dev == MUS_AUDIO_DEFAULT)
+ {
+ pb[0] = AL_CHANNEL_MODE;
+ pb[1] = ((chan == 4) ? AL_4CHANNEL : AL_STEREO);
+ if (ALsetparams(AL_DEFAULT_DEVICE, pb, 2))
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("can't set default device to be %s",
+ (chan == 4) ? "quad" : "stereo"));
+ }
+ else err = MUS_ERROR;
+ }
+ break;
+ case MUS_AUDIO_AMP:
+ fld = decode_field(dev, field, chan);
+ if (fld != -1)
+ {
+ pb[0] = fld;
+ if ((fld == AL_LEFT_SPEAKER_GAIN) ||
+ (fld == AL_RIGHT_SPEAKER_GAIN))
+ pb[1] = val[0] * MAX_VOLUME;
+ else pb[1] = (1.0 - val[0]) * MAX_VOLUME;
+ if (ALsetparams(AL_DEFAULT_DEVICE, pb, 2))
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("can't set gain of %s",
+ mus_audio_device_name(dev)));
+ }
+ else err = MUS_ERROR;
+ break;
+ case MUS_AUDIO_SRATE:
+ fld = decode_field(dev, field, chan);
+ if (fld != -1)
+ {
+ pb[0] = fld;
+ pb[1] = val[0];
+ if (ALsetparams(AL_DEFAULT_DEVICE, pb, 2))
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1, NULL);
+ if (fld == AL_INPUT_RATE)
+ {
+ pb[0] = AL_OUTPUT_RATE;
+ pb[1] = val[0];
+ if (ALsetparams(AL_DEFAULT_DEVICE, pb, 2))
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("can't set srate of %s",
+ mus_audio_device_name(dev)));
+ }
+ }
+ else err = MUS_ERROR;
+ break;
+ default:
+ err = MUS_ERROR;
+ break;
+ }
+ if (err == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, -1,
+ mus_format("can't write %s setting of %s",
+ mus_audio_device_name(field),
+ mus_audio_device_name(dev)));
+ end_sgi_print();
+ return(MUS_NO_ERROR);
+}
+
+static void describe_audio_state_1(void)
+{
+ float amps[1];
+ int err;
+ err = mus_audio_mixer_read(MUS_AUDIO_SPEAKERS, MUS_AUDIO_SRATE, 0, amps);
+ if (err == MUS_NO_ERROR)
+ {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "srate: %.2f\n", amps[0]); pprint(audio_strbuf);}
+ else {fprintf(stdout, "err: %d!\n", err); fflush(stdout);}
+ err = mus_audio_mixer_read(MUS_AUDIO_SPEAKERS, MUS_AUDIO_AMP, 0, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "speakers: %.2f", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_SPEAKERS, MUS_AUDIO_AMP, 1, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.2f\n", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_LINE_IN, MUS_AUDIO_AMP, 0, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "line in: %.2f", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_LINE_IN, MUS_AUDIO_AMP, 1, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.2f\n", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_MICROPHONE, MUS_AUDIO_AMP, 0, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "microphone: %.2f", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_MICROPHONE, MUS_AUDIO_AMP, 1, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.2f\n", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_LINE_OUT, MUS_AUDIO_AMP, 0, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "line out: %.2f", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_LINE_OUT, MUS_AUDIO_AMP, 1, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.2f\n", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_DIGITAL_OUT, MUS_AUDIO_AMP, 0, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "digital out: %.2f", amps[0]); pprint(audio_strbuf);}
+ err = mus_audio_mixer_read(MUS_AUDIO_DIGITAL_OUT, MUS_AUDIO_AMP, 1, amps);
+ if (err == MUS_NO_ERROR) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.2f\n", amps[0]); pprint(audio_strbuf);}
+}
+
+#endif
+/* new or old AL */
+
+#endif
+/* SGI */
+
+
+
+/* ------------------------------- OSS ----------------------------------------- */
+
+#if (HAVE_OSS || HAVE_ALSA || HAVE_JACK)
+/* actually it's not impossible that someday we'll have ALSA but not OSS... */
+#define AUDIO_OK
+
+#include <sys/ioctl.h>
+
+/* the system version of the soundcard header file may have no relation to the current OSS actually loaded */
+/* sys/soundcard.h is usually just a pointer to linux/soundcard.h */
+
+#if (MUS_HAVE_USR_LIB_OSS)
+ #include "/usr/lib/oss/include/sys/soundcard.h"
+#else
+ #if (MUS_HAVE_USR_LOCAL_LIB_OSS)
+ #include "/usr/local/lib/oss/include/sys/soundcard.h"
+ #else
+ #if (MUS_HAVE_OPT_OSS)
+ #include "/opt/oss/include/sys/soundcard.h"
+ #else
+ #if (MUS_HAVE_VAR_LIB_OSS)
+ #include "/var/lib/oss/include/sys/soundcard.h"
+ #else
+ #if defined(HAVE_SYS_SOUNDCARD_H) || defined(MUS_LINUX)
+ #include <sys/soundcard.h>
+ #else
+ #if defined(HAVE_MACHINE_SOUNDCARD_H)
+ #include <machine/soundcard.h>
+ #else
+ #include <soundcard.h>
+ #endif
+ #endif
+ #endif
+ #endif
+ #endif
+#endif
+
+#if ((SOUND_VERSION > 360) && (defined(OSS_SYSINFO)))
+ #define NEW_OSS 1
+#endif
+
+#define DAC_NAME "/dev/dsp"
+#define MIXER_NAME "/dev/mixer"
+#define SYNTH_NAME "/dev/music"
+/* some programs use /dev/audio */
+
+/* there can be more than one sound card installed, and a card can be handled through
+ * more than one /dev/dsp device, so we can't use a global dac device here.
+ * The caller has to keep track of the various cards (via AUDIO_SYSTEM) --
+ * I toyed with embedding all that in mus_audio_open_output and mus_audio_write, but
+ * decided it's better to keep them explicit -- the caller may want entirely
+ * different (non-synchronous) streams going to the various cards. This same
+ * code (AUDIO_SYSTEM(n)->devn) should work in Windoze (see below), and
+ * might work on the Mac and SGI -- something for a rainy day...
+ */
+
+#define RETURN_ERROR_EXIT(Message_Type, Audio_Line, Ur_Message) \
+ do { \
+ char *Message; Message = Ur_Message; \
+ if (Audio_Line != -1) \
+ linux_audio_close(Audio_Line); \
+ if ((Message) && (strlen(Message) > 0)) \
+ { \
+ mus_print("%s\n [%s[%d] %s]", \
+ Message, \
+ __FILE__, __LINE__, c__FUNCTION__); \
+ FREE(Message); \
+ } \
+ else mus_print("%s\n [%s[%d] %s]", \
+ mus_error_type_to_string(Message_Type), \
+ __FILE__, __LINE__, c__FUNCTION__); \
+ return(MUS_ERROR); \
+ } while (false)
+
+static int FRAGMENTS = 4;
+static int FRAGMENT_SIZE = 12;
+static bool fragments_locked = false;
+
+/* defaults here are FRAGMENTS 16 and FRAGMENT_SIZE 12; these values however
+ * cause about a .5 second delay, which is not acceptable in "real-time" situations.
+ *
+ * this changed 22-May-01: these are causing more trouble than they're worth
+ */
+
+static void oss_mus_oss_set_buffers(int num, int size) {FRAGMENTS = num; FRAGMENT_SIZE = size; fragments_locked = true;}
+
+#define MAX_SOUNDCARDS 8
+#define MAX_DSPS 8
+#define MAX_MIXERS 8
+/* there can be (apparently) any number of mixers and dsps per soundcard, but 8 is enough! */
+
+static int *audio_fd = NULL;
+static int *audio_open_ctr = NULL;
+static int *audio_dsp = NULL;
+static int *audio_mixer = NULL;
+static int *audio_mode = NULL;
+typedef enum {NORMAL_CARD, SONORUS_STUDIO, RME_HAMMERFALL, SAM9407_DSP, DELTA_66} audio_card_t;
+/* the Sonorus Studi/o card is a special case in all regards */
+static audio_card_t *audio_type = NULL;
+
+static int sound_cards = 0;
+static int new_oss_running = 0;
+static char *dev_name = NULL;
+
+static int oss_mus_audio_systems(void)
+{
+ return(sound_cards);
+}
+
+static char *mixer_name(int sys)
+{
+#if HAVE_SAM_9407
+ if((sys < sound_cards) && (audio_type[sys] == SAM9407_DSP))
+ {
+ mus_snprintf(dev_name, LABEL_BUFFER_SIZE, "/dev/sam%d_mixer", audio_mixer[sys]);
+ return(dev_name);
+ }
+#endif
+ if (sys < sound_cards)
+ {
+ if (audio_mixer[sys] == -2)
+ return(MIXER_NAME);
+ /* if we have /dev/dsp (not /dev/dsp0), I assume the corresponding mixer is /dev/mixer (not /dev/mixer0) */
+ /* but in sam9407 driver, there is no /dev/mixer, and everything goes through /dev/dsp */
+ else
+ {
+ if (audio_mixer[sys] == -3)
+ return(DAC_NAME);
+ else
+ {
+ mus_snprintf(dev_name, LABEL_BUFFER_SIZE, "%s%d", MIXER_NAME, audio_mixer[sys]);
+ return(dev_name);
+ }
+ }
+ }
+ return(DAC_NAME);
+}
+
+static char *oss_mus_audio_system_name(int system)
+{
+#if HAVE_SAM_9407
+ if((system < sound_cards) && (audio_type[system] == SAM9407_DSP))
+ {
+ int fd;
+ fd = open(mixer_name(system), O_RDONLY, 0);
+ if(fd != -1)
+ {
+ static SamDriverInfo driverInfo;
+ if(ioctl(fd, SAM_IOC_DRIVER_INFO, &driverInfo) >= 0)
+ {
+ close(fd);
+ return(driverInfo.hardware);
+ }
+ close(fd);
+ }
+ return("sam9407");
+ }
+#endif
+#ifdef NEW_OSS
+ static mixer_info mixinfo;
+ int status, ignored, fd;
+ fd = open(mixer_name(system), O_RDONLY, 0);
+ if (fd != -1)
+ {
+ status = ioctl(fd, OSS_GETVERSION, &ignored);
+ if (status == 0)
+ {
+ status = ioctl(fd, SOUND_MIXER_INFO, &mixinfo);
+ if (status == 0)
+ {
+ close(fd);
+ return(mixinfo.name);
+ }
+ }
+ close(fd);
+ }
+#endif
+ return("OSS");
+}
+
+#if HAVE_SAM_9407
+static char *oss_mus_audio_moniker(void) {return("Sam 9407");}
+#else
+static char *oss_mus_audio_moniker(void)
+{
+ char version[LABEL_BUFFER_SIZE];
+ if (version_name == NULL) version_name = (char *)CALLOC(LABEL_BUFFER_SIZE, sizeof(char));
+ if (SOUND_VERSION < 361)
+ {
+ mus_snprintf(version, LABEL_BUFFER_SIZE, "%d", SOUND_VERSION);
+ mus_snprintf(version_name, LABEL_BUFFER_SIZE, "OSS %c.%c.%c", version[0], version[1], version[2]);
+ }
+ else
+ mus_snprintf(version_name, LABEL_BUFFER_SIZE, "OSS %x.%x.%x",
+ (SOUND_VERSION >> 16) & 0xff,
+ (SOUND_VERSION >> 8) & 0xff,
+ SOUND_VERSION & 0xff);
+ return(version_name);
+}
+#endif
+
+static char *dac_name(int sys, int offset)
+{
+#if HAVE_SAM_9407
+ if ((sys < sound_cards) && (audio_type[sys] == SAM9407_DSP))
+ {
+ mus_snprintf(dev_name, LABEL_BUFFER_SIZE, "/dev/sam%d_dsp", audio_dsp[sys]);
+ return(dev_name);
+ }
+#endif
+ if ((sys < sound_cards) && (audio_mixer[sys] >= -1))
+ {
+ mus_snprintf(dev_name, LABEL_BUFFER_SIZE, "%s%d", DAC_NAME, audio_dsp[sys] + offset);
+ return(dev_name);
+ }
+ return(DAC_NAME);
+}
+
+#define MIXER_SIZE SOUND_MIXER_NRDEVICES
+static int **mixer_state = NULL;
+static int *init_srate = NULL, *init_chans = NULL, *init_format = NULL;
+
+static int oss_mus_audio_initialize(void)
+{
+ /* here we need to set up the map of /dev/dsp and /dev/mixer to a given system */
+ /* since this info is not passed to us by OSS, we have to work at it... */
+ /* for the time being, I'll ignore auxiliary dsp and mixer ports (each is a special case) */
+ int i, fd = -1, md, err = 0;
+ char dname[LABEL_BUFFER_SIZE];
+ int amp, old_mixer_amp, old_dsp_amp, new_mixer_amp, responsive_field;
+ int devmask;
+#ifdef NEW_OSS
+ int status, ignored;
+ oss_sysinfo sysinfo;
+ static mixer_info mixinfo;
+ int sysinfo_ok = 0;
+#endif
+ int num_mixers, num_dsps, nmix, ndsp;
+ if (!audio_initialized)
+ {
+ audio_initialized = true;
+ audio_fd = (int *)CALLOC(MAX_SOUNDCARDS, sizeof(int));
+ audio_open_ctr = (int *)CALLOC(MAX_SOUNDCARDS, sizeof(int));
+ audio_dsp = (int *)CALLOC(MAX_SOUNDCARDS, sizeof(int));
+ audio_mixer = (int *)CALLOC(MAX_SOUNDCARDS, sizeof(int));
+ audio_type = (audio_card_t *)CALLOC(MAX_SOUNDCARDS, sizeof(audio_card_t));
+ audio_mode = (int *)CALLOC(MAX_SOUNDCARDS, sizeof(int));
+ dev_name = (char *)CALLOC(LABEL_BUFFER_SIZE, sizeof(char));
+ init_srate = (int *)CALLOC(MAX_SOUNDCARDS, sizeof(int));
+ init_chans = (int *)CALLOC(MAX_SOUNDCARDS, sizeof(int));
+ init_format = (int *)CALLOC(MAX_SOUNDCARDS, sizeof(int));
+ mixer_state = (int **)CALLOC(MAX_SOUNDCARDS, sizeof(int *));
+ for (i = 0; i < MAX_SOUNDCARDS; i++) mixer_state[i] = (int *)CALLOC(MIXER_SIZE, sizeof(int));
+ for (i = 0; i < MAX_SOUNDCARDS; i++)
+ {
+ audio_fd[i] = -1;
+ audio_open_ctr[i] = 0;
+ audio_dsp[i] = -1;
+ audio_mixer[i] = -1;
+ audio_type[i] = NORMAL_CARD;
+ }
+#if HAVE_SAM_9407
+ {
+ SamApiInfo apiInfo;
+ SamDriverInfo driverInfo;
+ for (i = 0; i < MAX_SOUNDCARDS; i++)
+ {
+ mus_snprintf(dname, LABEL_BUFFER_SIZE, "/dev/sam%d_mixer", i);
+ fd = open(dname, O_WRONLY);
+ if (fd < 0)
+ break;
+ if ((ioctl(fd, SAM_IOC_API_INFO, &apiInfo) < 0) ||
+ (apiInfo.apiClass!=SAM_API_CLASS_VANILLA) ||
+ (ioctl(fd, SAM_IOC_DRIVER_INFO, &driverInfo) < 0) ||
+ (!driverInfo.haveAudio))
+ {
+ close(fd);
+ continue;
+ }
+ audio_type[sound_cards] = SAM9407_DSP;
+ audio_dsp[sound_cards] = i;
+ audio_mixer[sound_cards] = i;
+ sound_cards++;
+ close(fd);
+ }
+ if(sound_cards > 0)
+ return(0);
+ }
+#endif
+
+ num_mixers = MAX_MIXERS;
+ num_dsps = MAX_DSPS;
+#ifdef NEW_OSS
+ fd = open(DAC_NAME, O_WRONLY | O_NONBLOCK, 0);
+ if (fd == -1) fd = open(SYNTH_NAME, O_RDONLY | O_NONBLOCK, 0);
+ if (fd == -1) fd = open(MIXER_NAME, O_RDONLY | O_NONBLOCK, 0);
+ if (fd != -1)
+ {
+ status = ioctl(fd, OSS_GETVERSION, &ignored);
+ new_oss_running = (status == 0);
+ if (new_oss_running)
+ {
+ status = ioctl(fd, OSS_SYSINFO, &sysinfo);
+ sysinfo_ok = (status == 0);
+ }
+ if ((new_oss_running) && (sysinfo_ok))
+ {
+ num_mixers = sysinfo.nummixers;
+ num_dsps = sysinfo.numaudios;
+ }
+ close(fd);
+ }
+#endif
+
+ /* need to get which /dev/dsp lines match which /dev/mixer lines,
+ * find out how many separate systems (soundcards) are available,
+ * fill the audio_dsp and audio_mixer arrays with the system-related numbers,
+ * since we have no way to tell from OSS info which mixers/dsps are the
+ * main ones, we'll do some messing aound to try to deduce this info.
+ * for example, SB uses two dsp ports and two mixers per card, whereas
+ * Ensoniq uses 2 dsps and 1 mixer.
+ *
+ * the data we are gathering here:
+ * int audio_dsp[MAX_SOUNDCARDS] -> main_dsp_port[MUS_AUDIO_PACK_SYSTEM(n)] (-1 => no such system dsp)
+ * int audio_mixer[MAX_SOUNDCARDS] -> main_mixer_port[MUS_AUDIO_PACK_SYSTEM(n)]
+ * int sound_cards = 0 -> usable systems
+ * all auxiliary ports are currently ignored (SB equalizer, etc)
+ */
+ sound_cards = 0;
+ ndsp = 0;
+ nmix = 0;
+ while ((nmix < num_mixers) &&
+ (ndsp < num_dsps))
+ {
+ /* for each mixer, find associated main dsp (assumed to be first in /dev/dsp ordering) */
+ /* if mixer's dsp overlaps or we run out of dsps first, ignore it (aux mixer) */
+ /* our by-guess-or-by-gosh method here is to try to open the mixer.
+ * if that fails, quit (if very first, try at least to get the dsp setup)
+ * find volume field, if none, go on, else read current volume
+ * open next unchecked dsp, try to set volume, read current, if different we found a match -- set and go on.
+ * if no change, move to next dsp and try again, if no more dsps, quit (checking for null case as before)
+ */
+ mus_snprintf(dname, LABEL_BUFFER_SIZE, "%s%d", MIXER_NAME, nmix);
+ md = open(dname, O_RDWR, 0);
+ if (md == -1)
+ {
+ if (errno == EBUSY)
+ {
+ mus_print("%s is busy: can't access it [%s[%d] %s]",
+ dname,
+ __FILE__, __LINE__, c__FUNCTION__);
+ nmix++;
+ continue;
+ }
+ else break;
+ }
+ mus_snprintf(dname, LABEL_BUFFER_SIZE, "%s%d", DAC_NAME, ndsp);
+ fd = open(dname, O_RDWR | O_NONBLOCK, 0);
+ if (fd == -1) fd = open(dname, O_RDONLY | O_NONBLOCK, 0);
+ if (fd == -1) fd = open(dname, O_WRONLY | O_NONBLOCK, 0); /* some output devices need this */
+ if (fd == -1)
+ {
+ close(md);
+ if (errno == EBUSY) /* in linux /usr/include/asm/errno.h */
+ {
+ fprintf(stderr, "%s is busy: can't access it\n", dname);
+ ndsp++;
+ continue;
+ }
+ else
+ {
+ if ((errno != ENXIO) && (errno != ENODEV))
+ fprintf(stderr, "%s: %s! ", dname, strerror(errno));
+ break;
+ }
+ }
+#ifdef NEW_OSS
+ /* can't change volume yet of Sonorus, so the method above won't work --
+ * try to catch this case via the mixer's name
+ */
+ status = ioctl(md, SOUND_MIXER_INFO, &mixinfo);
+ if ((status == 0) &&
+ (mixinfo.name) &&
+ (*(mixinfo.name)) &&
+ (strlen(mixinfo.name) > 6))
+ {
+ if (strncmp("STUDI/O", mixinfo.name, 7) == 0)
+ {
+ /* a special case in every regard */
+ audio_type[sound_cards] = SONORUS_STUDIO;
+ audio_mixer[sound_cards] = nmix;
+ nmix++;
+ audio_dsp[sound_cards] = ndsp;
+ if (num_dsps >= 21)
+ {
+ ndsp += 21;
+ audio_mode[sound_cards] = 1;
+ }
+ else
+ {
+ ndsp += 9;
+ audio_mode[sound_cards] = 0;
+ }
+ sound_cards++;
+ close(fd);
+ close(md);
+ continue;
+ }
+ else
+ {
+ if (strncmp("RME Digi96", mixinfo.name, 10) == 0)
+ {
+ audio_type[sound_cards] = RME_HAMMERFALL;
+ audio_mixer[sound_cards] = nmix;
+ nmix++;
+ audio_dsp[sound_cards] = ndsp;
+ sound_cards++;
+ close(fd);
+ close(md);
+ continue;
+ }
+ else
+ {
+ if (strncmp("M Audio Delta", mixinfo.name, 13) == 0)
+ {
+ audio_type[sound_cards] = DELTA_66;
+ audio_mixer[sound_cards] = nmix;
+ nmix++;
+ ndsp += 6; /* just a guess */
+ audio_dsp[sound_cards] = ndsp;
+ sound_cards++;
+ close(fd);
+ close(md);
+ continue;
+ }
+ }
+ }
+ }
+#endif
+ err = ioctl(md, SOUND_MIXER_READ_DEVMASK, &devmask);
+ responsive_field = SOUND_MIXER_VOLUME;
+ for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
+ if ((1 << i) & devmask)
+ {
+ responsive_field = i;
+ break;
+ }
+ if (!err)
+ {
+ err = ioctl(md, MIXER_READ(responsive_field), &old_mixer_amp);
+ if (!err)
+ {
+ err = ioctl(fd, MIXER_READ(responsive_field), &old_dsp_amp);
+ if ((!err) && (old_dsp_amp == old_mixer_amp))
+ {
+ if (old_mixer_amp == 0) amp = 50; else amp = 0; /* 0..100 */
+ err = ioctl(fd, MIXER_WRITE(responsive_field), &amp);
+ if (!err)
+ {
+ err = ioctl(md, MIXER_READ(responsive_field), &new_mixer_amp);
+ if (!err)
+ {
+ if (new_mixer_amp == amp)
+ {
+ /* found one! */
+ audio_dsp[sound_cards] = ndsp; ndsp++;
+ audio_mixer[sound_cards] = nmix; nmix++;
+ audio_type[sound_cards] = NORMAL_CARD;
+ sound_cards++;
+ }
+ else ndsp++;
+ err = ioctl(fd, MIXER_WRITE(responsive_field), &old_dsp_amp);
+ }
+ else nmix++;
+ }
+ else ndsp++;
+ }
+ else ndsp++;
+ }
+ else nmix++;
+ }
+ else nmix++;
+ close(fd);
+ close(md);
+ }
+ if (sound_cards == 0)
+ {
+ fd = open(DAC_NAME, O_WRONLY | O_NONBLOCK, 0);
+ if (fd != -1)
+ {
+ sound_cards = 1;
+ audio_dsp[0] = 0;
+ audio_type[0] = NORMAL_CARD;
+ audio_mixer[0] = -2; /* hmmm -- need a way to see /dev/dsp as lonely outpost */
+ close(fd);
+ fd = open(MIXER_NAME, O_RDONLY | O_NONBLOCK, 0);
+ if (fd == -1)
+ audio_mixer[0] = -3;
+ else close(fd);
+ }
+ }
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_reinitialize(void)
+{
+ /* an experiment */
+ audio_initialized = false;
+ return(mus_audio_initialize());
+}
+
+static int linux_audio_open(const char *pathname, int flags, mode_t mode, int system)
+{
+ /* sometimes this is simply searching for a device (so failure is not a mus_error) */
+ if (audio_fd[system] == -1)
+ {
+ audio_fd[system] = open(pathname, flags, mode);
+ audio_open_ctr[system] = 0;
+ }
+ else audio_open_ctr[system]++;
+ return(audio_fd[system]);
+}
+
+static int linux_audio_open_with_error(const char *pathname, int flags, mode_t mode, int system)
+{
+ int fd;
+ fd = linux_audio_open(pathname, flags, mode, system);
+ if (fd == -1)
+ MUS_STANDARD_IO_ERROR(MUS_AUDIO_CANT_OPEN,
+ ((mode == O_RDONLY) ? "open read" :
+ (mode == O_WRONLY) ? "open write" : "open read/write"),
+ pathname);
+ return(fd);
+}
+
+static int find_system(int line)
+{
+ int i;
+ for (i = 0; i < sound_cards; i++)
+ if (line == audio_fd[i])
+ return(i);
+ return(MUS_ERROR);
+}
+
+static int linux_audio_close(int fd)
+{
+ if (fd != -1)
+ {
+ int err = 0, sys;
+ sys = find_system(fd);
+ if (sys != -1)
+ {
+ if (audio_open_ctr[sys] > 0)
+ audio_open_ctr[sys]--;
+ else
+ {
+ err = close(fd);
+ audio_open_ctr[sys] = 0;
+ audio_fd[sys] = -1;
+ }
+ }
+ else err = close(fd);
+ if (err) RETURN_ERROR_EXIT(MUS_AUDIO_CANT_CLOSE, -1,
+ mus_format("close %d failed: %s",
+ fd, strerror(errno)));
+ }
+ /* is this an error? */
+ return(MUS_NO_ERROR);
+}
+
+static int to_oss_format(int snd_format)
+{
+ switch (snd_format)
+ {
+ case MUS_BYTE: return(AFMT_S8); break;
+ case MUS_BSHORT: return(AFMT_S16_BE); break;
+ case MUS_UBYTE: return(AFMT_U8); break;
+ case MUS_MULAW: return(AFMT_MU_LAW); break;
+ case MUS_ALAW: return(AFMT_A_LAW); break;
+ case MUS_LSHORT: return(AFMT_S16_LE); break;
+ case MUS_UBSHORT: return(AFMT_U16_BE); break;
+ case MUS_ULSHORT: return(AFMT_U16_LE); break;
+#ifdef NEW_OSS
+ case MUS_LINT: return(AFMT_S32_LE); break;
+ case MUS_BINT: return(AFMT_S32_BE); break;
+#endif
+ }
+ return(MUS_ERROR);
+}
+
+static char sonorus_buf[LABEL_BUFFER_SIZE];
+static char *sonorus_name(int sys, int offset)
+{
+ mus_snprintf(sonorus_buf, LABEL_BUFFER_SIZE, "/dev/dsp%d", offset + audio_dsp[sys]);
+ return(sonorus_buf);
+}
+
+static bool fragment_set_failed = false;
+
+static int oss_mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size)
+{
+ /* ur_dev is in general MUS_AUDIO_PACK_SYSTEM(n) | MUS_AUDIO_DEVICE */
+ int oss_format, buffer_info, audio_out = -1, sys, dev;
+ char *dev_name;
+#ifndef NEW_OSS
+ int stereo;
+#endif
+ sys = MUS_AUDIO_SYSTEM(ur_dev);
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ oss_format = to_oss_format(format);
+ if (oss_format == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, -1,
+ mus_format("format %d (%s) not available",
+ format,
+ mus_data_format_name(format)));
+ if (audio_type[sys] == SONORUS_STUDIO)
+ {
+ /* in this case the output devices are parcelled out to the /dev/dsp locs */
+ /* dev/dsp0 is always stereo */
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ if (chans > 2)
+ audio_out = open(sonorus_name(sys, 1), O_WRONLY, 0);
+ else audio_out = open(sonorus_name(sys, 0), O_WRONLY, 0);
+ /* probably should write to both outputs */
+ if (audio_out == -1) audio_out = open("/dev/dsp", O_WRONLY, 0);
+ break;
+ case MUS_AUDIO_SPEAKERS:
+ audio_out = open(sonorus_name(sys, 0), O_WRONLY, 0);
+ if (audio_out == -1) audio_out = open("/dev/dsp", O_WRONLY, 0);
+ break;
+ case MUS_AUDIO_ADAT_OUT: case MUS_AUDIO_SPDIF_OUT:
+ audio_out = open(sonorus_name(sys, 1), O_WRONLY, 0);
+ break;
+ case MUS_AUDIO_AES_OUT:
+ audio_out = open(sonorus_name(sys, 9), O_WRONLY, 0);
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, audio_out,
+ mus_format("Sonorus device %d (%s) not available",
+ dev,
+ mus_audio_device_name(dev)));
+ break;
+ }
+ if (audio_out == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, audio_out,
+ mus_format("can't open Sonorus output device %d (%s): %s",
+ dev,
+ mus_audio_device_name(dev), strerror(errno)));
+#ifdef NEW_OSS
+ if (ioctl(audio_out, SNDCTL_DSP_CHANNELS, &chans) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_out,
+ mus_format("can't get %d channels for Sonorus device %d (%s)",
+ chans, dev,
+ mus_audio_device_name(dev)));
+#endif
+ return(audio_out);
+ }
+
+#if HAVE_SAM_9407
+ if (audio_type[sys] == SAM9407_DSP)
+ {
+ char dname[LABEL_BUFFER_SIZE];
+ mus_snprintf(dname, LABEL_BUFFER_SIZE, "/dev/sam%d_dsp", audio_dsp[sys]);
+ audio_out = open(dname, O_WRONLY);
+ if(audio_out == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, audio_out,
+ mus_format("can't open %s: %s",
+ dname,
+ strerror(errno)));
+ if ((ioctl(audio_out, SNDCTL_DSP_SETFMT, &oss_format) == -1) ||
+ (oss_format != to_oss_format(format)))
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, audio_out,
+ mus_format("can't set %s format to %d (%s)",
+ dname, format,
+ mus_data_format_name(format)));
+ if (ioctl(audio_out, SNDCTL_DSP_CHANNELS, &chans) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_out,
+ mus_format("can't get %d channels on %s",
+ chans, dname));
+ if (ioctl(audio_out, SNDCTL_DSP_SPEED, &srate) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, audio_out,
+ mus_format("can't set srate to %d on %s",
+ srate, dname));
+ FRAGMENT_SIZE = 14;
+ buffer_info = (FRAGMENTS << 16) | (FRAGMENT_SIZE);
+ ioctl(audio_out, SNDCTL_DSP_SETFRAGMENT, &buffer_info);
+ return(audio_out);
+ }
+#endif
+
+ if (dev == MUS_AUDIO_DEFAULT)
+ audio_out = linux_audio_open_with_error(dev_name = dac_name(sys, 0),
+ O_WRONLY, 0, sys);
+ else audio_out = linux_audio_open_with_error(dev_name = dac_name(sys, (dev == MUS_AUDIO_AUX_OUTPUT) ? 1 : 0),
+ O_RDWR, 0, sys);
+ if (audio_out == -1) return(MUS_ERROR);
+
+ /* ioctl(audio_out, SNDCTL_DSP_RESET, 0); */ /* causes clicks */
+ if ((fragments_locked) &&
+ (!(fragment_set_failed)) &&
+ ((dev == MUS_AUDIO_DUPLEX_DEFAULT) ||
+ (size != 0))) /* only set if user has previously called set_oss_buffers */
+ {
+ buffer_info = (FRAGMENTS << 16) | (FRAGMENT_SIZE);
+ if (ioctl(audio_out, SNDCTL_DSP_SETFRAGMENT, &buffer_info) == -1)
+ {
+ /* older Linuces (or OSS's?) refuse to handle the fragment reset if O_RDWR used --
+ * someone at OSS forgot to update the version number when this was fixed, so
+ * I have no way to get around this except to try and retry...
+ */
+ linux_audio_close(audio_out);
+ audio_out = linux_audio_open_with_error(dev_name = dac_name(sys, (dev == MUS_AUDIO_AUX_OUTPUT) ? 1 : 0),
+ O_WRONLY, 0, sys);
+ if (audio_out == -1) return(MUS_ERROR);
+ buffer_info = (FRAGMENTS << 16) | (FRAGMENT_SIZE);
+ if (ioctl(audio_out, SNDCTL_DSP_SETFRAGMENT, &buffer_info) == -1)
+ {
+ char *tmp;
+ fprintf(stderr, tmp = mus_format("can't set %s fragments to: %d x %d",
+ dev_name, FRAGMENTS, FRAGMENT_SIZE)); /* not an error if ALSA OSS-emulation */
+ fragment_set_failed = true;
+ FREE(tmp);
+ }
+ }
+ }
+ if ((ioctl(audio_out, SNDCTL_DSP_SETFMT, &oss_format) == -1) ||
+ (oss_format != to_oss_format(format)))
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, audio_out,
+ mus_format("data format %d (%s) not available on %s",
+ format,
+ mus_data_format_name(format),
+ dev_name));
+#ifdef NEW_OSS
+ if (ioctl(audio_out, SNDCTL_DSP_CHANNELS, &chans) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_out,
+ mus_format("can't get %d channels on %s",
+ chans, dev_name));
+#else
+ if (chans == 2) stereo = 1; else stereo = 0;
+ if ((ioctl(audio_out, SNDCTL_DSP_STEREO, &stereo) == -1) ||
+ ((chans == 2) && (stereo == 0)))
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_out,
+ mus_format("can't get %d channels on %s",
+ chans, dev_name));
+#endif
+ if (ioctl(audio_out, SNDCTL_DSP_SPEED, &srate) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, audio_out,
+ mus_format("can't set srate of %s to %d",
+ dev_name, srate));
+ /* http://www.4front-tech.com/pguide/audio.html says this order has to be followed */
+ return(audio_out);
+}
+
+static int oss_mus_audio_write(int line, char *buf, int bytes)
+{
+ int err;
+ if (line < 0) return(-1);
+ errno = 0;
+ err = write(line, buf, bytes);
+ if (err != bytes)
+ {
+ if (errno != 0)
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("write error: %s", strerror(errno)));
+ else RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("wrote %d bytes of requested %d", err, bytes));
+ }
+ return(MUS_NO_ERROR);
+}
+
+static int oss_mus_audio_close(int line)
+{
+ return(linux_audio_close(line));
+}
+
+static int oss_mus_audio_read(int line, char *buf, int bytes)
+{
+ int err;
+ if (line < 0) return(-1);
+ errno = 0;
+ err = read(line, buf, bytes);
+ if (err != bytes)
+ {
+ if (errno != 0)
+ RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ mus_format("read error: %s", strerror(errno)));
+ else RETURN_ERROR_EXIT(MUS_AUDIO_READ_ERROR, -1,
+ mus_format("read %d bytes of requested %d", err, bytes));
+ }
+ return(MUS_NO_ERROR);
+}
+
+static char *oss_unsrc(int srcbit)
+{
+ if (srcbit == 0)
+ return(strdup("none"));
+ else
+ {
+ bool need_and = false;
+ char *buf;
+ buf = (char *)CALLOC(PRINT_BUFFER_SIZE, sizeof(char));
+ if (srcbit & SOUND_MASK_MIC) {need_and = true; strcat(buf, "mic");}
+ if (srcbit & SOUND_MASK_LINE) {if (need_and) strcat(buf, " and "); need_and = true; strcat(buf, "line in");}
+ if (srcbit & SOUND_MASK_LINE1) {if (need_and) strcat(buf, " and "); need_and = true; strcat(buf, "line1");}
+ if (srcbit & SOUND_MASK_LINE2) {if (need_and) strcat(buf, " and "); need_and = true; strcat(buf, "line2");}
+ if (srcbit & SOUND_MASK_LINE3) {if (need_and) strcat(buf, " and "); need_and = true; strcat(buf, "line3");}
+ if (srcbit & SOUND_MASK_CD) {if (need_and) strcat(buf, " and "); need_and = true; strcat(buf, "cd");}
+ return(buf);
+ }
+}
+
+static int oss_mus_audio_open_input(int ur_dev, int srate, int chans, int format, int requested_size)
+{
+ /* dev can be MUS_AUDIO_DEFAULT or MUS_AUDIO_DUPLEX_DEFAULT as well as the obvious others */
+ int audio_fd = -1, oss_format, buffer_info, sys, dev, srcbit, cursrc, err;
+ bool adat_mode = false;
+ char *dev_name;
+#ifndef NEW_OSS
+ int stereo;
+#endif
+ sys = MUS_AUDIO_SYSTEM(ur_dev);
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ oss_format = to_oss_format(format);
+ if (oss_format == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, -1,
+ mus_format("format %d (%s) not available",
+ format,
+ mus_data_format_name(format)));
+ if (audio_type[sys] == SONORUS_STUDIO)
+ {
+ adat_mode = (audio_mode[sys] == 1);
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ if (adat_mode)
+ audio_fd = open(dev_name = sonorus_name(sys, 11), O_RDONLY, 0);
+ else audio_fd = open(dev_name = sonorus_name(sys, 5), O_RDONLY, 0);
+ break;
+ case MUS_AUDIO_ADAT_IN:
+ audio_fd = open(dev_name = sonorus_name(sys, 11), O_RDONLY, 0);
+ break;
+ case MUS_AUDIO_AES_IN:
+ audio_fd = open(dev_name = sonorus_name(sys, 20), O_RDONLY, 0);
+ break;
+ case MUS_AUDIO_SPDIF_IN:
+ audio_fd = open(dev_name = sonorus_name(sys, 5), O_RDONLY, 0);
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, -1,
+ mus_format("no %s device on Sonorus?",
+ mus_audio_device_name(dev)));
+ break;
+ }
+ if (audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_NO_INPUT_AVAILABLE, -1,
+ mus_format("can't open %s (Sonorus device %s): %s",
+ dev_name,
+ mus_audio_device_name(dev),
+ strerror(errno)));
+#ifdef NEW_OSS
+ if (ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &chans) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_fd,
+ mus_format("can't get %d channels on %s (Sonorus device %s)",
+ chans, dev_name,
+ mus_audio_device_name(dev)));
+#endif
+ return(audio_fd);
+ }
+
+#if HAVE_SAM_9407
+ if (audio_type[sys] == SAM9407_DSP)
+ {
+ char dname[LABEL_BUFFER_SIZE];
+ mus_snprintf(dname, LABEL_BUFFER_SIZE, "/dev/sam%d_dsp", audio_dsp[sys]);
+ audio_fd = open(dname, O_RDONLY);
+ if(audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, audio_fd,
+ mus_format("can't open input %s: %s",
+ dname,
+ strerror(errno)));
+ if ((ioctl(audio_fd, SNDCTL_DSP_SETFMT, &oss_format) == -1) ||
+ (oss_format != to_oss_format(format)))
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, audio_fd,
+ mus_format("can't set %s format to %d (%s)",
+ dname, format,
+ mus_data_format_name(format)));
+ if (ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &chans) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_fd,
+ mus_format("can't get %d channels on %s",
+ chans, dname));
+ if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &srate) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, audio_fd,
+ mus_format("can't set srate to %d on %s",
+ srate, dname));
+ FRAGMENT_SIZE = 14;
+ buffer_info = (FRAGMENTS << 16) | (FRAGMENT_SIZE);
+ ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &buffer_info);
+ return(audio_fd);
+ }
+#endif
+
+ if (((dev == MUS_AUDIO_DEFAULT) || (dev == MUS_AUDIO_DUPLEX_DEFAULT)) && (sys == 0))
+ audio_fd = linux_audio_open(dev_name = dac_name(sys, 0),
+ O_RDWR, 0, sys);
+ else audio_fd = linux_audio_open(dev_name = dac_name(sys, (dev == MUS_AUDIO_AUX_INPUT) ? 1 : 0),
+ O_RDONLY, 0, sys);
+ if (audio_fd == -1)
+ {
+ if (dev == MUS_AUDIO_DUPLEX_DEFAULT)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, -1,
+ mus_format("can't open %s (device %s): %s",
+ dev_name, mus_audio_device_name(dev), strerror(errno)));
+ if ((audio_fd = linux_audio_open(dev_name = dac_name(sys, (dev == MUS_AUDIO_AUX_INPUT) ? 1 : 0),
+ O_RDONLY, 0, sys)) == -1)
+ {
+ if ((errno == EACCES) || (errno == ENOENT))
+ RETURN_ERROR_EXIT(MUS_AUDIO_NO_READ_PERMISSION, -1,
+ mus_format("can't open %s (device %s): %s\n to get input in Linux, we need read permission on /dev/dsp",
+ dev_name,
+ mus_audio_device_name(dev),
+ strerror(errno)));
+ else RETURN_ERROR_EXIT(MUS_AUDIO_NO_INPUT_AVAILABLE, -1,
+ mus_format("can't open %s (device %s): %s",
+ dev_name,
+ mus_audio_device_name(dev),
+ strerror(errno)));
+ }
+ }
+#ifdef SNDCTL_DSP_SETDUPLEX
+ else
+ ioctl(audio_fd, SNDCTL_DSP_SETDUPLEX, &err); /* not always a no-op! */
+#endif
+ if (audio_type[sys] == RME_HAMMERFALL) return(audio_fd);
+ if (audio_type[sys] == DELTA_66) return(audio_fd);
+ /* need to make sure the desired recording source is active -- does this actually have any effect? */
+ switch (dev)
+ {
+ case MUS_AUDIO_MICROPHONE: srcbit = SOUND_MASK_MIC; break;
+ case MUS_AUDIO_LINE_IN: srcbit = SOUND_MASK_LINE; break;
+ case MUS_AUDIO_LINE1: srcbit = SOUND_MASK_LINE1; break;
+ case MUS_AUDIO_LINE2: srcbit = SOUND_MASK_LINE2; break;
+ case MUS_AUDIO_LINE3: srcbit = SOUND_MASK_LINE3; break; /* also digital1..3 */
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ case MUS_AUDIO_DEFAULT: srcbit = SOUND_MASK_LINE | SOUND_MASK_MIC; break;
+ case MUS_AUDIO_CD: srcbit = SOUND_MASK_CD; break;
+ default: srcbit = 0; break;
+ /* other possibilities: synth, radio, phonein but these apparently bypass the mixer (no gains?) */
+ }
+ ioctl(audio_fd, MIXER_READ(SOUND_MIXER_RECSRC), &cursrc);
+ srcbit = (srcbit | cursrc);
+ ioctl(audio_fd, MIXER_WRITE(SOUND_MIXER_RECSRC), &srcbit);
+ ioctl(audio_fd, MIXER_READ(SOUND_MIXER_RECSRC), &cursrc);
+ if (cursrc != srcbit)
+ {
+ char *str1, *str2;
+ str1 = oss_unsrc(srcbit);
+ str2 = oss_unsrc(cursrc);
+ mus_print("weird: tried to set recorder source to %s, but got %s?", str1, str2);
+ FREE(str1);
+ FREE(str2);
+ }
+ if ((fragments_locked) && (requested_size != 0))
+ {
+ buffer_info = (FRAGMENTS << 16) | (FRAGMENT_SIZE);
+ ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &buffer_info);
+ }
+ if ((ioctl(audio_fd, SNDCTL_DSP_SETFMT, &oss_format) == -1) ||
+ (oss_format != to_oss_format(format)))
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, audio_fd,
+ mus_format("can't set %s format to %d (%s)",
+ dev_name, format,
+ mus_data_format_name(format)));
+#ifdef NEW_OSS
+ if (ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &chans) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_fd,
+ mus_format("can't get %d channels on %s",
+ chans, dev_name));
+#else
+ if (chans == 2) stereo = 1; else stereo = 0;
+ if ((ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo) == -1) ||
+ ((chans == 2) && (stereo == 0)))
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_fd,
+ mus_format("can't get %d channels on %s (%s)",
+ chans, dev_name,
+ mus_audio_device_name(dev)));
+#endif
+ if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &srate) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, audio_fd,
+ mus_format("can't set srate to %d on %s (%s)",
+ srate, dev_name,
+ mus_audio_device_name(dev)));
+ return(audio_fd);
+}
+
+
+static int oss_mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ int fd, amp, channels, err = MUS_NO_ERROR, devmask, stereodevs, ind, formats, sys, dev, srate;
+ char *dev_name = NULL;
+ sys = MUS_AUDIO_SYSTEM(ur_dev);
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ if (audio_type[sys] == SONORUS_STUDIO)
+ {
+ bool adat_mode = false;
+ adat_mode = (audio_mode[sys] == 1);
+ if (dev == MUS_AUDIO_MIXER) val[0] = 0; /* no mixer */
+ else
+ {
+ if (field == MUS_AUDIO_PORT)
+ {
+ if (adat_mode)
+ {
+ val[0] = 5;
+ val[1] = MUS_AUDIO_ADAT_IN;
+ val[2] = MUS_AUDIO_ADAT_OUT;
+ val[3] = MUS_AUDIO_SPEAKERS;
+ val[4] = MUS_AUDIO_AES_IN;
+ val[5] = MUS_AUDIO_AES_OUT;
+ }
+ else
+ {
+ val[0] = 3;
+ val[1] = MUS_AUDIO_SPDIF_IN;
+ val[2] = MUS_AUDIO_SPDIF_OUT;
+ val[3] = MUS_AUDIO_SPEAKERS;
+ }
+ }
+ else
+ {
+ if (field == MUS_AUDIO_FORMAT)
+ {
+ val[0] = 1;
+ val[1] = MUS_LSHORT;
+ }
+ else
+ {
+ if (field == MUS_AUDIO_CHANNEL)
+ {
+ switch (dev)
+ {
+ case MUS_AUDIO_SPEAKERS:
+ channels = 2;
+ break;
+ case MUS_AUDIO_ADAT_IN: case MUS_AUDIO_ADAT_OUT:
+ channels = 8;
+ break;
+ case MUS_AUDIO_AES_IN: case MUS_AUDIO_AES_OUT:
+ channels = 2;
+ break;
+ case MUS_AUDIO_SPDIF_IN: case MUS_AUDIO_SPDIF_OUT:
+ channels = 4;
+ break;
+ case MUS_AUDIO_DEFAULT:
+ if (adat_mode)
+ channels = 8;
+ else channels = 4;
+ break;
+ default:
+ channels = 0;
+ break;
+ }
+ val[0] = channels;
+ }
+ else
+ {
+ if (field == MUS_AUDIO_SRATE)
+ {
+ val[0] = 44100;
+ }
+ }
+ }
+ }
+ }
+ return(MUS_NO_ERROR);
+ }
+
+#if HAVE_SAM_9407
+ if (audio_type[sys] == SAM9407_DSP)
+ {
+ switch(field)
+ {
+ case MUS_AUDIO_PORT:
+ val[0] = 2;
+ val[1] = MUS_AUDIO_SPEAKERS;
+ val[2] = MUS_AUDIO_LINE_IN;
+ break;
+ case MUS_AUDIO_FORMAT:
+ val[0] = 1;
+ val[1] = MUS_LSHORT;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ val[0] = 2;
+ break;
+ case MUS_AUDIO_AMP:
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, -1,
+ mus_format("can't read %s's gains in Sam9407",
+ mus_audio_device_name(dev)));
+ break;
+ case MUS_AUDIO_SRATE:
+ val[0] = 44100;
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, -1,
+ mus_format("can't read %s's %s in Sam9407",
+ mus_audio_device_name(dev),
+ mus_audio_device_name(field)));
+ break;
+ }
+ return(MUS_NO_ERROR);
+ }
+#endif
+
+ if (audio_type[sys] == RME_HAMMERFALL)
+ {
+ if (dev == MUS_AUDIO_MIXER) val[0] = 0; /* no mixer */
+ else
+ {
+ if (field == MUS_AUDIO_PORT)
+ {
+ val[0] = 5;
+ val[1] = MUS_AUDIO_ADAT_IN;
+ val[2] = MUS_AUDIO_ADAT_OUT;
+ val[3] = MUS_AUDIO_SPEAKERS;
+ val[4] = MUS_AUDIO_AES_IN;
+ val[5] = MUS_AUDIO_AES_OUT;
+ }
+ else
+ {
+ if (field == MUS_AUDIO_FORMAT)
+ {
+ val[0] = 1;
+ val[1] = MUS_LSHORT;
+ }
+ else
+ {
+ if (field == MUS_AUDIO_CHANNEL)
+ {
+ switch (dev)
+ {
+ case MUS_AUDIO_SPEAKERS:
+ channels = 2;
+ break;
+ case MUS_AUDIO_ADAT_IN: case MUS_AUDIO_ADAT_OUT:
+ channels = 8;
+ break;
+ case MUS_AUDIO_AES_IN: case MUS_AUDIO_AES_OUT:
+ channels = 2;
+ break;
+ case MUS_AUDIO_SPDIF_IN: case MUS_AUDIO_SPDIF_OUT:
+ channels = 4;
+ break;
+ case MUS_AUDIO_DEFAULT:
+ channels = 8;
+ break;
+ default:
+ channels = 0;
+ break;
+ }
+ val[0] = channels;
+ }
+ else
+ {
+ if (field == MUS_AUDIO_SRATE)
+ {
+ val[0] = 44100;
+ }
+ }
+ }
+ }
+ }
+ return(MUS_NO_ERROR);
+ }
+
+ fd = linux_audio_open(dev_name = mixer_name(sys), O_RDONLY | O_NONBLOCK, 0, sys);
+ if (fd == -1)
+ {
+ fd = linux_audio_open(DAC_NAME, O_RDONLY, 0, sys);
+ if (fd == -1)
+ {
+ fd = linux_audio_open(DAC_NAME, O_WRONLY, 0, sys);
+ if (fd == -1)
+ {
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, -1,
+ mus_format("can't open input %s or %s: %s",
+ dev_name, DAC_NAME,
+ strerror(errno)));
+ return(MUS_ERROR);
+ }
+ else dev_name = DAC_NAME;
+ }
+ else dev_name = DAC_NAME;
+ }
+ if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devmask))
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE, fd,
+ mus_format("can't read device info from %s",
+ dev_name));
+ err = 0;
+ if ((dev == MUS_AUDIO_MIXER) ||
+ (dev == MUS_AUDIO_DAC_FILTER)) /* these give access to all the on-board analog input gain controls */
+ {
+ amp = 0;
+ ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devmask);
+ switch (field)
+ {
+ /* also DIGITAL1..3 PHONEIN PHONEOUT VIDEO RADIO MONITOR */
+ /* the digital lines should get their own panes in the recorder */
+ /* not clear whether the phone et al lines are routed to the ADC */
+ /* also, I've never seen a card with any of these devices */
+ case MUS_AUDIO_IMIX: if (SOUND_MASK_IMIX & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_IMIX), &amp); break;
+ case MUS_AUDIO_IGAIN: if (SOUND_MASK_IGAIN & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_IGAIN), &amp); break;
+ case MUS_AUDIO_RECLEV: if (SOUND_MASK_RECLEV & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_RECLEV), &amp); break;
+ case MUS_AUDIO_PCM: if (SOUND_MASK_PCM & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_PCM), &amp); break;
+ case MUS_AUDIO_PCM2: if (SOUND_MASK_ALTPCM & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_ALTPCM), &amp); break;
+ case MUS_AUDIO_OGAIN: if (SOUND_MASK_OGAIN & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_OGAIN), &amp); break;
+ case MUS_AUDIO_LINE: if (SOUND_MASK_LINE & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_LINE), &amp); break;
+ case MUS_AUDIO_MICROPHONE: if (SOUND_MASK_MIC & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_MIC), &amp); break;
+ case MUS_AUDIO_LINE1: if (SOUND_MASK_LINE1 & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_LINE1), &amp); break;
+ case MUS_AUDIO_LINE2: if (SOUND_MASK_LINE2 & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_LINE2), &amp); break;
+ case MUS_AUDIO_LINE3: if (SOUND_MASK_LINE3 & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_LINE3), &amp); break;
+ case MUS_AUDIO_SYNTH: if (SOUND_MASK_SYNTH & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_SYNTH), &amp); break;
+ case MUS_AUDIO_BASS: if (SOUND_MASK_BASS & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_BASS), &amp); break;
+ case MUS_AUDIO_TREBLE: if (SOUND_MASK_TREBLE & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_TREBLE), &amp); break;
+ case MUS_AUDIO_CD: if (SOUND_MASK_CD & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_CD), &amp); break;
+ case MUS_AUDIO_CHANNEL:
+ if (dev == MUS_AUDIO_MIXER)
+ {
+ channels = 0;
+ ioctl(fd, SOUND_MIXER_READ_STEREODEVS, &stereodevs);
+ if (SOUND_MASK_IMIX & devmask) {if (SOUND_MASK_IMIX & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_IGAIN & devmask) {if (SOUND_MASK_IGAIN & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_RECLEV & devmask) {if (SOUND_MASK_RECLEV & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_PCM & devmask) {if (SOUND_MASK_PCM & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_ALTPCM & devmask) {if (SOUND_MASK_ALTPCM & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_OGAIN & devmask) {if (SOUND_MASK_OGAIN & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_LINE & devmask) {if (SOUND_MASK_LINE & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_MIC & devmask) {if (SOUND_MASK_MIC & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_LINE1 & devmask) {if (SOUND_MASK_LINE1 & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_LINE2 & devmask) {if (SOUND_MASK_LINE2 & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_LINE3 & devmask) {if (SOUND_MASK_LINE3 & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_SYNTH & devmask) {if (SOUND_MASK_SYNTH & stereodevs) channels += 2; else channels += 1;}
+ if (SOUND_MASK_CD & devmask) {if (SOUND_MASK_CD & stereodevs) channels += 2; else channels += 1;}
+ }
+ else
+ if (SOUND_MASK_TREBLE & devmask) channels = 2; else channels = 0;
+ val[0] = channels;
+ linux_audio_close(fd);
+ return(MUS_NO_ERROR);
+ break;
+ case MUS_AUDIO_FORMAT: /* this is asking for configuration info -- we return an array with per-"device" channels */
+ ioctl(fd, SOUND_MIXER_READ_STEREODEVS, &stereodevs);
+ for (ind = 0; ind <= MUS_AUDIO_SYNTH; ind++) {if (chan > ind) val[ind] = 0;}
+ if (SOUND_MASK_IMIX & devmask) {if (chan > MUS_AUDIO_IMIX) val[MUS_AUDIO_IMIX] = ((SOUND_MASK_IMIX & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_IGAIN & devmask) {if (chan > MUS_AUDIO_IGAIN) val[MUS_AUDIO_IGAIN] = ((SOUND_MASK_IGAIN & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_RECLEV & devmask) {if (chan > MUS_AUDIO_RECLEV) val[MUS_AUDIO_RECLEV] = ((SOUND_MASK_RECLEV & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_PCM & devmask) {if (chan > MUS_AUDIO_PCM) val[MUS_AUDIO_PCM] = ((SOUND_MASK_PCM & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_ALTPCM & devmask) {if (chan > MUS_AUDIO_PCM2) val[MUS_AUDIO_PCM2] = ((SOUND_MASK_ALTPCM & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_OGAIN & devmask) {if (chan > MUS_AUDIO_OGAIN) val[MUS_AUDIO_OGAIN] = ((SOUND_MASK_OGAIN & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_LINE & devmask) {if (chan > MUS_AUDIO_LINE) val[MUS_AUDIO_LINE] = ((SOUND_MASK_LINE & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_MIC & devmask) {if (chan > MUS_AUDIO_MICROPHONE) val[MUS_AUDIO_MICROPHONE] = ((SOUND_MASK_MIC & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_LINE1 & devmask) {if (chan > MUS_AUDIO_LINE1) val[MUS_AUDIO_LINE1] = ((SOUND_MASK_LINE1 & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_LINE2 & devmask) {if (chan > MUS_AUDIO_LINE2) val[MUS_AUDIO_LINE2] = ((SOUND_MASK_LINE2 & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_LINE3 & devmask) {if (chan > MUS_AUDIO_LINE3) val[MUS_AUDIO_LINE3] = ((SOUND_MASK_LINE3 & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_SYNTH & devmask) {if (chan > MUS_AUDIO_SYNTH) val[MUS_AUDIO_SYNTH] = ((SOUND_MASK_SYNTH & stereodevs) ? 2 : 1);}
+ if (SOUND_MASK_CD & devmask) {if (chan > MUS_AUDIO_CD) val[MUS_AUDIO_CD] = ((SOUND_MASK_CD & stereodevs) ? 2 : 1);}
+ linux_audio_close(fd);
+ return(MUS_NO_ERROR);
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, fd,
+ mus_format("can't read %s's (%s) %s",
+ mus_audio_device_name(dev), dev_name,
+ mus_audio_device_name(field)));
+ break;
+ }
+ if (chan == 0)
+ val[0] = ((float)(amp & 0xff)) * 0.01;
+ else val[0] = (((float)((amp & 0xff00) >> 8)) * 0.01);
+ }
+ else
+ {
+ switch (field)
+ {
+ case MUS_AUDIO_PORT:
+ ind = 1;
+ val[1] = MUS_AUDIO_MIXER;
+ if ((SOUND_MASK_MIC | SOUND_MASK_LINE | SOUND_MASK_CD) & devmask) {ind++; if (chan > ind) val[ind] = MUS_AUDIO_LINE_IN;}
+ /* problem here is that microphone and line_in are mixed before the ADC */
+ if (SOUND_MASK_SPEAKER & devmask) {ind++; if (chan > ind) val[ind] = MUS_AUDIO_SPEAKERS;}
+ if (SOUND_MASK_VOLUME & devmask) {ind++; if (chan > ind) val[ind] = MUS_AUDIO_DAC_OUT;}
+ if (SOUND_MASK_TREBLE & devmask) {ind++; if (chan > ind) val[ind] = MUS_AUDIO_DAC_FILTER;}
+ /* DIGITAL1..3 as RECSRC(?) => MUS_AUDIO_DIGITAL_IN */
+ val[0] = ind;
+ break;
+#if 1
+ case MUS_AUDIO_FORMAT:
+ linux_audio_close(fd);
+ fd = open(dac_name(sys, 0), O_WRONLY, 0);
+ if (fd == -1) fd = open(DAC_NAME, O_WRONLY, 0);
+ if (fd == -1)
+ {
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, -1,
+ mus_format("can't open %s: %s",
+ DAC_NAME, strerror(errno)));
+ return(MUS_ERROR);
+ }
+ ioctl(fd, SOUND_PCM_GETFMTS, &formats);
+#else
+ case MUS_AUDIO_FORMAT:
+ ioctl(fd, SOUND_PCM_GETFMTS, &formats);
+ /* this returns -1 and garbage?? */
+
+ /* from Steven Schultz:
+ I did discover why, in audio.c the SOUND_PCM_GETFMTS ioctl was failing.
+ That ioctl call can only be made against the /dev/dsp device and _not_
+ the /dev/mixer device. With that change things starting working real
+ nice.
+ */
+#endif
+ ind = 0;
+ if (formats & (to_oss_format(MUS_BYTE))) {ind++; if (chan > ind) val[ind] = MUS_BYTE;}
+ if (formats & (to_oss_format(MUS_BSHORT))) {ind++; if (chan > ind) val[ind] = MUS_BSHORT;}
+ if (formats & (to_oss_format(MUS_UBYTE))) {ind++; if (chan > ind) val[ind] = MUS_UBYTE;}
+ if (formats & (to_oss_format(MUS_MULAW))) {ind++; if (chan > ind) val[ind] = MUS_MULAW;}
+ if (formats & (to_oss_format(MUS_ALAW))) {ind++; if (chan > ind) val[ind] = MUS_ALAW;}
+ if (formats & (to_oss_format(MUS_LSHORT))) {ind++; if (chan > ind) val[ind] = MUS_LSHORT;}
+ if (formats & (to_oss_format(MUS_UBSHORT))) {ind++; if (chan > ind) val[ind] = MUS_UBSHORT;}
+ if (formats & (to_oss_format(MUS_ULSHORT))) {ind++; if (chan > ind) val[ind] = MUS_ULSHORT;}
+ val[0] = ind;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ channels = 0;
+ ioctl(fd, SOUND_MIXER_READ_STEREODEVS, &stereodevs);
+ switch (dev)
+ {
+ case MUS_AUDIO_MICROPHONE: if (SOUND_MASK_MIC & devmask) {if (SOUND_MASK_MIC & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_SPEAKERS: if (SOUND_MASK_SPEAKER & devmask) {if (SOUND_MASK_SPEAKER & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_LINE_IN: if (SOUND_MASK_LINE & devmask) {if (SOUND_MASK_LINE & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_LINE1: if (SOUND_MASK_LINE1 & devmask) {if (SOUND_MASK_LINE1 & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_LINE2: if (SOUND_MASK_LINE2 & devmask) {if (SOUND_MASK_LINE2 & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_LINE3: if (SOUND_MASK_LINE3 & devmask) {if (SOUND_MASK_LINE3 & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_DAC_OUT: if (SOUND_MASK_VOLUME & devmask) {if (SOUND_MASK_VOLUME & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_DEFAULT: if (SOUND_MASK_VOLUME & devmask) {if (SOUND_MASK_VOLUME & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_CD: if (SOUND_MASK_CD & devmask) {if (SOUND_MASK_CD & stereodevs) channels = 2; else channels = 1;} break;
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ err = ioctl(fd, SNDCTL_DSP_GETCAPS, &ind);
+ if (err != -1)
+ channels = (ind & DSP_CAP_DUPLEX);
+ else channels = 0;
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, fd,
+ mus_format("can't read channel info from %s (%s)",
+ mus_audio_device_name(dev), dev_name));
+ break;
+ }
+ val[0] = channels;
+ break;
+ case MUS_AUDIO_AMP:
+ amp = 0;
+ switch (dev)
+ {
+ case MUS_AUDIO_MICROPHONE: if (SOUND_MASK_MIC & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_MIC), &amp); break;
+ case MUS_AUDIO_SPEAKERS: if (SOUND_MASK_SPEAKER & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_SPEAKER), &amp); break;
+ case MUS_AUDIO_LINE_IN: if (SOUND_MASK_LINE & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_LINE), &amp); break;
+ case MUS_AUDIO_LINE1: if (SOUND_MASK_LINE1 & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_LINE1), &amp); break;
+ case MUS_AUDIO_LINE2: if (SOUND_MASK_LINE2 & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_LINE2), &amp); break;
+ case MUS_AUDIO_LINE3: if (SOUND_MASK_LINE3 & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_LINE3), &amp); break;
+ case MUS_AUDIO_DAC_OUT: if (SOUND_MASK_VOLUME & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_VOLUME), &amp); break;
+ case MUS_AUDIO_DEFAULT: if (SOUND_MASK_VOLUME & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_VOLUME), &amp); break;
+ case MUS_AUDIO_CD: if (SOUND_MASK_CD & devmask) err = ioctl(fd, MIXER_READ(SOUND_MIXER_CD), &amp); break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, fd,
+ mus_format("can't get gain info for %s (%s)",
+ mus_audio_device_name(dev), dev_name));
+ break;
+ }
+ if (err)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, fd,
+ mus_format("can't read %s's (%s) amp info",
+ mus_audio_device_name(dev), dev_name));
+ if (chan == 0)
+ val[0] = ((float)(amp & 0xff)) * 0.01;
+ else val[0] = (((float)((amp & 0xff00) >> 8)) * 0.01);
+ break;
+ case MUS_AUDIO_SRATE:
+ srate = (int)(val[0]);
+ if (ioctl(fd, SNDCTL_DSP_SPEED, &srate) == -1)
+ {
+ linux_audio_close(fd);
+ /* see comment from Steven Schultz above */
+ fd = open(dac_name(sys, 0), O_WRONLY, 0);
+ if (fd == -1) fd = open(DAC_NAME, O_WRONLY, 0);
+ if (ioctl(fd, SNDCTL_DSP_SPEED, &srate) == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, fd,
+ mus_format("can't get %s's (%s) srate",
+ mus_audio_device_name(dev), dev_name));
+ }
+ val[0] = (float)srate;
+ break;
+ case MUS_AUDIO_DIRECTION:
+ switch (dev)
+ {
+ case MUS_AUDIO_DIGITAL_OUT: case MUS_AUDIO_LINE_OUT: case MUS_AUDIO_DEFAULT: case MUS_AUDIO_ADAT_OUT:
+ case MUS_AUDIO_AES_OUT: case MUS_AUDIO_SPDIF_OUT: case MUS_AUDIO_SPEAKERS: case MUS_AUDIO_MIXER:
+ case MUS_AUDIO_DAC_FILTER: case MUS_AUDIO_AUX_OUTPUT: case MUS_AUDIO_DAC_OUT:
+ val[0] = 0.0;
+ break;
+ default:
+ val[0] = 1.0;
+ break;
+ }
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, fd,
+ mus_format("can't get %s's (%s) %s",
+ mus_audio_device_name(dev), dev_name,
+ mus_audio_device_name(field)));
+ break;
+ }
+ }
+ return(linux_audio_close(fd));
+}
+
+static int oss_mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ int fd, err = MUS_NO_ERROR, devmask, vol, sys, dev;
+ char *dev_name;
+ float amp[1];
+ sys = MUS_AUDIO_SYSTEM(ur_dev);
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+
+#if HAVE_SAM_9407
+ if (audio_type[sys] == SAM9407_DSP) return(MUS_NO_ERROR); /* XXX */
+#endif
+
+ if (audio_type[sys] == SONORUS_STUDIO) return(MUS_NO_ERROR); /* there are apparently volume controls, but they're not accessible yet */
+ if (audio_type[sys] == RME_HAMMERFALL) return(MUS_NO_ERROR);
+ if (audio_type[sys] == DELTA_66) return(MUS_NO_ERROR);
+
+ fd = linux_audio_open(dev_name = mixer_name(sys), O_RDWR | O_NONBLOCK, 0, sys);
+ if (fd == -1)
+ {
+ fd = linux_audio_open_with_error(dev_name = DAC_NAME, O_WRONLY, 0, sys);
+ if (fd == -1) return(MUS_ERROR);
+ }
+ if ((dev == MUS_AUDIO_MIXER) ||
+ (dev == MUS_AUDIO_DAC_FILTER)) /* these give access to all the on-board analog input gain controls */
+ {
+ if (mus_audio_mixer_read(ur_dev, field, (chan == 0) ? 1 : 0, amp))
+ {
+ linux_audio_close(fd);
+ return(MUS_ERROR);
+ }
+ if (val[0] >= 0.99) val[0] = 0.99;
+ if (val[0] < 0.0) val[0] = 0.0;
+ if (amp[0] >= 0.99) amp[0] = 0.99;
+ if (chan == 0)
+ vol = (((int)(amp[0] * 100)) << 8) + ((int)(val[0] * 100));
+ else vol = (((int)(val[0] * 100)) << 8) + ((int)(amp[0] * 100));
+ ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devmask);
+ switch (field)
+ {
+ case MUS_AUDIO_IMIX: if (SOUND_MASK_IMIX & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_IMIX), &vol); break;
+ case MUS_AUDIO_IGAIN: if (SOUND_MASK_IGAIN & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_IGAIN), &vol); break;
+ case MUS_AUDIO_RECLEV: if (SOUND_MASK_RECLEV & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_RECLEV), &vol); break;
+ case MUS_AUDIO_PCM: if (SOUND_MASK_PCM & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_PCM), &vol); break;
+ case MUS_AUDIO_PCM2: if (SOUND_MASK_ALTPCM & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_ALTPCM), &vol); break;
+ case MUS_AUDIO_OGAIN: if (SOUND_MASK_OGAIN & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_OGAIN), &vol); break;
+ case MUS_AUDIO_LINE: if (SOUND_MASK_LINE & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_LINE), &vol); break;
+ case MUS_AUDIO_MICROPHONE: if (SOUND_MASK_MIC & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &vol); break;
+ case MUS_AUDIO_LINE1: if (SOUND_MASK_LINE1 & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_LINE1), &vol); break;
+ case MUS_AUDIO_LINE2: if (SOUND_MASK_LINE2 & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_LINE2), &vol); break;
+ case MUS_AUDIO_LINE3: if (SOUND_MASK_LINE3 & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_LINE3), &vol); break;
+ case MUS_AUDIO_SYNTH: if (SOUND_MASK_SYNTH & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_SYNTH), &vol); break;
+ case MUS_AUDIO_BASS: if (SOUND_MASK_BASS & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_BASS), &vol); break;
+ case MUS_AUDIO_TREBLE: if (SOUND_MASK_TREBLE & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_TREBLE), &vol); break;
+ case MUS_AUDIO_CD: if (SOUND_MASK_CD & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_CD), &vol); break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, fd,
+ mus_format("can't write %s's (%s) %s field",
+ mus_audio_device_name(dev), dev_name,
+ mus_audio_device_name(field)));
+ break;
+ }
+ }
+ else
+ {
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ /* need to read both channel amps, then change the one we're concerned with */
+ mus_audio_mixer_read(ur_dev, field, (chan == 0) ? 1 : 0, amp);
+ if (val[0] >= 0.99) val[0] = 0.99;
+ if (val[0] < 0.0) val[0] = 0.0;
+ if (amp[0] >= 0.99) amp[0] = 0.99;
+ if (chan == 0)
+ vol = (((int)(amp[0] * 100)) << 8) + ((int)(val[0] * 100));
+ else vol = (((int)(val[0] * 100)) << 8) + ((int)(amp[0] * 100));
+ ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devmask);
+ switch (dev)
+ {
+ case MUS_AUDIO_MICROPHONE: if (SOUND_MASK_MIC & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_MIC), &vol); break;
+ case MUS_AUDIO_SPEAKERS: if (SOUND_MASK_SPEAKER & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_SPEAKER), &vol); break;
+ case MUS_AUDIO_LINE_IN: if (SOUND_MASK_LINE & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_LINE), &vol); break;
+ case MUS_AUDIO_LINE1: if (SOUND_MASK_LINE1 & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_LINE1), &vol); break;
+ case MUS_AUDIO_LINE2: if (SOUND_MASK_LINE2 & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_LINE2), &vol); break;
+ case MUS_AUDIO_LINE3: if (SOUND_MASK_LINE3 & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_LINE3), &vol); break;
+ case MUS_AUDIO_DAC_OUT: if (SOUND_MASK_VOLUME & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &vol); break;
+ case MUS_AUDIO_DEFAULT: if (SOUND_MASK_VOLUME & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &vol); break;
+ case MUS_AUDIO_CD: if (SOUND_MASK_CD & devmask) err = ioctl(fd, MIXER_WRITE(SOUND_MIXER_CD), &vol); break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, fd,
+ mus_format("device %d (%s) not available on %s",
+ dev, mus_audio_device_name(dev), dev_name));
+ }
+ break;
+ case MUS_AUDIO_SRATE:
+ vol = (int)val[0];
+ linux_audio_close(fd);
+ /* see comment from Steven Schultz above */
+ fd = open(dac_name(sys, 0), O_WRONLY | O_NONBLOCK, 0);
+ if (fd == -1)
+ {
+ fd = open(DAC_NAME, O_WRONLY | O_NONBLOCK, 0);
+ if (fd == -1) return(-1);
+ }
+ err = ioctl(fd, SNDCTL_DSP_SPEED, &vol);
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, fd,
+ mus_format("can't write %s's (%s) %s field",
+ mus_audio_device_name(dev), dev_name,
+ mus_audio_device_name(field)));
+ break;
+ /* case MUS_AUDIO_FORMAT: to force 16-bit input or give up */
+ /* case MUS_AUDIO_CHANNEL: to open as stereo if possible?? */
+ /* case MUS_AUDIO_PORT: to open digital out? */
+ }
+ }
+ if (err)
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, fd,
+ mus_format("possible write problem for %s's (%s) %s field",
+ mus_audio_device_name(dev), dev_name,
+ mus_audio_device_name(field)));
+ return(linux_audio_close(fd));
+}
+
+static char *synth_names[] =
+ {"",
+ "Adlib", "SoundBlaster", "ProAudio Spectrum", "Gravis UltraSound", "MPU 401",
+ "SoundBlaster 16", "SoundBlaster 16 MIDI", "6850 UART", "Gravis UltraSound 16", "Microsoft",
+ "Personal sound system", "Ensoniq Soundscape", "Personal sound system + MPU", "Personal/Microsoft",
+ "Mediatrix Pro", "MAD16", "MAD16 + MPU", "CS4232", "CS4232 + MPU", "Maui",
+ "Pseudo-MSS", "Gravis Ultrasound PnP", "UART 401"};
+
+static char *synth_name(int i)
+{
+#ifdef SNDCARD_UART401
+ if ((i > 0) && (i <= SNDCARD_UART401))
+#else
+ if ((i > 0) && (i <= 26))
+#endif
+ return(synth_names[i]);
+ return("unknown");
+}
+
+static char *device_types[] = {"FM", "Sampling", "MIDI"};
+
+static char *device_type(int i)
+{
+ if ((i >= 0) && (i <= 2))
+ return(device_types[i]);
+ return("unknown");
+}
+
+static void yes_no(int condition)
+{
+ if (condition)
+ pprint(" yes ");
+ else pprint(" no ");
+}
+
+static int set_dsp(int fd, int channels, int bits, int *rate)
+{
+ int val;
+ val = channels;
+ ioctl(fd, SOUND_PCM_WRITE_CHANNELS, &val);
+ if (val != channels) return(MUS_ERROR);
+ val = bits;
+ ioctl(fd, SOUND_PCM_WRITE_BITS, &val);
+ if (val != bits) return(MUS_ERROR);
+ ioctl(fd, SOUND_PCM_WRITE_RATE, rate);
+ return(MUS_NO_ERROR);
+}
+
+static void oss_describe_audio_state_1(void)
+{
+ /* this code taken largely from "Linux Multimedia Guide" by Jeff Tranter, O'Reilly & Associates, Inc 1996 */
+ /* it is explicitly released under the GPL, so I think I can use it here without elaborate disguises */
+ int fd;
+ int status = 0, level, i, recsrc, devmask, recmask, stereodevs, caps;
+ int numdevs = 0, rate = 0, channels = 0, bits = 0, blocksize = 0, formats = 0, deffmt = 0, min_rate = 0, max_rate = 0;
+ struct synth_info sinfo;
+ struct midi_info minfo;
+ const char *sound_device_names[] = SOUND_DEVICE_LABELS;
+ char dsp_name[LABEL_BUFFER_SIZE];
+ char version[LABEL_BUFFER_SIZE];
+ int dsp_num = 0;
+#ifdef NEW_OSS
+ mixer_info mixinfo;
+ oss_sysinfo sysinfo;
+#endif
+
+ if (sound_cards <= 0) mus_audio_initialize();
+ memset((void *)dsp_name, 0, LABEL_BUFFER_SIZE);
+ memset((void *)version, 0, LABEL_BUFFER_SIZE);
+
+#ifdef NEW_OSS
+ fd = open(DAC_NAME, O_WRONLY, 0);
+ if (fd == -1) fd = open(SYNTH_NAME, O_RDONLY, 0);
+ if (fd == -1) fd = open(MIXER_NAME, O_RDONLY, 0);
+ if (fd != -1)
+ {
+ status = ioctl(fd, OSS_GETVERSION, &level);
+ new_oss_running = (status == 0);
+ status = ioctl(fd, OSS_SYSINFO, &sysinfo);
+ close(fd);
+ }
+#endif
+
+ if (new_oss_running)
+ {
+#ifdef NEW_OSS
+ if (status == 0)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "OSS version: %s\n", sysinfo.version);
+ pprint(audio_strbuf);
+ }
+ else
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "OSS version: %x.%x.%x\n", (level >> 16) & 0xff, (level >> 8) & 0xff, level & 0xff);
+ pprint(audio_strbuf);
+ }
+#else
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "OSS version: %x.%x.%x\n", (level >> 16) & 0xff, (level >> 8) & 0xff, level & 0xff);
+ pprint(audio_strbuf);
+#endif
+ }
+ else
+ {
+ /* refers to the version upon compilation */
+ mus_snprintf(version, LABEL_BUFFER_SIZE, "%d", SOUND_VERSION);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "OSS version: %c.%c.%c\n", version[0], version[1], version[2]);
+ pprint(audio_strbuf);
+ }
+
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%d card%s found", sound_cards, (sound_cards != 1) ? "s" : ""); pprint(audio_strbuf);
+ if (sound_cards > 1)
+ {
+ pprint(": ");
+ for (i = 0; i < sound_cards; i++)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "/dev/dsp%d with /dev/mixer%d%s",
+ audio_dsp[i],
+ audio_mixer[i],
+ (i < (sound_cards - 1)) ? ", " : "");
+ pprint(audio_strbuf);
+ }
+ }
+ pprint("\n\n");
+
+ fd = open(SYNTH_NAME, O_RDWR, 0);
+ if (fd == -1) fd = open(SYNTH_NAME, O_RDONLY, 0);
+ if (fd == -1)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%s: %s\n", SYNTH_NAME, strerror(errno)); pprint(audio_strbuf);
+ pprint("no synth found\n");
+ }
+ else
+ {
+ status = ioctl(fd, SNDCTL_SEQ_NRSYNTHS, &numdevs);
+ if (status == -1)
+ {
+ close(fd); fd = -1;
+ pprint("no sequencer?");
+ }
+ else
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "/dev/sequencer: %d device%s installed\n", numdevs, (numdevs == 1) ? "" : "s");
+ pprint(audio_strbuf);
+ for (i = 0; i < numdevs; i++)
+ {
+ sinfo.device = i;
+ status = ioctl(fd, SNDCTL_SYNTH_INFO, &sinfo);
+ if (status != -1)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " device: %d: %s, %s, %d voices\n", i, sinfo.name, device_type(sinfo.synth_type), sinfo.nr_voices);
+ pprint(audio_strbuf);
+ }
+ }
+ status = ioctl(fd, SNDCTL_SEQ_NRMIDIS, &numdevs);
+ if (status == -1)
+ {
+ close(fd); fd = -1;
+ pprint("no midi");
+ }
+ else
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %d midi device%s installed\n", numdevs, (numdevs == 1) ? "" : "s");
+ pprint(audio_strbuf);
+ for (i = 0; i < numdevs; i++)
+ {
+ minfo.device = i;
+ status = ioctl(fd, SNDCTL_MIDI_INFO, &minfo);
+ if (status != -1)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " device %d: %s, %s\n", i, minfo.name, synth_name(minfo.dev_type));
+ pprint(audio_strbuf);
+ }
+ }
+ }
+ }
+ }
+ if (fd != -1) close(fd);
+ pprint("--------------------------------\n");
+
+MIXER_INFO:
+ mus_snprintf(dsp_name, LABEL_BUFFER_SIZE, "%s%d", MIXER_NAME, dsp_num);
+ fd = linux_audio_open(dsp_name, O_RDWR, 0, 0);
+ if (fd == -1)
+ {
+ /* maybe output only */
+ fd = linux_audio_open(dsp_name, O_WRONLY, 0, 0);
+ if (fd == -1)
+ {
+ if (dsp_num == 0)
+ {
+ mus_snprintf(dsp_name, LABEL_BUFFER_SIZE, "%s", DAC_NAME);
+ fd = linux_audio_open(DAC_NAME, O_RDWR, 0, 0);
+ if (fd == -1)
+ {
+ /* maybe output only */
+ fd = linux_audio_open(DAC_NAME, O_WRONLY, 0, 0);
+ if (fd == -1)
+ {
+ pprint("no audio device found\n");
+ return;
+ }
+ }
+ }
+ else goto AUDIO_INFO; /* no /dev/mixern */
+ }
+ else pprint("no audio input enabled\n");
+ }
+ if (fd == -1) goto AUDIO_INFO;
+
+#ifdef NEW_OSS
+ if (new_oss_running) status = ioctl(fd, SOUND_MIXER_INFO, &mixinfo);
+#endif
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%s", dsp_name);
+ pprint(audio_strbuf);
+#ifdef NEW_OSS
+ if ((new_oss_running) && (status == 0))
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " (%s", mixinfo.name);
+ pprint(audio_strbuf);
+ for (i = 0; i < sound_cards; i++)
+ {
+ if ((audio_mixer[i] == dsp_num) && (audio_type[i] == SONORUS_STUDIO))
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " in mode %d", audio_mode[i]);
+ pprint(audio_strbuf);
+ break;
+ }
+ }
+ pprint(")");
+ }
+#endif
+ status = ioctl(fd, SOUND_MIXER_READ_RECSRC, &recsrc);
+ if (status == -1)
+ {
+ linux_audio_close(fd);
+ fd = -1;
+ pprint(" no recsrc\n");
+ }
+ else
+ {
+ status = ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devmask);
+ if ((status == -1) || (devmask == 0))
+ {
+ linux_audio_close(fd);
+ fd = -1;
+ if (status == -1) pprint(" no devmask\n"); else pprint(" (no reported devices)");
+ }
+ else
+ {
+ status = ioctl(fd, SOUND_MIXER_READ_RECMASK, &recmask);
+ if (status == -1)
+ {
+ pprint(" no recmask\n");
+ recmask = 0;
+ }
+ status = ioctl(fd, SOUND_MIXER_READ_STEREODEVS, &stereodevs);
+ if (status == -1)
+ {
+ pprint(" no stereodevs\n");
+ stereodevs = 0;
+ }
+ status = ioctl(fd, SOUND_MIXER_READ_CAPS, &caps);
+ if (status == -1)
+ {
+ pprint(" no caps\n");
+ caps = 0;
+ }
+ pprint(":\n\n"
+ " mixer recording active stereo current\n"
+ " channel source source device level\n"
+ " -------- -------- -------- -------- -------- \n");
+ for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
+ {
+ if ((1<<i) & devmask)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %-10s", sound_device_names[i]);
+ pprint(audio_strbuf);
+ yes_no((1 << i) & recmask);
+ yes_no((1 << i) & recsrc);
+ yes_no((1 << i) & stereodevs);
+ status = ioctl(fd, MIXER_READ(i), &level);
+ if (status != -1)
+ {
+ if ((1<<i) & stereodevs)
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.2f %.2f", (float)(level & 0xff) * 0.01, (float)((level & 0xff00) >> 8) * 0.01);
+ else mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.2f", (float)(level & 0xff) * 0.01);
+ /* can't use %% here because subsequent fprintf in pprint evaluates the %! #$@$! */
+ pprint(audio_strbuf);
+ }
+ pprint("\n");
+ }
+ }
+ pprint("--------------------------------\n");
+ }
+ }
+
+AUDIO_INFO:
+ if (fd != -1) {linux_audio_close(fd); fd = -1;}
+ mus_snprintf(dsp_name, LABEL_BUFFER_SIZE, "%s%d", DAC_NAME, dsp_num);
+ fd = linux_audio_open(dsp_name, O_RDWR, 0, 0);
+ if ((fd == -1) && (dsp_num == 0)) fd = linux_audio_open(DAC_NAME, O_WRONLY, 0, 0);
+ if (fd == -1) return;
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%s:\n\n", dsp_name); pprint(audio_strbuf);
+ if ((ioctl(fd, SOUND_PCM_READ_RATE, &rate) != -1) &&
+ (ioctl(fd, SOUND_PCM_READ_CHANNELS, &channels) != -1) &&
+ (ioctl(fd, SOUND_PCM_READ_BITS, &bits) != -1) &&
+ (ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &blocksize) != -1))
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ " defaults:\n sampling rate: %d, chans: %d, sample size: %d bits, block size: %d bytes",
+ rate, channels, bits, blocksize);
+ pprint(audio_strbuf);
+
+#ifdef SNDCTL_DSP_GETOSPACE
+ {
+ audio_buf_info abi;
+ ioctl(fd, SNDCTL_DSP_GETOSPACE, &abi);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " (%d fragments)\n", abi.fragments);
+ pprint(audio_strbuf);
+ }
+#else
+ pprint("\n");
+#endif
+
+ deffmt = AFMT_QUERY;
+ if ((ioctl(fd, SOUND_PCM_SETFMT, &deffmt) != -1) &&
+ (ioctl(fd, SOUND_PCM_GETFMTS, &formats) != -1))
+ {
+ pprint(" supported formats:\n");
+ if (formats & AFMT_MU_LAW) {pprint(" mulaw"); if (deffmt == AFMT_MU_LAW) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_A_LAW) {pprint(" alaw"); if (deffmt == AFMT_A_LAW) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_IMA_ADPCM) {pprint(" adpcm"); if (deffmt == AFMT_IMA_ADPCM) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_U8) {pprint(" unsigned byte"); if (deffmt == AFMT_U8) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_S16_LE) {pprint(" signed little-endian short"); if (deffmt == AFMT_S16_LE) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_S16_BE) {pprint(" signed big-endian short"); if (deffmt == AFMT_S16_BE) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_S8) {pprint(" signed byte"); if (deffmt == AFMT_S8) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_U16_LE) {pprint(" unsigned little-endian short"); if (deffmt == AFMT_U16_LE) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_U16_BE) {pprint(" unsigned big-endian short"); if (deffmt == AFMT_U16_BE) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_MPEG) {pprint(" mpeg 2"); if (deffmt == AFMT_MPEG) pprint(" (default)"); pprint("\n");}
+#ifdef NEW_OSS
+ if (formats & AFMT_S32_LE) {pprint(" signed little-endian int"); if (deffmt == AFMT_S32_LE) pprint(" (default)"); pprint("\n");}
+ if (formats & AFMT_S32_BE) {pprint(" signed big-endian int"); if (deffmt == AFMT_S32_BE) pprint(" (default)"); pprint("\n");}
+#endif
+ status = ioctl(fd, SNDCTL_DSP_GETCAPS, &caps);
+ if (status != -1)
+ {
+ if (caps & DSP_CAP_DUPLEX) pprint(" full duplex\n");
+ pprint(" sample srate\n channels size min max\n");
+ for (channels = 1; channels <= 2; channels++)
+ {
+ for (bits = 8; bits <= 16; bits += 8)
+ {
+ min_rate = 1;
+ if (set_dsp(fd, channels, bits, &min_rate) == -1) continue;
+ max_rate = 100000;
+ if (set_dsp(fd, channels, bits, &max_rate) == -1) continue;
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %4d %8d %8d %8d\n", channels, bits, min_rate, max_rate);
+ pprint(audio_strbuf);
+ }
+ }
+ }
+ }
+ }
+ pprint("--------------------------------\n");
+ linux_audio_close(fd);
+ fd = -1;
+ dsp_num++;
+ if (dsp_num < 16)
+ {
+ mus_snprintf(dsp_name, LABEL_BUFFER_SIZE, "%s%d", MIXER_NAME, dsp_num);
+ goto MIXER_INFO;
+ }
+}
+
+/* ------------------------------- ALSA, OSS, Jack ----------------------------------- */
+/* API being used */
+
+static int api = ALSA_API;
+int mus_audio_api(void) {return(api);}
+
+/* hopefully first call to sndlib will be this... */
+static int probe_api(void);
+static int (*vect_mus_audio_initialize)(void);
+
+/* FIXME: add a suitable default for all other vectors
+ so that a call happening before mus_audio_initialize
+ can be detected */
+/* I don't think this is necessary -- documentation discusses this
+ * (mus_sound_initialize calls mus_audio_initialize)
+ */
+
+/* vectors for the rest of the sndlib api */
+static void (*vect_mus_oss_set_buffers)(int num, int size);
+static int (*vect_mus_audio_systems)(void);
+static char* (*vect_mus_audio_system_name)(int system);
+static char* (*vect_mus_audio_moniker)(void);
+static int (*vect_mus_audio_open_output)(int ur_dev, int srate, int chans, int format, int size);
+static int (*vect_mus_audio_open_input)(int ur_dev, int srate, int chans, int format, int requested_size);
+static int (*vect_mus_audio_write)(int id, char *buf, int bytes);
+static int (*vect_mus_audio_read)(int id, char *buf, int bytes);
+static int (*vect_mus_audio_close)(int id);
+static int (*vect_mus_audio_mixer_read)(int ur_dev, int field, int chan, float *val);
+static int (*vect_mus_audio_mixer_write)(int ur_dev, int field, int chan, float *val);
+static void (*vect_describe_audio_state_1)(void);
+
+/* vectors for the rest of the sndlib api */
+int mus_audio_initialize(void)
+{
+ return(probe_api());
+}
+
+void mus_oss_set_buffers(int num, int size)
+{
+ vect_mus_oss_set_buffers(num, size);
+}
+
+int mus_audio_systems(void)
+{
+ return(vect_mus_audio_systems());
+}
+
+char* mus_audio_system_name(int system)
+{
+ return(vect_mus_audio_system_name(system));
+}
+
+#if HAVE_ALSA
+static char* alsa_mus_audio_moniker(void);
+#endif
+
+char* mus_audio_moniker(void)
+{
+#if (HAVE_OSS && HAVE_ALSA)
+ char *both_names;
+ both_names = (char *)CALLOC(PRINT_BUFFER_SIZE, sizeof(char));
+ /* need to be careful here since these use the same constant buffer */
+ strcpy(both_names, oss_mus_audio_moniker());
+ strcat(both_names, ", ");
+ strcat(both_names, alsa_mus_audio_moniker());
+ return(both_names); /* tiny memory leak ... */
+#else
+ return(vect_mus_audio_moniker());
+#endif
+}
+
+int mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size)
+{
+ return(vect_mus_audio_open_output(ur_dev, srate, chans, format, size));
+}
+
+int mus_audio_open_input(int ur_dev, int srate, int chans, int format, int requested_size)
+{
+ return(vect_mus_audio_open_input(ur_dev, srate, chans, format, requested_size));
+}
+
+int mus_audio_write(int id, char *buf, int bytes)
+{
+ return(vect_mus_audio_write(id, buf, bytes));
+}
+
+int mus_audio_read(int id, char *buf, int bytes)
+{
+ return(vect_mus_audio_read(id, buf, bytes));
+}
+
+int mus_audio_close(int id)
+{
+ return(vect_mus_audio_close(id));
+}
+
+int mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ return(vect_mus_audio_mixer_read(ur_dev, field, chan, val));
+}
+
+int mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ return(vect_mus_audio_mixer_write(ur_dev, field, chan, val));
+}
+
+static void describe_audio_state_1(void)
+{
+ vect_describe_audio_state_1();
+}
+
+#if HAVE_JACK
+ static int jack_mus_audio_initialize(void);
+#endif
+
+#if (!HAVE_ALSA)
+static int probe_api(void)
+{
+#if HAVE_JACK
+ {
+ int jackprobe = jack_mus_audio_initialize();
+ if (jackprobe == MUS_ERROR)
+ {
+#endif
+ /* go for the oss api */
+ api = OSS_API;
+ vect_mus_audio_initialize = oss_mus_audio_initialize;
+ vect_mus_oss_set_buffers = oss_mus_oss_set_buffers;
+ vect_mus_audio_systems = oss_mus_audio_systems;
+ vect_mus_audio_system_name = oss_mus_audio_system_name;
+ vect_mus_audio_moniker = oss_mus_audio_moniker;
+ vect_mus_audio_open_output = oss_mus_audio_open_output;
+ vect_mus_audio_open_input = oss_mus_audio_open_input;
+ vect_mus_audio_write = oss_mus_audio_write;
+ vect_mus_audio_read = oss_mus_audio_read;
+ vect_mus_audio_close = oss_mus_audio_close;
+ vect_mus_audio_mixer_read = oss_mus_audio_mixer_read;
+ vect_mus_audio_mixer_write = oss_mus_audio_mixer_write;
+ vect_describe_audio_state_1 = oss_describe_audio_state_1;
+ return(vect_mus_audio_initialize());
+#if HAVE_JACK
+ }
+ return(jackprobe);
+ }
+#endif
+}
+#endif
+
+#endif
+
+
+/* ------------------------------- ALSA ----------------------------------------- */
+/*
+ * added HAVE_NEW_ALSA, and changed various calls to reflect the new calling sequences (all under HAVE_NEW_ALSA)
+ * also scheme/ruby tie-ins, and other such changes. Changed the names of the environment variables to use MUS, not SNDLIB.
+ * reformatted and reorganized to be like the rest of the code
+ * changed default device to "default"
+ * -- Bill 3-Feb-06
+ *
+ * error handling (mus_error) changed by Bill 14-Nov-02
+ * 0.5 support removed by Bill 24-Mar-02
+ *
+ * changed for 0.9.x api by Fernando Lopez-Lezcano <nando@ccrma.stanford.edu>
+ *
+ * sndlib "exports" only one soundcard with two directions (if they are available),
+ * and only deals with the alsa library pcm's. It does not scan for available
+ * cards and devices at the hardware level. Which device it uses can be defined by:
+ *
+ * - setting variables in the environment (searched for in the following order):
+ * MUS_ALSA_PLAYBACK_DEVICE
+ * defines the name of the playback device
+ * MUS_ALSA_CAPTURE_DEVICE
+ * defines the name of the capture device
+ * MUS_ALSA_DEVICE
+ * defines the name of the playback and capture device
+ * use the first two if the playback and capture devices are different or the
+ * third if they are the same.
+ * - if no variables are found in the environment sndlib tries to probe for a
+ * default device named "sndlib" (in alsa 0.9 devices are configured in
+ * /usr/share/alsa/alsa.conf or in ~/.asoundrc)
+ * - if "sndlib" is not a valid device "hw:0,0" was used [but now it looks for "default"] (which by default should
+ * point to the first device of the first card
+ *
+ * Some default settings are controllable through the environment as well:
+ * MUS_ALSA_BUFFER_SIZE = size of each buffer in frames
+ * MUS_ALSA_BUFFERS = number of buffers
+ *
+ * changed 18-Sep-00 by Bill: new error handling: old mus_audio_error folded into
+ * mus_error; mus_error itself should be used only for "real" errors -- things
+ * that can cause a throw (a kind of global jump elsewhere); use mus_print for informational
+ * stuff -- in Snd, mus_print will also save everything printed in the error dialog.
+ * In a few cases, I tried to fix the code to unwind before mus_error, and in others
+ * I've changed mus_error to mus_print, but some of these may be mistaken.
+ * Look for ?? below for areas where I'm not sure I rewrote code correctly.
+ *
+ * changed for 0.6.x api by Paul Barton-Davis, pbd@op.net
+ *
+ * changed for 0.5.x api by Fernando Lopez-Lezcano, nando@ccrma.stanford.edu
+ * 04-10-2000:
+ * based on original 0.4.x code by Paul Barton-Davis (not much left of it :-)
+ * also Bill's code and Jaroslav Kysela (aplay.c and friends)
+ *
+ * Changes:
+ * 04/25/2000: finished major rework, snd-dac now automatically decides which
+ * device or devices it uses for playback. Multiple device use is
+ * for now restricted to only two at most (more changes in Bill's
+ * needed to be able to support more). Four channel playback in
+ * Ensoniq AudioPCI and relatives possible (with proper settings
+ * of the mixer) as well as using two separate cards.
+ * 04/11/2000: added reporting of alsa sound formats
+*/
+
+#if HAVE_ALSA
+
+#if (!HAVE_OSS)
+#define AUDIO_OK
+#endif
+
+#include <sys/ioctl.h>
+
+#if (!HAVE_NEW_ALSA)
+ #define ALSA_PCM_OLD_HW_PARAMS_API
+ #define ALSA_PCM_OLD_SW_PARAMS_API
+#endif
+
+#if HAVE_ALSA_ASOUNDLIB_H
+ #include <alsa/asoundlib.h>
+#else
+ #include <sys/asoundlib.h>
+#endif
+
+#if SND_LIB_VERSION < ((0<<16)|(6<<8)|(0))
+ #error ALSA version is too old -- audio.c needs 0.9 or later
+#endif
+
+/* prototypes for the alsa sndlib functions */
+static int alsa_mus_audio_initialize(void);
+static void alsa_mus_oss_set_buffers(int num, int size);
+static int alsa_mus_audio_systems(void);
+static char* alsa_mus_audio_system_name(int system);
+static int alsa_mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size);
+static int alsa_mus_audio_open_input(int ur_dev, int srate, int chans, int format, int requested_size);
+static int alsa_mus_audio_write(int id, char *buf, int bytes);
+static int alsa_mus_audio_read(int id, char *buf, int bytes);
+static int alsa_mus_audio_close(int id);
+static int alsa_mus_audio_mixer_read(int ur_dev, int field, int chan, float *val);
+static int alsa_mus_audio_mixer_write(int ur_dev, int field, int chan, float *val);
+static void alsa_describe_audio_state_1(void);
+
+/* decide which api to activate */
+
+static int probe_api(void)
+{
+#if HAVE_JACK
+ int jackprobe;
+ jackprobe = jack_mus_audio_initialize();
+ if (jackprobe == MUS_ERROR)
+ {
+#endif
+ int card = -1;
+ if ((snd_card_next(&card) >= 0) && (card >= 0))
+ {
+ /* the alsa library has detected one or more cards */
+ api = ALSA_API;
+ vect_mus_audio_initialize = alsa_mus_audio_initialize;
+ vect_mus_oss_set_buffers = alsa_mus_oss_set_buffers;
+ vect_mus_audio_systems = alsa_mus_audio_systems;
+ vect_mus_audio_system_name = alsa_mus_audio_system_name;
+ vect_mus_audio_moniker = alsa_mus_audio_moniker;
+ vect_mus_audio_open_output = alsa_mus_audio_open_output;
+ vect_mus_audio_open_input = alsa_mus_audio_open_input;
+ vect_mus_audio_write = alsa_mus_audio_write;
+ vect_mus_audio_read = alsa_mus_audio_read;
+ vect_mus_audio_close = alsa_mus_audio_close;
+ vect_mus_audio_mixer_read = alsa_mus_audio_mixer_read;
+ vect_mus_audio_mixer_write = alsa_mus_audio_mixer_write;
+ vect_describe_audio_state_1 = alsa_describe_audio_state_1;
+ }
+ else
+ {
+ /* go for the oss api */
+ api = OSS_API;
+ vect_mus_audio_initialize = oss_mus_audio_initialize;
+ vect_mus_oss_set_buffers = oss_mus_oss_set_buffers;
+ vect_mus_audio_systems = oss_mus_audio_systems;
+ vect_mus_audio_system_name = oss_mus_audio_system_name;
+ vect_mus_audio_moniker = oss_mus_audio_moniker;
+ vect_mus_audio_open_output = oss_mus_audio_open_output;
+ vect_mus_audio_open_input = oss_mus_audio_open_input;
+ vect_mus_audio_write = oss_mus_audio_write;
+ vect_mus_audio_read = oss_mus_audio_read;
+ vect_mus_audio_close = oss_mus_audio_close;
+ vect_mus_audio_mixer_read = oss_mus_audio_mixer_read;
+ vect_mus_audio_mixer_write = oss_mus_audio_mixer_write;
+ vect_describe_audio_state_1 = oss_describe_audio_state_1;
+ }
+ /* will the _real_ mus_audio_initialize please stand up? */
+ return(vect_mus_audio_initialize());
+#if HAVE_JACK
+ }
+ return(jackprobe);
+#endif
+}
+
+/* convert a sndlib sample format to an alsa sample format */
+
+static snd_pcm_format_t to_alsa_format(int snd_format)
+{
+ switch (snd_format)
+ {
+ case MUS_BYTE: return(SND_PCM_FORMAT_S8);
+ case MUS_UBYTE: return(SND_PCM_FORMAT_U8);
+ case MUS_MULAW: return(SND_PCM_FORMAT_MU_LAW);
+ case MUS_ALAW: return(SND_PCM_FORMAT_A_LAW);
+ case MUS_BSHORT: return(SND_PCM_FORMAT_S16_BE);
+ case MUS_LSHORT: return(SND_PCM_FORMAT_S16_LE);
+ case MUS_UBSHORT: return(SND_PCM_FORMAT_U16_BE);
+ case MUS_ULSHORT: return(SND_PCM_FORMAT_U16_LE);
+ case MUS_B24INT: return(SND_PCM_FORMAT_S24_BE);
+ case MUS_L24INT: return(SND_PCM_FORMAT_S24_LE);
+ case MUS_BINT: return(SND_PCM_FORMAT_S32_BE);
+ case MUS_LINT: return(SND_PCM_FORMAT_S32_LE);
+ case MUS_BINTN: return(SND_PCM_FORMAT_S32_BE);
+ case MUS_LINTN: return(SND_PCM_FORMAT_S32_LE);
+ case MUS_BFLOAT: return(SND_PCM_FORMAT_FLOAT_BE);
+ case MUS_LFLOAT: return(SND_PCM_FORMAT_FLOAT_LE);
+ case MUS_BDOUBLE: return(SND_PCM_FORMAT_FLOAT64_BE);
+ case MUS_LDOUBLE: return(SND_PCM_FORMAT_FLOAT64_LE);
+ }
+ return((snd_pcm_format_t)MUS_ERROR);
+}
+
+/* FIXME: this is not taking yet into account the
+ * number of bits that a given alsa format is actually
+ * using...
+ */
+
+static int to_mus_format(int alsa_format)
+{
+ /* alsa format definitions from asoundlib.h (0.9 cvs 6/27/2001) */
+ switch (alsa_format)
+ {
+ case SND_PCM_FORMAT_S8: return(MUS_BYTE);
+ case SND_PCM_FORMAT_U8: return(MUS_UBYTE);
+ case SND_PCM_FORMAT_S16_LE: return(MUS_LSHORT);
+ case SND_PCM_FORMAT_S16_BE: return(MUS_BSHORT);
+ case SND_PCM_FORMAT_U16_LE: return(MUS_ULSHORT);
+ case SND_PCM_FORMAT_U16_BE: return(MUS_UBSHORT);
+ case SND_PCM_FORMAT_S24_LE: return(MUS_L24INT);
+ case SND_PCM_FORMAT_S24_BE: return(MUS_B24INT);
+ case SND_PCM_FORMAT_S32_LE: return(MUS_LINTN); /* 32bit normalized plays 24bit and 16bit files with same amplitude bound (for 24 bit cards) */
+ case SND_PCM_FORMAT_S32_BE: return(MUS_BINTN);
+ case SND_PCM_FORMAT_FLOAT_LE: return(MUS_LFLOAT);
+ case SND_PCM_FORMAT_FLOAT_BE: return(MUS_BFLOAT);
+ case SND_PCM_FORMAT_FLOAT64_LE: return(MUS_LDOUBLE);
+ case SND_PCM_FORMAT_FLOAT64_BE: return(MUS_BDOUBLE);
+ case SND_PCM_FORMAT_MU_LAW: return(MUS_MULAW);
+ case SND_PCM_FORMAT_A_LAW: return(MUS_ALAW);
+ /* formats with no translation in snd */
+ case SND_PCM_FORMAT_U24_LE:
+ case SND_PCM_FORMAT_U24_BE:
+ case SND_PCM_FORMAT_U32_LE:
+ case SND_PCM_FORMAT_U32_BE:
+ case SND_PCM_FORMAT_IEC958_SUBFRAME_LE:
+ case SND_PCM_FORMAT_IEC958_SUBFRAME_BE:
+ case SND_PCM_FORMAT_IMA_ADPCM:
+ case SND_PCM_FORMAT_MPEG:
+ case SND_PCM_FORMAT_GSM:
+ case SND_PCM_FORMAT_SPECIAL:
+ default:
+ return(MUS_ERROR);
+ }
+}
+
+/* convert a sndlib device into an alsa device number and channel
+ * [has to be coordinated with following function!]
+ */
+
+/* very simplistic approach, device mapping should also depend
+ * on which card we're dealing with, digital i/o devices should
+ * be identified as such and so on
+ */
+
+/* NOTE: in the Delta1010 digital i/o is just a pair of channels
+ * in the 10 channel playback frame or 12 channel capture frame,
+ * how do we specify that???
+ */
+
+static int to_alsa_device(int dev, int *adev, snd_pcm_stream_t *achan)
+{
+ switch(dev)
+ {
+ /* default values are a problem because the concept does
+ * not imply a direction (playback or capture). This works
+ * fine as long as both directions of a device are symetric,
+ * the Midiman 1010, for example, has 10 channel frames for
+ * playback and 12 channel frames for capture and breaks
+ * the recorder (probes the default, defaults to output,
+ * uses the values for input).
+ */
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ case MUS_AUDIO_LINE_OUT:
+ /* analog output */
+ (*adev) = 0;
+ (*achan) = SND_PCM_STREAM_PLAYBACK;
+ break;
+ case MUS_AUDIO_AUX_OUTPUT:
+ /* extra analog output */
+ (*adev) = 1;
+ (*achan) = SND_PCM_STREAM_PLAYBACK;
+ break;
+ case MUS_AUDIO_DAC_OUT:
+ /* analog outputs */
+ (*adev) = 2;
+ (*achan) = SND_PCM_STREAM_PLAYBACK;
+ break;
+ case MUS_AUDIO_MICROPHONE:
+ case MUS_AUDIO_LINE_IN:
+ /* analog input */
+ (*adev) = 0;
+ (*achan) = SND_PCM_STREAM_CAPTURE;
+ break;
+ case MUS_AUDIO_AUX_INPUT:
+ /* extra analog input */
+ (*adev) = 1;
+ (*achan) = SND_PCM_STREAM_CAPTURE;
+ break;
+ case MUS_AUDIO_DIGITAL_OUT:
+ case MUS_AUDIO_SPDIF_OUT:
+ case MUS_AUDIO_AES_OUT:
+ case MUS_AUDIO_ADAT_OUT:
+ case MUS_AUDIO_DIGITAL_IN:
+ case MUS_AUDIO_SPDIF_IN:
+ case MUS_AUDIO_AES_IN:
+ case MUS_AUDIO_ADAT_IN:
+ case MUS_AUDIO_SPEAKERS:
+ case MUS_AUDIO_DAC_FILTER:
+ case MUS_AUDIO_MIXER:
+ case MUS_AUDIO_LINE1:
+ case MUS_AUDIO_LINE2:
+ case MUS_AUDIO_LINE3:
+ case MUS_AUDIO_CD:
+ default:
+ return(MUS_ERROR);
+ break;
+ }
+ return(0);
+}
+
+/* convert an alsa device into a sndlib device
+ * [has to be coordinated with previous function!]
+ *
+ * naming here is pretty much arbitrary. We have to have
+ * a bidirectional mapping between sndlib devices and
+ * alsa devices and that's just not possible (I think).
+ * This stopgap mapping ignores digital input and output
+ * devices - how to differentiate them in alsa?
+ */
+
+static int to_sndlib_device(int dev, int channel)
+{
+ switch (channel)
+ {
+ case SND_PCM_STREAM_PLAYBACK:
+ switch (dev)
+ {
+ /* works only for the first three outputs */
+ case 0: return(MUS_AUDIO_LINE_OUT);
+ case 1: return(MUS_AUDIO_AUX_OUTPUT);
+ case 2: return(MUS_AUDIO_DAC_OUT);
+ default:
+ return(MUS_ERROR);
+ }
+ case SND_PCM_STREAM_CAPTURE:
+ switch (dev)
+ {
+ case 0: return(MUS_AUDIO_LINE_IN);
+ case 1: return(MUS_AUDIO_AUX_INPUT);
+ default:
+ return(MUS_ERROR);
+ }
+ break;
+ }
+ return(MUS_ERROR);
+}
+
+
+static int alsa_mus_error(int type, char *message)
+{
+ if (message)
+ {
+ mus_print(message);
+ FREE(message);
+ }
+ return(MUS_ERROR);
+}
+
+#if 0
+static void alsa_dump_hardware_params(snd_pcm_hw_params_t *params, const char *msg)
+{
+ snd_output_t *out;
+ snd_output_stdio_attach(&out, stderr, 0);
+ fprintf(stderr, "%s\n", msg);
+ snd_pcm_hw_params_dump(params, out);
+}
+
+static void alsa_dump_software_params(snd_pcm_sw_params_t *params, const char *msg)
+{
+ snd_output_t *out;
+ snd_output_stdio_attach(&out, stderr, 0);
+ fprintf(stderr, "%s\n", msg);
+ snd_pcm_sw_params_dump(params, out);
+}
+#endif
+
+
+/* dump current hardware and software configuration */
+
+static void alsa_dump_configuration(char *name, snd_pcm_hw_params_t *hw_params, snd_pcm_sw_params_t *sw_params)
+{
+ int err;
+ char *str;
+ size_t len;
+ snd_output_t *buf;
+
+#if (SND_LIB_MAJOR == 0) || ((SND_LIB_MAJOR == 1) && (SND_LIB_MINOR == 0) && (SND_LIB_SUBMINOR < 8))
+ return; /* avoid Alsa bug */
+#endif
+
+ err = snd_output_buffer_open(&buf);
+ if (err < 0)
+ {
+ mus_print("could not open dump buffer: %s", snd_strerror(err));
+ }
+ else
+ {
+ if (hw_params)
+ {
+ snd_output_puts(buf, "hw_params status of ");
+ snd_output_puts(buf, name);
+ snd_output_puts(buf, "\n");
+ err = snd_pcm_hw_params_dump(hw_params, buf);
+ if (err < 0)
+ mus_print("snd_pcm_hw_params_dump: %s", snd_strerror(err));
+ }
+ if (sw_params)
+ {
+ snd_output_puts(buf, "sw_params status of ");
+ snd_output_puts(buf, name);
+ snd_output_puts(buf, "\n");
+ err = snd_pcm_sw_params_dump(sw_params, buf);
+ if (err < 0)
+ mus_print("snd_pcm_hw_params_dump: %s", snd_strerror(err));
+ }
+ snd_output_putc(buf, '\0');
+ len = snd_output_buffer_string(buf, &str);
+ if (len > 1)
+ mus_print("status of %s\n%s", name, str);
+ snd_output_close(buf);
+ }
+}
+
+/* get hardware params for a pcm */
+
+static snd_pcm_hw_params_t *alsa_get_hardware_params(const char *name, snd_pcm_stream_t stream, int mode)
+{
+ int err;
+ snd_pcm_t *handle;
+ if ((err = snd_pcm_open(&handle, name, stream, mode | SND_PCM_NONBLOCK)) != 0)
+ {
+ alsa_mus_error(MUS_AUDIO_CANT_OPEN,
+ mus_format("open pcm %s for stream %d: %s",
+ name, stream, snd_strerror(err)));
+ return(NULL);
+ }
+ else
+ {
+ snd_pcm_hw_params_t *params;
+ params = (snd_pcm_hw_params_t *)calloc(1, snd_pcm_hw_params_sizeof());
+ if (params == NULL)
+ {
+ snd_pcm_close(handle);
+ alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("could not allocate memory for hardware params"));
+ }
+ else
+ {
+ err = snd_pcm_hw_params_any(handle, params);
+ if (err < 0)
+ {
+ snd_pcm_close(handle);
+ alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("snd_pcm_hw_params_any: pcm %s, stream %d, error: %s",
+ name, stream, snd_strerror(err)));
+ }
+ else
+ {
+ snd_pcm_close(handle);
+ return(params);
+ }
+ }
+ }
+ return(NULL);
+}
+
+/* allocate software params structure */
+
+static snd_pcm_sw_params_t *alsa_get_software_params(void)
+{
+ snd_pcm_sw_params_t *params = NULL;
+ params = (snd_pcm_sw_params_t *)calloc(1, snd_pcm_sw_params_sizeof());
+ if (params == NULL)
+ {
+ alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("could not allocate memory for software params"));
+ }
+ return(params);
+}
+
+/* probe a device name against the list of available pcm devices */
+
+#ifndef SND_CONFIG_GET_ID_ARGS
+ #define SND_CONFIG_GET_ID_ARGS 1
+#endif
+
+static bool alsa_probe_device_name(const char *name)
+{
+ snd_config_t *conf;
+ snd_config_iterator_t pos, next;
+ int err;
+
+ err = snd_config_update();
+ if (err < 0)
+ {
+ mus_print("snd_config_update: %s", snd_strerror(err));
+ return(false);
+ }
+
+ err = snd_config_search(snd_config, "pcm", &conf);
+ if (err < 0)
+ {
+ mus_print("snd_config_search: %s", snd_strerror(err));
+ return(false);
+ }
+
+ snd_config_for_each(pos, next, conf)
+ {
+ snd_config_t *c = snd_config_iterator_entry(pos);
+#if (SND_CONFIG_GET_ID_ARGS == 2)
+ const char *id;
+ int err = snd_config_get_id(c, &id);
+ if (err == 0) {
+ int result = strncmp(name, id, strlen(id));
+ if (result == 0 &&
+ (name[strlen(id)] == '\0' || name[strlen(id)] == ':'))
+ {
+ return(true);
+ }
+ }
+#else
+ const char *id = snd_config_get_id(c);
+ int result = strncmp(name, id, strlen(id));
+ if (result == 0 &&
+ (name[strlen(id)] == '\0' || name[strlen(id)] == ':'))
+ {
+ return(true);
+ }
+#endif
+ }
+ return(false);
+}
+
+/* check a device name against the list of available pcm devices */
+
+static int alsa_check_device_name(const char *name)
+{
+ if (!alsa_probe_device_name(name))
+ {
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ,
+ mus_format("alsa could not find device \"%s\" in configuration",
+ name)));
+ }
+ return(MUS_NO_ERROR);
+}
+
+
+/* set scheduling priority to SCHED_FIFO
+ * this will only work if the program that uses sndlib is run as root or is suid root
+ */
+
+/* whether we want to trace calls
+ *
+ * set to "1" to print function trace information in the
+ * snd error window
+ */
+
+static int alsa_trace = 0;
+
+/* this should go away as it is oss specific */
+
+static int fragment_size = 512;
+static int fragments = 4;
+
+static void alsa_mus_oss_set_buffers(int num, int size)
+{
+ fragments = num;
+ fragment_size = size;
+#if MUS_DEBUGGING
+ mus_print("set_oss_buffers: %d fragments or size %d", num, size);
+#endif
+}
+
+/* total number of soundcards in our setup, set by initialize_audio */
+
+/* static int sound_cards = 0; */
+
+/* return the number of cards that are available */
+
+static int alsa_mus_audio_systems(void)
+{
+ return(sound_cards);
+}
+
+/* return the type of driver we're dealing with */
+
+static char *alsa_mus_audio_moniker(void)
+{
+ if (version_name == NULL) version_name = (char *)CALLOC(LABEL_BUFFER_SIZE, sizeof(char));
+ mus_snprintf(version_name, LABEL_BUFFER_SIZE, "ALSA %s", SND_LIB_VERSION_STR);
+ return(version_name);
+}
+
+/* handles for both directions of the virtual device */
+
+static snd_pcm_t *handles[2] = {NULL, NULL};
+
+/* hardware and software parameter sctructure pointers */
+
+static snd_pcm_hw_params_t *alsa_hw_params[2] = {NULL, NULL}; /* avoid bogus free */
+static snd_pcm_sw_params_t *alsa_sw_params[2] = {NULL, NULL};
+
+/* some defaults */
+
+static int alsa_open_mode = SND_PCM_ASYNC;
+static int alsa_buffers = 3;
+/* size of buffer in number of samples per channel,
+ * at 44100 approximately 5.9mSecs
+ */
+static int alsa_samples_per_channel = 1024;
+static snd_pcm_access_t alsa_interleave = SND_PCM_ACCESS_RW_INTERLEAVED;
+static int alsa_max_capture_channels = 32;
+
+/* first default name for pcm configuration */
+
+static char *alsa_sndlib_device_name = "sndlib";
+
+/* second default for playback and capture: hardware pcm, first card, first device */
+/* pcms used by sndlib, playback and capture */
+
+static char *alsa_playback_device_name = NULL;
+static char *alsa_capture_device_name = NULL;
+
+
+/* -------- tie these names into scheme/ruby -------- */
+
+static int alsa_get_max_buffers(void)
+{
+ unsigned int max_periods = 0, max_rec_periods = 0;
+ int dir = 0;
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_periods_max(alsa_hw_params[SND_PCM_STREAM_PLAYBACK], &max_periods, &dir);
+#else
+ max_periods = snd_pcm_hw_params_get_periods_max(alsa_hw_params[SND_PCM_STREAM_PLAYBACK], &dir);
+#endif
+ if (alsa_hw_params[SND_PCM_STREAM_CAPTURE])
+ {
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_periods_max(alsa_hw_params[SND_PCM_STREAM_CAPTURE], &max_rec_periods, &dir);
+#else
+ max_rec_periods = snd_pcm_hw_params_get_periods_max(alsa_hw_params[SND_PCM_STREAM_CAPTURE], &dir);
+#endif
+ if (max_periods > max_rec_periods)
+ max_periods = max_rec_periods;
+ }
+ return(max_periods);
+}
+
+static int alsa_get_min_buffers(void)
+{
+ unsigned int min_periods = 0, min_rec_periods = 0;
+ int dir = 0;
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_periods_min(alsa_hw_params[SND_PCM_STREAM_PLAYBACK], &min_periods, &dir);
+#else
+ min_periods = snd_pcm_hw_params_get_periods_min(alsa_hw_params[SND_PCM_STREAM_PLAYBACK], &dir);
+#endif
+ if (alsa_hw_params[SND_PCM_STREAM_CAPTURE])
+ {
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_periods_min(alsa_hw_params[SND_PCM_STREAM_CAPTURE], &min_rec_periods, &dir);
+#else
+ min_rec_periods = snd_pcm_hw_params_get_periods_min(alsa_hw_params[SND_PCM_STREAM_CAPTURE], &dir);
+#endif
+ if (min_periods < min_rec_periods)
+ min_periods = min_rec_periods;
+ }
+ return(min_periods);
+}
+
+static int alsa_clamp_buffers(int bufs)
+{
+ int minb, maxb;
+ minb = alsa_get_min_buffers();
+ maxb = alsa_get_max_buffers();
+ if (bufs > maxb)
+ bufs = maxb;
+ if (bufs < minb)
+ bufs = minb;
+ return(bufs);
+}
+
+static snd_pcm_uframes_t alsa_get_min_buffer_size(void)
+{
+ snd_pcm_uframes_t min_buffer_size = 0, min_rec_buffer_size = 0;
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_buffer_size_min(alsa_hw_params[SND_PCM_STREAM_PLAYBACK], &min_buffer_size);
+#else
+ min_buffer_size = snd_pcm_hw_params_get_buffer_size_min(alsa_hw_params[SND_PCM_STREAM_PLAYBACK]);
+#endif
+ if (alsa_hw_params[SND_PCM_STREAM_CAPTURE])
+ {
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_buffer_size_min(alsa_hw_params[SND_PCM_STREAM_CAPTURE], &min_rec_buffer_size);
+#else
+ min_rec_buffer_size = snd_pcm_hw_params_get_buffer_size_min(alsa_hw_params[SND_PCM_STREAM_CAPTURE]);
+#endif
+
+ if (min_buffer_size < min_rec_buffer_size)
+ min_buffer_size = min_rec_buffer_size;
+ }
+ return(min_buffer_size);
+}
+
+static snd_pcm_uframes_t alsa_get_max_buffer_size(void)
+{
+ snd_pcm_uframes_t max_buffer_size = 0, max_rec_buffer_size = 0;
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_buffer_size_max(alsa_hw_params[SND_PCM_STREAM_PLAYBACK], &max_buffer_size);
+#else
+ max_buffer_size = snd_pcm_hw_params_get_buffer_size_max(alsa_hw_params[SND_PCM_STREAM_PLAYBACK]);
+#endif
+ if (alsa_hw_params[SND_PCM_STREAM_CAPTURE])
+ {
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_buffer_size_max(alsa_hw_params[SND_PCM_STREAM_CAPTURE], &max_rec_buffer_size);
+#else
+ max_rec_buffer_size = snd_pcm_hw_params_get_buffer_size_max(alsa_hw_params[SND_PCM_STREAM_CAPTURE]);
+#endif
+ if (max_buffer_size > max_rec_buffer_size)
+ max_buffer_size = max_rec_buffer_size;
+ }
+ return(max_buffer_size);
+}
+
+static int alsa_clamp_buffer_size(int buf_size)
+{
+ int minb, maxb;
+ minb = alsa_get_min_buffer_size();
+ maxb = alsa_get_max_buffer_size();
+ if (buf_size > maxb)
+ buf_size = maxb;
+ if (buf_size < minb)
+ buf_size = minb;
+ return(buf_size);
+}
+
+static bool alsa_set_playback_parameters(void)
+{
+ /* playback stream parameters */
+ if (alsa_hw_params[SND_PCM_STREAM_PLAYBACK]) free(alsa_hw_params[SND_PCM_STREAM_PLAYBACK]);
+ alsa_hw_params[SND_PCM_STREAM_PLAYBACK] = alsa_get_hardware_params(alsa_playback_device_name, SND_PCM_STREAM_PLAYBACK, alsa_open_mode);
+ if (alsa_hw_params[SND_PCM_STREAM_PLAYBACK])
+ {
+ snd_pcm_uframes_t size;
+ int old_buffers;
+ old_buffers = alsa_buffers;
+ if (alsa_sw_params[SND_PCM_STREAM_PLAYBACK]) free(alsa_sw_params[SND_PCM_STREAM_PLAYBACK]);
+ alsa_sw_params[SND_PCM_STREAM_PLAYBACK] = alsa_get_software_params();
+ sound_cards = 1;
+ alsa_buffers = alsa_clamp_buffers(alsa_buffers);
+ if (alsa_buffers <= 0)
+ {
+ alsa_buffers = old_buffers;
+ return(false);
+ }
+ size = alsa_clamp_buffer_size(alsa_samples_per_channel * alsa_buffers);
+ if (size <= 0) return(false);
+ alsa_samples_per_channel = size / alsa_buffers;
+ }
+ return(alsa_hw_params[SND_PCM_STREAM_PLAYBACK] && alsa_sw_params[SND_PCM_STREAM_PLAYBACK]);
+}
+
+static bool alsa_set_capture_parameters(void)
+{
+ /* capture stream parameters */
+ if (alsa_hw_params[SND_PCM_STREAM_CAPTURE]) free(alsa_hw_params[SND_PCM_STREAM_CAPTURE]);
+ alsa_hw_params[SND_PCM_STREAM_CAPTURE] = alsa_get_hardware_params(alsa_capture_device_name, SND_PCM_STREAM_CAPTURE, alsa_open_mode);
+ if (alsa_hw_params[SND_PCM_STREAM_CAPTURE])
+ {
+ snd_pcm_uframes_t size;
+ int old_buffers;
+ old_buffers = alsa_buffers;
+ if (alsa_sw_params[SND_PCM_STREAM_CAPTURE]) free(alsa_sw_params[SND_PCM_STREAM_CAPTURE]);
+ alsa_sw_params[SND_PCM_STREAM_CAPTURE] = alsa_get_software_params();
+ sound_cards = 1;
+ alsa_buffers = alsa_clamp_buffers(alsa_buffers);
+ if (alsa_buffers <= 0)
+ {
+ alsa_buffers = old_buffers;
+ return(false);
+ }
+ size = alsa_clamp_buffer_size(alsa_samples_per_channel * alsa_buffers);
+ if (size <= 0) return(false);
+ alsa_samples_per_channel = size / alsa_buffers;
+ }
+ return(alsa_hw_params[SND_PCM_STREAM_CAPTURE] && alsa_sw_params[SND_PCM_STREAM_CAPTURE]);
+}
+
+
+char *mus_alsa_playback_device(void) {return(alsa_playback_device_name);}
+char *mus_alsa_set_playback_device(const char *name)
+{
+ if (alsa_check_device_name(name) == MUS_NO_ERROR)
+ {
+ char *old_name = alsa_playback_device_name;
+ alsa_playback_device_name = strdup(name);
+ if (!alsa_set_playback_parameters())
+ {
+ alsa_playback_device_name = old_name; /* try to back out of the mistake */
+ alsa_set_playback_parameters();
+ }
+ }
+ return(alsa_playback_device_name);
+}
+
+char *mus_alsa_capture_device(void) {return(alsa_capture_device_name);}
+char *mus_alsa_set_capture_device(const char *name)
+{
+ if (alsa_check_device_name(name) == MUS_NO_ERROR)
+ {
+ char *old_name = alsa_capture_device_name;
+ alsa_capture_device_name = strdup(name);
+ if (!alsa_set_capture_parameters())
+ {
+ alsa_capture_device_name = old_name;
+ alsa_set_capture_parameters();
+ }
+ }
+ return(alsa_capture_device_name);
+}
+
+char *mus_alsa_device(void) {return(alsa_sndlib_device_name);}
+char *mus_alsa_set_device(const char *name)
+{
+ if (alsa_check_device_name(name) == MUS_NO_ERROR)
+ {
+ alsa_sndlib_device_name = strdup(name);
+ mus_alsa_set_playback_device(name);
+ mus_alsa_set_capture_device(name);
+ }
+ return(alsa_sndlib_device_name);
+}
+
+int mus_alsa_buffer_size(void) {return(alsa_samples_per_channel);}
+int mus_alsa_set_buffer_size(int size)
+{
+ snd_pcm_uframes_t bsize;
+ if (alsa_buffers == 0) alsa_buffers = 1;
+ if (size > 0)
+ {
+ bsize = alsa_clamp_buffer_size(size * alsa_buffers);
+ alsa_samples_per_channel = bsize / alsa_buffers;
+ }
+ return(alsa_samples_per_channel);
+}
+
+int mus_alsa_buffers(void) {return(alsa_buffers);}
+int mus_alsa_set_buffers(int num)
+{
+ snd_pcm_uframes_t size;
+ if (num > 0)
+ {
+ alsa_buffers = alsa_clamp_buffers(num);
+ if (alsa_buffers > 0)
+ {
+ size = alsa_clamp_buffer_size(alsa_samples_per_channel * alsa_buffers);
+ alsa_samples_per_channel = size / alsa_buffers;
+ }
+ }
+ return(alsa_buffers);
+}
+
+static bool alsa_squelch_warning = false;
+bool mus_alsa_squelch_warning(void) {return(alsa_squelch_warning);}
+bool mus_alsa_set_squelch_warning(bool val)
+{
+ alsa_squelch_warning = val;
+ return(val);
+}
+
+
+
+
+/* return the name of a given system */
+
+static char *alsa_mus_audio_system_name(int system)
+{
+ return(alsa_playback_device_name);
+}
+
+/* get a device name from the environment */
+
+static char *alsa_get_device_from_env(const char *name)
+{
+ char *string = getenv(name);
+ if (string)
+ if (alsa_check_device_name(string) == MUS_NO_ERROR)
+ return(string);
+ return(NULL);
+}
+
+/* get an integer from the environment */
+
+static int alsa_get_int_from_env(const char *name, int *value, int min, int max)
+{
+ char *string = getenv(name);
+ if (string)
+ {
+ char *end;
+ long int result = strtol(string, &end, 10);
+ if (((min != -1) && (max != -1)) &&
+ (result < min || result > max))
+ {
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ,
+ mus_format("%s ignored: out of range, value=%d, min=%d, max=%d",
+ name, (int)result, min, max)));
+ }
+ else
+ {
+ if (errno == ERANGE)
+ {
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ,
+ mus_format("%s ignored: strlol conversion out of range",
+ name)));
+ }
+ else
+ {
+ if ((*string != '\0') && (*end == '\0'))
+ {
+ *value = (int)result;
+ return(MUS_NO_ERROR);
+ }
+ else
+ {
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ,
+ mus_format("%s ignored: value is \"%s\", not an integer",
+ name, string)));
+ }
+ }
+ }
+ }
+ return(MUS_ERROR);
+}
+
+/* initialize the audio subsystem */
+
+/* define environment variable names */
+#define MUS_ALSA_PLAYBACK_DEVICE_ENV_NAME "MUS_ALSA_PLAYBACK_DEVICE"
+#define MUS_ALSA_CAPTURE_DEVICE_ENV_NAME "MUS_ALSA_CAPTURE_DEVICE"
+#define MUS_ALSA_DEVICE_ENV_NAME "MUS_ALSA_DEVICE"
+#define MUS_ALSA_BUFFERS_ENV_NAME "MUS_ALSA_BUFFERS"
+#define MUS_ALSA_BUFFER_SIZE_ENV_NAME "MUS_ALSA_BUFFER_SIZE"
+#define MUS_ALSA_TRACE_ENV_NAME "MUS_ALSA_TRACE"
+
+static int alsa_mus_audio_initialize(void)
+{
+ char *name = NULL;
+ char *pname;
+ char *cname;
+ int value = 0, alsa_buffer_size = 0;
+
+ if (audio_initialized)
+ return(0);
+
+ sound_cards = 0;
+
+ /* get trace flag from environment */
+ if (alsa_get_int_from_env(MUS_ALSA_TRACE_ENV_NAME, &value, 0, 1) == MUS_NO_ERROR)
+ alsa_trace = value;
+
+ /* try to get device names from environment */
+ pname = alsa_get_device_from_env(MUS_ALSA_PLAYBACK_DEVICE_ENV_NAME);
+ if ((pname) && (alsa_probe_device_name(pname)))
+ alsa_playback_device_name = pname;
+
+ cname = alsa_get_device_from_env(MUS_ALSA_CAPTURE_DEVICE_ENV_NAME);
+ if ((cname) && (alsa_probe_device_name(cname)))
+ alsa_capture_device_name = cname;
+
+ name = alsa_get_device_from_env(MUS_ALSA_DEVICE_ENV_NAME);
+ if ((name) && (alsa_probe_device_name(name)))
+ {
+ if (!alsa_playback_device_name)
+ alsa_playback_device_name = name;
+
+ if (!alsa_capture_device_name)
+ alsa_capture_device_name = name;
+
+ alsa_sndlib_device_name = name;
+ }
+
+ /* now check that we have a plausible name */
+ if (!alsa_probe_device_name(alsa_sndlib_device_name))
+ {
+ alsa_sndlib_device_name = "default";
+ if (!alsa_probe_device_name(alsa_sndlib_device_name))
+ {
+ alsa_sndlib_device_name = "plughw:0";
+ if (!alsa_probe_device_name(alsa_sndlib_device_name))
+ alsa_sndlib_device_name = "hw:0";
+ }
+ }
+
+ /* if no device name set yet, try for special sndlib name first */
+ if (!alsa_playback_device_name)
+ {
+ if (alsa_probe_device_name(alsa_sndlib_device_name))
+ alsa_playback_device_name = alsa_sndlib_device_name;
+ else alsa_playback_device_name = "hw:0";
+ }
+
+ if (!alsa_capture_device_name)
+ {
+ if (alsa_probe_device_name(alsa_sndlib_device_name))
+ alsa_capture_device_name = alsa_sndlib_device_name;
+ else alsa_capture_device_name = "hw:0";
+ }
+
+ alsa_get_int_from_env(MUS_ALSA_BUFFERS_ENV_NAME, &alsa_buffers, -1, -1);
+ alsa_get_int_from_env(MUS_ALSA_BUFFER_SIZE_ENV_NAME, &alsa_buffer_size, -1, -1);
+
+ if ((alsa_buffer_size > 0) && (alsa_buffers > 0))
+ alsa_samples_per_channel = alsa_buffer_size / alsa_buffers;
+
+ if (!alsa_set_playback_parameters())
+ {
+ /* somehow we got a device that passed muster with alsa_probe_device_name, but doesn't return hw params! */
+ alsa_playback_device_name = "plughw:0";
+ if (!alsa_set_playback_parameters())
+ {
+ alsa_playback_device_name = "hw:0";
+ if (!alsa_set_playback_parameters())
+ return(MUS_ERROR);
+ }
+ }
+
+ if (!alsa_set_capture_parameters())
+ {
+ alsa_capture_device_name = "plughw:0";
+ if (!alsa_set_capture_parameters())
+ {
+ alsa_capture_device_name = "hw:0";
+ if (!alsa_set_capture_parameters())
+ return(MUS_ERROR);
+ }
+ }
+
+ if ((!alsa_hw_params[SND_PCM_STREAM_CAPTURE]) ||
+ (!alsa_hw_params[SND_PCM_STREAM_PLAYBACK]))
+ return(MUS_ERROR);
+
+ audio_initialized = true;
+ return(0);
+}
+
+/* open an input or output stream */
+
+static int alsa_audio_open(int ur_dev, int srate, int chans, int format, int size)
+{
+ int card, device, alsa_device;
+ snd_pcm_format_t alsa_format;
+ snd_pcm_stream_t alsa_stream;
+ char *alsa_name;
+ int frames, periods;
+ int err;
+ unsigned int r;
+ snd_pcm_t *handle;
+ snd_pcm_hw_params_t *hw_params = NULL;
+ snd_pcm_sw_params_t *sw_params = NULL;
+
+ if ((!audio_initialized) &&
+ (mus_audio_initialize() != MUS_NO_ERROR))
+ return(MUS_ERROR);
+ if (chans <= 0) return(MUS_ERROR);
+
+ if (alsa_trace)
+ mus_print("%s: %x rate=%d, chans=%d, format=%d:%s, size=%d",
+ c__FUNCTION__, ur_dev, srate, chans, format,
+ mus_audio_format_name(format), size);
+
+ card = MUS_AUDIO_SYSTEM(ur_dev);
+ device = MUS_AUDIO_DEVICE(ur_dev);
+
+ if ((err = to_alsa_device(device, &alsa_device, &alsa_stream)) < 0)
+ {
+ return(alsa_mus_error(MUS_AUDIO_DEVICE_NOT_AVAILABLE,
+ mus_format("%s: cannot translate device %s<%d> to alsa",
+ snd_strerror(err), mus_audio_device_name(device), device)));
+ }
+ if ((alsa_format = to_alsa_format(format)) == (snd_pcm_format_t)MUS_ERROR)
+ {
+ return(alsa_mus_error(MUS_AUDIO_FORMAT_NOT_AVAILABLE,
+ mus_format("could not change %s<%d> to alsa format",
+ mus_audio_format_name(format), format)));
+ }
+
+ alsa_name = (alsa_stream == SND_PCM_STREAM_PLAYBACK) ? alsa_playback_device_name : alsa_capture_device_name;
+ if ((err = snd_pcm_open(&handle, alsa_name, alsa_stream, alsa_open_mode)) != 0)
+ {
+ snd_pcm_close(handle);
+ return(alsa_mus_error(MUS_AUDIO_CANT_OPEN,
+ mus_format("open pcm %s (%s) stream %s: %s",
+ mus_audio_device_name(device), alsa_name, snd_pcm_stream_name(alsa_stream),
+ snd_strerror(err))));
+ }
+ handles[alsa_stream] = handle;
+ hw_params = alsa_hw_params[alsa_stream];
+ sw_params = alsa_sw_params[alsa_stream];
+ if ((err = snd_pcm_hw_params_any(handle, hw_params)) < 0)
+ {
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: no parameter configurations available for %s",
+ snd_strerror(err), alsa_name)));
+ }
+
+ err = snd_pcm_hw_params_set_access(handle, hw_params, alsa_interleave);
+ if (err < 0)
+ {
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: %s: access type %s not available",
+ snd_strerror(err), alsa_name, snd_pcm_access_name(alsa_interleave))));
+ }
+
+ periods = alsa_buffers;
+ err = snd_pcm_hw_params_set_periods(handle, hw_params, periods, 0);
+ if (err < 0)
+ {
+ unsigned int minp, maxp;
+ int dir;
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_periods_min(hw_params, &minp, &dir);
+ snd_pcm_hw_params_get_periods_max(hw_params, &maxp, &dir);
+#else
+ minp = snd_pcm_hw_params_get_periods_min(hw_params, &dir);
+ maxp = snd_pcm_hw_params_get_periods_max(hw_params, &dir);
+#endif
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: %s: cannot set number of periods to %d, min is %d, max is %d",
+ snd_strerror(err), alsa_name, periods, (int)minp, (int)maxp)));
+ }
+
+ frames = size / chans / mus_bytes_per_sample(format);
+
+ err = snd_pcm_hw_params_set_buffer_size(handle, hw_params, frames * periods);
+ if (err < 0)
+ {
+ snd_pcm_uframes_t minp, maxp;
+#if HAVE_NEW_ALSA
+ snd_pcm_hw_params_get_buffer_size_min(hw_params, &minp);
+ snd_pcm_hw_params_get_buffer_size_max(hw_params, &maxp);
+#else
+ minp = snd_pcm_hw_params_get_buffer_size_min(hw_params);
+ maxp = snd_pcm_hw_params_get_buffer_size_max(hw_params);
+#endif
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: %s: cannot set buffer size to %d periods of %d frames; \
+total requested buffer size is %d frames, minimum allowed is %d, maximum is %d",
+ snd_strerror(err), alsa_name, periods, frames, periods * frames, (int)minp, (int)maxp)));
+ }
+
+ err = snd_pcm_hw_params_set_format(handle, hw_params, alsa_format);
+ if (err < 0)
+ {
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: %s: cannot set format to %s",
+ snd_strerror(err), alsa_name, snd_pcm_format_name(alsa_format))));
+ }
+
+ err = snd_pcm_hw_params_set_channels(handle, hw_params, chans);
+ if (err < 0)
+ {
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: %s: cannot set channels to %d",
+ snd_strerror(err), alsa_name, chans)));
+ }
+#if HAVE_NEW_ALSA
+ {
+ unsigned int new_rate;
+ new_rate = srate;
+ r = snd_pcm_hw_params_set_rate_near(handle, hw_params, &new_rate, 0);
+ if (r < 0)
+ {
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: %s: cannot set sampling rate near %d",
+ snd_strerror(r), alsa_name, srate)));
+ }
+ else
+ {
+ if ((new_rate != srate) && (!alsa_squelch_warning))
+ {
+ mus_print("%s: could not set rate to exactly %d, set to %d instead",
+ alsa_name, srate, new_rate);
+ }
+ }
+ }
+#else
+ r = snd_pcm_hw_params_set_rate_near(handle, hw_params, srate, 0);
+ if (r < 0)
+ {
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: %s: cannot set sampling rate near %d",
+ snd_strerror(r), alsa_name, srate)));
+ }
+ else
+ {
+ if (r != srate)
+ {
+ mus_print("%s: could not set rate to exactly %d, set to %d instead",
+ alsa_name, srate, r);
+ }
+ }
+#endif
+
+ err = snd_pcm_hw_params(handle, hw_params);
+ if (err < 0)
+ {
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: cannot set hardware parameters for %s",
+ snd_strerror(err), alsa_name)));
+ }
+
+ snd_pcm_sw_params_current(handle, sw_params);
+ err = snd_pcm_sw_params(handle, sw_params);
+ if (err < 0)
+ {
+ snd_pcm_close(handle);
+ handles[alsa_stream] = NULL;
+ alsa_dump_configuration(alsa_name, hw_params, sw_params);
+ return(alsa_mus_error(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("%s: cannot set software parameters for %s",
+ snd_strerror(err), alsa_name)));
+ }
+
+ /* for now the id for the stream is the direction identifier, that is
+ not a problem because we only advertise one card with two devices */
+ return(alsa_stream);
+}
+
+/* sndlib support for opening output devices */
+
+static int alsa_mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size)
+{
+ return(alsa_audio_open(ur_dev, srate, chans, format, size));
+}
+
+/* sndlib support for opening input devices */
+
+static int alsa_mus_audio_open_input(int ur_dev, int srate, int chans, int format, int size)
+{
+ return(alsa_audio_open(ur_dev, srate, chans, format, size));
+}
+
+/* sndlib support for closing a device */
+
+/* to force it to stop, snd_pcm_drop */
+
+static bool xrun_warned = false;
+
+static int alsa_mus_audio_close(int id)
+{
+ int err = 0;
+ xrun_warned = false;
+ if (alsa_trace) mus_print( "%s: %d", c__FUNCTION__, id);
+ if (handles[id])
+ {
+ err = snd_pcm_drain(handles[id]);
+ if (err != 0)
+ mus_print("snd_pcm_drain: %s", snd_strerror(err));
+
+ err = snd_pcm_close(handles[id]);
+ if (err != 0)
+ return(alsa_mus_error(MUS_AUDIO_CANT_CLOSE,
+ mus_format("snd_pcm_close: %s",
+ snd_strerror(err))));
+ handles[id] = NULL;
+ }
+ return(MUS_NO_ERROR);
+}
+
+/* recover from underruns or overruns */
+
+static int recover_from_xrun(int id)
+{
+ int err;
+ snd_pcm_status_t *status;
+ snd_pcm_state_t state;
+ snd_pcm_status_alloca(&status);
+ err = snd_pcm_status(handles[id], status);
+ if (err < 0)
+ {
+ mus_print("%s: snd_pcm_status: %s", c__FUNCTION__, snd_strerror(err));
+ return(MUS_ERROR);
+ }
+ state = snd_pcm_status_get_state(status);
+ if (state == SND_PCM_STATE_XRUN)
+ {
+ if (!xrun_warned)
+ {
+ xrun_warned = true;
+ mus_print("[under|over]run detected");
+ }
+ err = snd_pcm_prepare(handles[id]);
+ if (err < 0)
+ mus_print("snd_pcm_prepare: %s", snd_strerror(err));
+ else return(MUS_NO_ERROR);
+ }
+ else mus_print("%s: error, current state is %s", c__FUNCTION__, snd_pcm_state_name(state));
+ return(MUS_ERROR);
+}
+
+/* sndlib support for writing a buffer to an output device */
+
+static int alsa_mus_audio_write(int id, char *buf, int bytes)
+{
+ snd_pcm_sframes_t status;
+ ssize_t frames;
+ frames = snd_pcm_bytes_to_frames(handles[id], bytes);
+#if MUS_DEBUGGING
+ if ((frames <= 0) || (frames > bytes))
+ {
+ /* pcm->frame_bits not correct? */
+ mus_print("audio write %d frames (%d bytes)?", bytes, frames);
+ abort();
+ return(MUS_ERROR);
+ }
+#endif
+ status = snd_pcm_writei(handles[id], buf, frames);
+ if ((status == -EAGAIN) ||
+ ((status >= 0) && (status < frames)))
+ snd_pcm_wait(handles[id], 1000);
+ else
+ {
+ if (status == -EPIPE)
+ return(recover_from_xrun(id));
+ else
+ {
+ if (status < 0)
+ {
+ mus_print("snd_pcm_writei: %s", snd_strerror(status));
+ return(MUS_ERROR);
+ }
+ }
+ }
+ return(MUS_NO_ERROR);
+}
+
+/* sndlib support for reading a buffer from an input device */
+
+static int alsa_mus_audio_read(int id, char *buf, int bytes)
+{
+ snd_pcm_sframes_t status;
+ ssize_t frames;
+ frames = snd_pcm_bytes_to_frames(handles[id], bytes);
+#if MUS_DEBUGGING
+ if ((frames <= 0) || (frames > bytes))
+ {
+ mus_print("audio read %d frames (%d bytes)?", frames, bytes);
+ abort();
+ return(MUS_ERROR);
+ }
+#endif
+ status = snd_pcm_readi(handles[id], buf, frames);
+ if ((status == -EAGAIN) ||
+ ((status >= 0) && (status < frames)))
+ snd_pcm_wait(handles[id], 1000);
+ else
+ {
+ if (status == -EPIPE)
+ return(recover_from_xrun(id));
+ else
+ {
+ if (status < 0)
+ {
+ mus_print("snd_pcm_readi: %s", snd_strerror(status));
+ return(MUS_ERROR);
+ }
+ }
+ }
+ return(MUS_NO_ERROR);
+}
+
+/* read state of the audio hardware */
+
+static int alsa_mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ int card;
+ int device;
+ int alsa_device;
+ snd_pcm_stream_t alsa_stream;
+ int f, err;
+
+ if ((!audio_initialized) &&
+ (mus_audio_initialize() != MUS_NO_ERROR))
+ return(MUS_ERROR);
+
+ card = MUS_AUDIO_SYSTEM(ur_dev);
+ device = MUS_AUDIO_DEVICE(ur_dev);
+ if (alsa_trace)
+ mus_print( "%s: card=%d, dev=%s<%d>, field=%s<%d>, chan=%d",
+ c__FUNCTION__, card, mus_audio_device_name(device), device,
+ mus_audio_device_name(field), field,
+ chan);
+ /* for now do not implement mixer interface */
+ if (device == MUS_AUDIO_MIXER)
+ {
+ val[0] = 0;
+ return(MUS_NO_ERROR);
+ }
+ /* MUS_AUDIO_PORT probes for devices and should not depend on the
+ * device which was used in the ur_dev argument, we process this
+ * before trying to map the device to an alsa device */
+
+ if (field == MUS_AUDIO_PORT)
+ {
+ /* under 0.9 we only advertise at most two devices, one for playback
+ and another one for capture */
+ /* int dev; */
+ int i = 1;
+ if (alsa_hw_params[SND_PCM_STREAM_PLAYBACK])
+ val[i++] = (float)to_sndlib_device(0, SND_PCM_STREAM_PLAYBACK);
+
+ if (alsa_hw_params[SND_PCM_STREAM_CAPTURE])
+ val[i++] = (float)to_sndlib_device(0, SND_PCM_STREAM_CAPTURE);
+
+ val[0]=(float)(i - 1);
+ return(MUS_NO_ERROR);
+ }
+ /* map the mus device to an alsa device and channel */
+ if ((err = to_alsa_device(device, &alsa_device, &alsa_stream)) < 0)
+ {
+ /* FIXME: snd-dac still probes some non-existing devices, specifically
+ * MUS_AUDIO_DAC_FILTER, do not report error till that's fixed */
+ if (alsa_trace)
+ {
+ mus_print("%s: cannot translate device %s<%d> to alsa, field=%s<%d>",
+ snd_strerror(err),
+ mus_audio_device_name(device), device,
+ mus_audio_device_name(field), field);
+ }
+ return(MUS_ERROR);
+ }
+ if (alsa_trace) mus_print("%s: adev=%d, achan=%d", c__FUNCTION__, alsa_device, alsa_stream);
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ /* amplitude value */
+ val[0] = 1.0;
+ break;
+ case MUS_AUDIO_SAMPLES_PER_CHANNEL:
+ /* samples per channel */
+ if (card > 0 || alsa_device > 0)
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ, NULL));
+ else
+ {
+ val[0] = (float)alsa_samples_per_channel;
+ if (chan > 1)
+ {
+#if HAVE_NEW_ALSA
+ snd_pcm_uframes_t tmp = 0;
+ snd_pcm_hw_params_get_buffer_size_min(alsa_hw_params[alsa_stream], &tmp);
+ val[1] = (float)tmp;
+ snd_pcm_hw_params_get_buffer_size_max(alsa_hw_params[alsa_stream], &tmp);
+ val[2] = (float)tmp;
+#else
+ val[1] = (float)snd_pcm_hw_params_get_buffer_size_min(alsa_hw_params[alsa_stream]);
+ val[2] = (float)snd_pcm_hw_params_get_buffer_size_max(alsa_hw_params[alsa_stream]);
+#endif
+ }
+ }
+ break;
+ case MUS_AUDIO_CHANNEL:
+ /* number of channels */
+ if (card > 0 || alsa_device > 0)
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ, NULL));
+ else
+ {
+
+ if ((alsa_stream == SND_PCM_STREAM_CAPTURE) &&
+ (alsa_capture_device_name) &&
+ (strcmp(alsa_capture_device_name, "default") == 0))
+ {
+ val[0] = 2;
+ }
+ else
+ {
+
+#if HAVE_NEW_ALSA
+ unsigned int max_channels = 0;
+ snd_pcm_hw_params_get_channels_max(alsa_hw_params[alsa_stream], &max_channels);
+#else
+ int max_channels = snd_pcm_hw_params_get_channels_max(alsa_hw_params[alsa_stream]);
+#endif
+ if ((alsa_stream == SND_PCM_STREAM_CAPTURE) &&
+ (max_channels > alsa_max_capture_channels))
+ {
+ /* limit number of capture channels to a reasonable maximum, if the user
+ specifies a plug pcm as the capture pcm then the returned number of channels
+ would be MAXINT (or whatever the name is for a really big number). At this
+ point there is no support in the alsa api to distinguish between default
+ parameters or those that have been set by a user on purpose, of for querying
+ the hardware pcm device that is hidden by the plug device to see what is the
+ real number of channels for the device we are dealing with. We could also try
+ to flag this as an error to the user and exit the program */
+ max_channels = alsa_max_capture_channels;
+ }
+ val[0] = (float)max_channels;
+ if (chan > 1)
+ {
+#if HAVE_NEW_ALSA
+ unsigned int tmp = 0;
+ snd_pcm_hw_params_get_channels_min(alsa_hw_params[alsa_stream], &tmp);
+ val[1] = (float)tmp;
+#else
+ val[1] = (float)snd_pcm_hw_params_get_channels_min(alsa_hw_params[alsa_stream]);
+#endif
+ val[2] = (float)max_channels;
+ }
+ }
+ }
+ break;
+ case MUS_AUDIO_SRATE:
+ /* supported sample rates */
+ if (card > 0 || alsa_device > 0)
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ, NULL));
+ else
+ {
+ int dir = 0;
+ val[0] = 44100;
+ if (chan > 1)
+ {
+#if HAVE_NEW_ALSA
+ unsigned int tmp;
+ snd_pcm_hw_params_get_rate_min(alsa_hw_params[alsa_stream], &tmp, &dir);
+ val[1] = (float)tmp;
+ snd_pcm_hw_params_get_rate_max(alsa_hw_params[alsa_stream], &tmp, &dir);
+ val[2] = (float)tmp;
+#else
+ val[1] = (float)snd_pcm_hw_params_get_rate_min(alsa_hw_params[alsa_stream], &dir);
+ val[2] = (float)snd_pcm_hw_params_get_rate_max(alsa_hw_params[alsa_stream], &dir);
+#endif
+ }
+ }
+ break;
+ case MUS_AUDIO_FORMAT:
+ /* supported formats */
+ if (card > 0 || alsa_device > 0)
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ, NULL));
+ else
+ {
+ int format;
+ snd_pcm_format_mask_t *mask;
+ snd_pcm_format_mask_alloca(&mask);
+ snd_pcm_hw_params_get_format_mask(alsa_hw_params[alsa_stream], mask);
+ for (format = 0, f = 1; format < SND_PCM_FORMAT_LAST; format++)
+ {
+ err = snd_pcm_format_mask_test(mask, (snd_pcm_format_t)format);
+ if (err > 0)
+ {
+ if ((f < chan) &&
+ (to_mus_format(format)!=MUS_ERROR))
+ val[f++] = (float)to_mus_format(format);
+ }
+ }
+ val[0] = f - 1;
+ }
+ break;
+ case MUS_AUDIO_DIRECTION:
+ /* direction of this device */
+ if (card > 0 || alsa_device > 0)
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ, NULL));
+ else
+ {
+ /* 0-->playback, 1-->capture */
+ val[0] = (float)alsa_stream;
+ }
+ break;
+ default:
+ return(alsa_mus_error(MUS_AUDIO_CANT_READ, NULL));
+ break;
+ }
+ return(MUS_NO_ERROR);
+}
+
+static int alsa_mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ return(MUS_NO_ERROR);
+}
+
+static void alsa_describe_audio_state_1(void)
+{
+ int err;
+ char *str;
+ size_t len;
+ snd_config_t *conf;
+ snd_output_t *buf = NULL;
+#if (SND_LIB_MAJOR == 0) || ((SND_LIB_MAJOR == 1) && (SND_LIB_MINOR == 0) && (SND_LIB_SUBMINOR < 8))
+ return; /* avoid Alsa bug */
+#endif
+ err = snd_config_update();
+ if (err < 0)
+ {
+ mus_print("snd_config_update: %s", snd_strerror(err));
+ return;
+ }
+ err = snd_output_buffer_open(&buf);
+ if (err < 0)
+ mus_print("could not open dump buffer: %s", snd_strerror(err));
+ else
+ {
+ err = snd_config_search(snd_config, "pcm", &conf);
+ if (err < 0)
+ {
+ mus_print("snd_config_search: could not find at least one pcm: %s", snd_strerror(err));
+ return;
+ }
+ snd_output_puts(buf, "PCM list:\n");
+ snd_config_save(conf, buf);
+ snd_output_putc(buf, '\0');
+ len = snd_output_buffer_string(buf, &str);
+ if (len > 1)
+ pprint(str);
+ snd_output_close(buf);
+ }
+}
+
+#endif /* HAVE_ALSA */
+
+
+/* -------------------------------- SUN -------------------------------- */
+/*
+ * Thanks to Seppo Ingalsuo for several bugfixes.
+ * record case improved after perusal of Snack 1.6/src/jkAudio_sun.c
+ */
+
+/* apparently input other than 8000 is 16-bit, 8000 is (?) mulaw */
+
+#if (defined(MUS_SUN) || defined(MUS_OPENBSD)) && (!(defined(AUDIO_OK)))
+#define AUDIO_OK
+
+#include <sys/types.h>
+#include <stropts.h>
+#include <sys/filio.h>
+
+#ifdef SUNOS
+#include <sun/audioio.h>
+#else
+#include <sys/audioio.h>
+#endif
+#if HAVE_SYS_MIXER_H
+#include <sys/mixer.h>
+#endif
+
+int mus_audio_initialize(void) {return(MUS_NO_ERROR);}
+int mus_audio_systems(void) {return(1);}
+char *mus_audio_system_name(int system) {return("Sun");}
+
+static int sun_default_outputs = (AUDIO_HEADPHONE | AUDIO_LINE_OUT | AUDIO_SPEAKER);
+
+void mus_sun_set_outputs(int speakers, int headphones, int line_out)
+{
+ sun_default_outputs = 0;
+ if (speakers) sun_default_outputs |= AUDIO_SPEAKER;
+ if (headphones) sun_default_outputs |= AUDIO_HEADPHONE;
+ if (line_out) sun_default_outputs |= AUDIO_LINE_OUT;
+}
+
+
+#ifdef MUS_OPENBSD
+ #define DAC_NAME "/dev/sound"
+#else
+ #define DAC_NAME "/dev/audio"
+#endif
+#define AUDIODEV_ENV "AUDIODEV"
+
+#define RETURN_ERROR_EXIT(Error_Type, Audio_Line, Ur_Error_Message) \
+ do { char *Error_Message; Error_Message = Ur_Error_Message; \
+ if (Audio_Line != -1) close(Audio_Line); \
+ if (Error_Message) \
+ {MUS_STANDARD_ERROR(Error_Type, Error_Message); FREE(Error_Message);} \
+ else MUS_STANDARD_ERROR(Error_Type, mus_error_type_to_string(Error_Type)); \
+ return(MUS_ERROR); \
+ } while (false)
+
+char *mus_audio_moniker(void)
+{
+#ifndef AUDIO_DEV_AMD
+ struct audio_device ad;
+#else
+ int ad;
+#endif
+ int audio_fd, err;
+ char *dev_name;
+ if (getenv(AUDIODEV_ENV) != NULL)
+ dev_name = getenv(AUDIODEV_ENV);
+ else dev_name = DAC_NAME;
+ audio_fd = open(dev_name, O_RDONLY | O_NONBLOCK, 0);
+ if (audio_fd == -1)
+ {
+ audio_fd = open("/dev/audioctl", O_RDONLY | O_NONBLOCK, 0);
+ if (audio_fd == -1) return("sun probably");
+ }
+ err = ioctl(audio_fd, AUDIO_GETDEV, &ad);
+ if (err == -1)
+ {
+ close(audio_fd);
+ return("sun?");
+ }
+ mus_audio_close(audio_fd);
+#if HAVE_SYS_MIXER_H
+ if (version_name == NULL) version_name = (char *)CALLOC(PRINT_BUFFER_SIZE, sizeof(char));
+#else
+ if (version_name == NULL) version_name = (char *)CALLOC(LABEL_BUFFER_SIZE, sizeof(char));
+#endif
+#ifndef AUDIO_DEV_AMD
+ #if HAVE_SYS_MIXER_H
+ mus_snprintf(version_name, PRINT_BUFFER_SIZE,
+ "audio: %s (%s), %s %s %s",
+ ad.name, ad.version,
+ MIXER_NAME, MIXER_VERSION, MIXER_CONFIGURATION);
+ #else
+ mus_snprintf(version_name, LABEL_BUFFER_SIZE, "audio: %s (%s)", ad.name, ad.version);
+ #endif
+#else
+ switch (ad)
+ {
+ case AUDIO_DEV_AMD: mus_snprintf(version_name, LABEL_BUFFER_SIZE, "audio: amd"); break;
+ #ifdef AUDIO_DEV_CS4231
+ case AUDIO_DEV_CS4231: mus_snprintf(version_name, LABEL_BUFFER_SIZE, "audio: cs4231"); break;
+ #endif
+ case AUDIO_DEV_SPEAKERBOX: mus_snprintf(version_name, LABEL_BUFFER_SIZE, "audio: speakerbox"); break;
+ case AUDIO_DEV_CODEC: mus_snprintf(version_name, LABEL_BUFFER_SIZE, "audio: codec"); break;
+ default: mus_snprintf(version_name, LABEL_BUFFER_SIZE, "audio: unknown"); break;
+ }
+#endif
+ return(version_name);
+}
+
+static int to_sun_format(int format)
+{
+ switch (format)
+ {
+#if MUS_LITTLE_ENDIAN
+ case MUS_LSHORT: /* Solaris on Intel? */
+#else
+ case MUS_BSHORT:
+#endif
+#ifdef MUS_OPENBSD
+ return(AUDIO_ENCODING_PCM16);
+#else
+ return(AUDIO_ENCODING_LINEAR);
+#endif
+ break;
+ case MUS_BYTE:
+#if defined(AUDIO_ENCODING_LINEAR8)
+ return(AUDIO_ENCODING_LINEAR8); break;
+#else
+ #ifdef MUS_OPENBSD
+ return(AUDIO_ENCODING_PCM8);
+ #else
+ return(AUDIO_ENCODING_LINEAR);
+ #endif
+ break;
+#endif
+ case MUS_MULAW: return(AUDIO_ENCODING_ULAW); break;
+ case MUS_ALAW: return(AUDIO_ENCODING_ALAW); break;
+ /* there's also AUDIO_ENCODING_DVI */
+ }
+ return(MUS_ERROR);
+}
+
+int mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size)
+{
+ struct audio_info info;
+ char *dev_name;
+ int encode, bits, dev;
+ int audio_fd, err;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ encode = to_sun_format(format);
+ if (encode == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, -1,
+ mus_format("format %d (%s) not available",
+ format,
+ mus_data_format_name(format)));
+ if (getenv(AUDIODEV_ENV) != NULL)
+ dev_name = getenv(AUDIODEV_ENV);
+ else dev_name = DAC_NAME;
+ if (dev != MUS_AUDIO_DUPLEX_DEFAULT)
+ audio_fd = open(dev_name, O_WRONLY, 0);
+ else audio_fd = open(dev_name, O_RDWR, 0);
+ if (audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, -1,
+ mus_format("can't open output %s: %s",
+ dev_name, strerror(errno)));
+ AUDIO_INITINFO(&info);
+ if (dev == MUS_AUDIO_LINE_OUT)
+ info.play.port = AUDIO_LINE_OUT;
+ else
+ {
+ if (dev == MUS_AUDIO_SPEAKERS)
+ /* OR may not be available */
+ info.play.port = AUDIO_SPEAKER | (sun_default_outputs & AUDIO_HEADPHONE);
+ else
+ info.play.port = sun_default_outputs;
+ }
+ info.play.sample_rate = srate;
+ info.play.channels = chans;
+ bits = 8 * mus_bytes_per_sample(format);
+ info.play.precision = bits;
+ info.play.encoding = encode;
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
+ if (err == -1)
+ {
+ ioctl(audio_fd, AUDIO_GETINFO, &info);
+
+ if ((int)info.play.channels != chans)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_fd,
+ mus_format("can't set output %s (%s) channels to %d",
+ mus_audio_device_name(dev), dev_name, chans));
+
+ if (((int)info.play.precision != bits) ||
+ ((int)info.play.encoding != encode))
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, audio_fd,
+ mus_format("can't set output %s (%s) format to %d bits, %d encode (%s)",
+ mus_audio_device_name(dev), dev_name,
+ bits, encode,
+ mus_data_format_name(format)));
+
+ if ((int)info.play.sample_rate != srate)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_fd,
+ mus_format("can't set output %s (%s) srate to %d",
+ mus_audio_device_name(dev), dev_name, srate));
+ }
+ /* man audio sez the play.buffer_size field is not currently supported */
+ /* but since the default buffer size is 8180! we need ioctl(audio_fd, I_SETSIG, ...) */
+ ioctl(audio_fd, I_FLUSH, FLUSHR);
+ return(audio_fd);
+}
+
+int mus_audio_write(int line, char *buf, int bytes)
+{
+ if (write(line, buf, bytes) != bytes)
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("write error: %s", strerror(errno)));
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_close(int line)
+{
+ write(line, (char *)NULL, 0);
+ close(line);
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_read(int line, char *buf, int bytes)
+{
+ int total = 0;
+ char *curbuf;
+ /* ioctl(line, AUDIO_DRAIN, NULL) */
+ /* this seems to return 8-12 bytes fewer than requested -- perverse! */
+ /* should I buffer data internally? */
+
+ /* apparently we need to loop here ... */
+ curbuf = buf;
+ while (total < bytes)
+ {
+ int bytes_available;
+ ioctl(line, FIONREAD, &bytes_available);
+ if (bytes_available > 0)
+ {
+ int bytes_read;
+ if ((total + bytes_available) > bytes) bytes_available = bytes - total;
+ bytes_read = read(line, curbuf, bytes_available);
+ if (bytes_read > 0)
+ {
+ total += bytes_read;
+ curbuf = (char *)(buf + total);
+ }
+ /* else return anyway?? */
+ }
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_open_input(int ur_dev, int srate, int chans, int format, int size)
+{
+ struct audio_info info;
+ int indev, encode, bits, dev, audio_fd, err;
+ char *dev_name;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ encode = to_sun_format(format);
+ bits = 8 * mus_bytes_per_sample(format);
+ if (encode == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, -1,
+ mus_format("format %d bits, %d encode (%s) not available",
+ bits, encode,
+ mus_data_format_name(format)));
+ if (getenv(AUDIODEV_ENV) != NULL)
+ dev_name = getenv(AUDIODEV_ENV);
+ else dev_name = DAC_NAME;
+ if (dev != MUS_AUDIO_DUPLEX_DEFAULT)
+ audio_fd = open(dev_name, O_RDONLY, 0);
+ else audio_fd = open(dev_name, O_RDWR, 0);
+ if (audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, -1,
+ mus_format("can't open input %s: %s",
+ dev_name, strerror(errno)));
+ AUDIO_INITINFO(&info);
+ /* ioctl(audio_fd, AUDIO_GETINFO, &info); */
+ info.record.sample_rate = srate;
+ info.record.channels = chans;
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, audio_fd,
+ mus_format("can't set srate %d and chans %d for input %s (%s)",
+ srate, chans,
+ dev_name,
+ mus_audio_device_name(dev)));
+ ioctl(audio_fd, AUDIO_GETINFO, &info);
+ if (info.record.sample_rate != (unsigned int)srate)
+ mus_print("%s[%d]: sampling rate: %d != %d\n",
+ __FILE__, __LINE__,
+ info.record.sample_rate, srate);
+ if (info.record.channels != (unsigned int)chans)
+ mus_print("%s[%d]: channels: %d != %d\n",
+ __FILE__, __LINE__,
+ info.record.channels, chans);
+
+ info.record.precision = bits; /* was play, changed 10-Jul-03 thanks to Jürgen Keil */
+ info.record.encoding = encode;
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, audio_fd,
+ mus_format("can't set bits %d, encode %d (format %s) for input %s (%s)",
+ bits, encode, mus_data_format_name(format),
+ dev_name,
+ mus_audio_device_name(dev)));
+ ioctl(audio_fd, AUDIO_GETINFO, &info);
+
+ /* these cannot be OR'd */
+ if (dev == MUS_AUDIO_LINE_IN)
+ indev = AUDIO_LINE_IN;
+ else
+ {
+ if (dev == MUS_AUDIO_CD)
+ indev = AUDIO_INTERNAL_CD_IN;
+ else indev = AUDIO_MICROPHONE;
+ }
+ info.record.port = indev;
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't set record.port to %d for %s (%s)",
+ indev, dev_name,
+ mus_audio_device_name(dev)));
+ err = ioctl(audio_fd, AUDIO_GETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't getinfo on input %s (%s, line: %d)",
+ dev_name,
+ mus_audio_device_name(dev), audio_fd));
+ else
+ {
+ if ((int)info.record.port != indev)
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, audio_fd,
+ mus_format("confusion in record.port: %d != %d (%s: %s)",
+ (int)info.record.port, indev,
+ dev_name,
+ mus_audio_device_name(dev)));
+ if ((int)info.record.channels != chans)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_fd,
+ mus_format("confusion in record.channels: %d != %d (%s: %s)",
+ (int)info.record.channels, chans,
+ dev_name,
+ mus_audio_device_name(dev)));
+ if (((int)info.record.precision != bits) ||
+ ((int)info.record.encoding != encode))
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, audio_fd,
+ mus_format("confusion in record.precision|encoding: %d != %d or %d != %d (%s: %s)",
+ (int)info.record.precision, bits,
+ (int)info.record.encoding, encode,
+ dev_name,
+ mus_audio_device_name(dev)));
+ }
+ /* this may be a bad idea */
+ info.record.buffer_size = size;
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't set buffer size to %d on input %s (%s)",
+ size,
+ dev_name,
+ mus_audio_device_name(dev)));
+ return(audio_fd);
+}
+
+int mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+#ifndef AUDIO_DEV_AMD
+ struct audio_device ad;
+#else
+ int ad;
+#endif
+ int audio_fd, err;
+ struct audio_info info;
+ int dev, port;
+ char *dev_name;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ AUDIO_INITINFO(&info);
+ if (getenv(AUDIODEV_ENV) != NULL)
+ dev_name = getenv(AUDIODEV_ENV);
+ else dev_name = DAC_NAME;
+ audio_fd = open(dev_name, O_RDONLY | O_NONBLOCK, 0);
+ if (audio_fd == -1)
+ {
+ audio_fd = open("/dev/audioctl", O_RDONLY | O_NONBLOCK);
+ if (audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, -1,
+ mus_format("can't open %s or /dev/audioctl: %s",
+ dev_name, strerror(errno)));
+ else dev_name = "/dev/audioctl";
+ }
+ err = ioctl(audio_fd, AUDIO_GETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't get %s (%s) info",
+ dev_name,
+ mus_audio_device_name(dev)));
+ if (field == MUS_AUDIO_PORT)
+ {
+ /* info.play|record have a field avail_ports */
+ port = 1;
+ if ((chan > port) &&
+ (info.record.avail_ports & AUDIO_MICROPHONE))
+ {
+ val[port] = MUS_AUDIO_MICROPHONE;
+ port++;
+ }
+ if ((chan > port) &&
+ (info.record.avail_ports & AUDIO_LINE_IN))
+ {
+ val[port] = MUS_AUDIO_LINE_IN;
+ port++;
+ }
+#ifndef AUDIO_DEV_AMD
+ if ((chan > port) &&
+ (info.record.avail_ports & AUDIO_INTERNAL_CD_IN))
+ {
+ /* this field lies -- there is no such port available on the Ultra */
+ err = ioctl(audio_fd, AUDIO_GETDEV, &ad);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't get device info on %s (%s)",
+ dev_name,
+ mus_audio_device_name(dev)));
+ if (((ad.version) && (strcmp(ad.version, "a") == 0)) || /* is it a SparcStation? */
+ ((ad.name) && (strcmp(ad.name, "SUNW,CS4231") == 0)))
+ {
+ val[port] = MUS_AUDIO_CD;
+ port++;
+ }
+ }
+#endif
+ if ((chan > port) &&
+ (info.play.avail_ports & AUDIO_SPEAKER))
+ {
+ val[port] = MUS_AUDIO_SPEAKERS;
+ port++;
+ }
+ if ((chan > port) &&
+ (info.play.avail_ports & AUDIO_LINE_OUT))
+ {
+ val[port] = MUS_AUDIO_LINE_OUT;
+ port++;
+ }
+ if ((chan > port) &&
+ (info.play.avail_ports & AUDIO_HEADPHONE))
+ {
+ val[port] = MUS_AUDIO_DAC_OUT;
+ port++;
+ }
+ val[0] = port - 1;
+ }
+ else
+ {
+ if (field == MUS_AUDIO_FORMAT) /* this actually depends on the audio device */
+ {
+ err = ioctl(audio_fd, AUDIO_GETDEV, &ad); /* SUNW, dbri|am79c30|CS4231|sbpro|sb16 */
+ /* Jurgen Keil's drivers use SUNW,CS4231, but the "real" names are:
+ "TOOLS,sbpci" SoundBlaster PCI card
+ "TOOLS,EMU10Kx" SoundBlaster Live! or Audigy
+ "TOOLS,i810" Intel i8xx audio (and compatible)
+ "TOOLS,via686" VIA 686 audio
+ "TOOLS,via8233" VIA 8233 (and compatible)
+ */
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't get data format info for %s (%s)",
+ dev_name,
+ mus_audio_device_name(dev)));
+ port = 1;
+ if ((ad.name) &&
+ (strcmp(ad.name, "SUNW,audio810") == 0))
+ {
+ val[0] = 1;
+ val[1] = MUS_MULAW;
+ }
+ else
+ {
+#ifndef AUDIO_DEV_AMD
+ if ((ad.name) &&
+ (strcmp(ad.name, "SUNW, am79c30") != 0))
+#else
+ if (ad == AUDIO_DEV_AMD)
+#endif
+ {
+ if (chan > port) val[port++] = MUS_BSHORT;
+ }
+#ifndef AUDIO_DEV_AMD
+ if ((ad.name) &&
+ (strcmp(ad.name, "SUNW, sbpro") != 0) &&
+ (strcmp(ad.name, "SUNW, sb16") != 0))
+ {
+ if (chan > port) val[port++] = MUS_ALAW;
+ }
+#endif
+ if (chan > port) val[port++] = MUS_MULAW;
+#if MUS_LITTLE_ENDIAN
+ if (chan > port) val[port++] = MUS_LSHORT;
+#endif
+ val[0] = port - 1;
+ }
+ }
+ else
+ {
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DAC_OUT:
+ case MUS_AUDIO_SPEAKERS:
+ case MUS_AUDIO_LINE_OUT:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ /* who knows how this really works? documentation is incomplete, actual behavior seems to be: */
+ if (chan == 0)
+ {
+ if (info.play.balance <= (AUDIO_RIGHT_BALANCE / 2))
+ val[0] = info.play.gain / (float)(AUDIO_MAX_GAIN);
+ else val[0] = info.play.gain * (AUDIO_RIGHT_BALANCE - info.play.balance) / (float)(AUDIO_MAX_GAIN * (AUDIO_RIGHT_BALANCE / 2));
+ }
+ else
+ {
+ if (info.play.balance >= (AUDIO_RIGHT_BALANCE / 2))
+ val[0] = info.play.gain / (float)(AUDIO_MAX_GAIN);
+ else val[0] = info.play.gain * info.play.balance / (float)(AUDIO_MAX_GAIN * (AUDIO_RIGHT_BALANCE / 2));
+ }
+ break;
+ case MUS_AUDIO_CHANNEL:
+ val[0] = 2;
+ break;
+ /* appears to depend on data format (mulaw is mono) */
+ case MUS_AUDIO_SRATE:
+ val[0] = (float)info.play.sample_rate;
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't read %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ break;
+ }
+ break;
+ case MUS_AUDIO_MICROPHONE:
+ case MUS_AUDIO_LINE_IN:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ case MUS_AUDIO_CD:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ if (chan == 0)
+ {
+ if (info.record.balance <= (AUDIO_RIGHT_BALANCE / 2))
+ val[0] = info.record.gain / (float)(AUDIO_MAX_GAIN);
+ else val[0] = info.record.gain * (AUDIO_RIGHT_BALANCE - info.record.balance) / (float)(AUDIO_MAX_GAIN * (AUDIO_RIGHT_BALANCE / 2));
+ }
+ else
+ {
+ if (info.record.balance >= (AUDIO_RIGHT_BALANCE / 2))
+ val[0] = info.record.gain / (float)(AUDIO_MAX_GAIN);
+ else val[0] = info.record.gain * info.record.balance / (float)(AUDIO_MAX_GAIN * (AUDIO_RIGHT_BALANCE / 2));
+ }
+ break;
+
+ case MUS_AUDIO_CHANNEL:
+ val[0] = 1;
+ break;
+ case MUS_AUDIO_SRATE:
+ val[0] = (float)(info.record.sample_rate);
+ break;
+ case MUS_AUDIO_IGAIN:
+ val[0] = (float)(info.monitor_gain) / (float)AUDIO_MAX_GAIN;
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't read %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ break;
+ }
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't read %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ break;
+ }
+ }
+ }
+ return(mus_audio_close(audio_fd));
+}
+
+int mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ struct audio_info info;
+ int dev, balance, gain;
+ float ratio, lc, rc;
+ int audio_fd, err;
+ char *dev_name;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ AUDIO_INITINFO(&info);
+ if (getenv(AUDIODEV_ENV) != NULL)
+ dev_name = getenv(AUDIODEV_ENV);
+ else dev_name = DAC_NAME;
+ audio_fd = open(dev_name, O_RDWR | O_NONBLOCK, 0);
+ if (audio_fd == -1)
+ {
+ audio_fd = open("/dev/audioctl", O_RDWR | O_NONBLOCK);
+ if (audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, -1,
+ mus_format("can't write fields of %s (or /dev/audioctl) (%s): %s",
+ dev_name,
+ mus_audio_device_name(dev),
+ strerror(errno)));
+ else dev_name = "/dev/audioctl";
+ }
+ err = ioctl(audio_fd, AUDIO_GETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't get %s (%s) info",
+ dev_name,
+ mus_audio_device_name(dev)));
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DAC_OUT:
+ case MUS_AUDIO_SPEAKERS:
+ case MUS_AUDIO_LINE_OUT:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ balance = info.play.balance;
+ gain = info.play.gain;
+ if (balance <= (AUDIO_RIGHT_BALANCE / 2))
+ {
+ lc = gain;
+ rc = gain * balance / (float)(AUDIO_RIGHT_BALANCE / 2);
+ }
+ else
+ {
+ lc = gain * (AUDIO_RIGHT_BALANCE - balance) / (float)(AUDIO_RIGHT_BALANCE / 2);
+ rc = gain;
+ }
+ if (chan == 0)
+ lc = AUDIO_MAX_GAIN * val[0];
+ else rc = AUDIO_MAX_GAIN * val[0];
+ if ((rc + lc) == 0)
+ info.play.gain = 0;
+ else
+ {
+ ratio = (float)rc / (float)(rc + lc);
+ info.play.balance = (unsigned char)(AUDIO_RIGHT_BALANCE * ratio);
+ if (rc > lc)
+ info.play.gain = (int)rc;
+ else info.play.gain = (int)lc;
+ }
+ break;
+ case MUS_AUDIO_CHANNEL:
+ info.play.channels = (int)val[0];
+ break;
+ /* amd device only mono */
+ case MUS_AUDIO_SRATE:
+ info.play.sample_rate = (int)val[0];
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't write %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ break;
+ }
+ break;
+ case MUS_AUDIO_MICROPHONE:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ info.record.gain = (int)(AUDIO_MAX_GAIN * val[0]);
+ info.record.balance = 0;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ info.record.channels = (int)val[0];
+ break;
+ case MUS_AUDIO_SRATE:
+ info.record.sample_rate = (int)val[0];
+ break;
+ case MUS_AUDIO_IGAIN:
+ info.monitor_gain = (int)(AUDIO_MAX_GAIN * val[0]);
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't write %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ break;
+ }
+ break;
+ case MUS_AUDIO_LINE_IN:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ case MUS_AUDIO_CD:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ balance = info.record.balance;
+ gain = info.record.gain;
+ lc = gain * (float)(AUDIO_RIGHT_BALANCE - balance) / (float)AUDIO_RIGHT_BALANCE;
+ rc = gain - lc;
+ if (chan == 0)
+ lc = AUDIO_MAX_GAIN * val[0];
+ else rc = AUDIO_MAX_GAIN * val[0];
+ gain = (int)(rc + lc);
+ if (gain == 0)
+ info.record.gain = 0;
+ else
+ {
+ info.record.balance = (unsigned char)(AUDIO_RIGHT_BALANCE * ((float)rc / (float)(rc + lc)));
+ if (rc > lc)
+ info.record.gain = (int)rc;
+ else info.record.gain = (int)lc;
+ }
+ break;
+ case MUS_AUDIO_CHANNEL:
+ info.record.channels = (int)val[0];
+ break;
+ case MUS_AUDIO_SRATE:
+ info.record.sample_rate = (int)val[0];
+ break;
+ case MUS_AUDIO_IGAIN:
+ info.monitor_gain = (int)(AUDIO_MAX_GAIN * val[0]);
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't write %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ break;
+ }
+ break;
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't write %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ break;
+ }
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't write %s field %d (%s) after explicit set",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ return(mus_audio_close(audio_fd));
+}
+
+/* pause can be implemented with play.pause and record.pause */
+
+static char *sun_format_name(int format)
+{
+ switch (format)
+ {
+#ifdef AUDIO_ENCODING_ALAW
+ case AUDIO_ENCODING_ALAW: return("alaw"); break;
+#endif
+#ifdef AUDIO_ENCODING_ULAW
+ case AUDIO_ENCODING_ULAW: return("ulaw"); break;
+#endif
+#ifdef AUDIO_ENCODING_DVI
+ case AUDIO_ENCODING_DVI: return("dvi adpcm"); break;
+#endif
+#ifdef AUDIO_ENCODING_LINEAR8
+ case AUDIO_ENCODING_LINEAR8: return("linear"); break;
+#else
+ #ifdef AUDIO_ENCODING_PCM8
+ case AUDIO_ENCODING_PCM8: return("linear"); break;
+ #endif
+#endif
+#ifdef AUDIO_ENCODING_LINEAR
+ case AUDIO_ENCODING_LINEAR: return("linear"); break;
+#else
+ #ifdef AUDIO_ENCODING_PCM16
+ case AUDIO_ENCODING_PCM16: return("linear"); break;
+ #endif
+#endif
+#ifdef AUDIO_ENCODING_NONE
+ case AUDIO_ENCODING_NONE: return("not audio"); break; /* dbri interface configured for something else */
+#endif
+ }
+ return("unknown");
+}
+
+static char *sun_in_device_name(int dev)
+{
+ if (dev == AUDIO_MICROPHONE) return("microphone");
+ if (dev == AUDIO_LINE_IN) return("line in");
+ if (dev == AUDIO_INTERNAL_CD_IN) return("cd");
+ if (dev == (AUDIO_MICROPHONE | AUDIO_LINE_IN)) return("microphone + line in");
+ if (dev == (AUDIO_MICROPHONE | AUDIO_LINE_IN | AUDIO_INTERNAL_CD_IN)) return("microphone + line in + cd");
+ if (dev == (AUDIO_MICROPHONE | AUDIO_INTERNAL_CD_IN)) return("microphone + cd");
+ if (dev == (AUDIO_LINE_IN | AUDIO_INTERNAL_CD_IN)) return("line in + cd");
+ return("unknown");
+}
+
+static char *sun_out_device_name(int dev)
+{
+ if (dev == AUDIO_SPEAKER) return("speakers");
+ if (dev == AUDIO_LINE_OUT) return("line out");
+ if (dev == AUDIO_HEADPHONE) return("headphones");
+ if (dev == (AUDIO_SPEAKER | AUDIO_LINE_OUT)) return("speakers + line out");
+ if (dev == (AUDIO_SPEAKER | AUDIO_LINE_OUT | AUDIO_HEADPHONE)) return("speakers + line out + headphones");
+ if (dev == (AUDIO_SPEAKER | AUDIO_HEADPHONE)) return("speakers + headphones");
+ if (dev == (AUDIO_LINE_OUT | AUDIO_HEADPHONE)) return("line out + headphones");
+ return("unknown");
+}
+
+static char *sun_vol_name = NULL;
+static char *sun_volume_name(float vol, int balance, int chans)
+{
+ if (sun_vol_name == NULL) sun_vol_name = (char *)CALLOC(LABEL_BUFFER_SIZE, sizeof(char));
+ if (chans != 2)
+ mus_snprintf(sun_vol_name, LABEL_BUFFER_SIZE, "%.3f", vol);
+ else
+ {
+ mus_snprintf(sun_vol_name, LABEL_BUFFER_SIZE, "%.3f %.3f",
+ vol * (float)(AUDIO_RIGHT_BALANCE - balance) / (float)AUDIO_RIGHT_BALANCE,
+ vol * (float)balance / (float)AUDIO_RIGHT_BALANCE);
+ }
+ return(sun_vol_name);
+}
+
+static void describe_audio_state_1(void)
+{
+ struct audio_info info;
+#ifndef AUDIO_DEV_AMD
+ struct audio_device ad;
+#else
+ int ad;
+#endif
+ int audio_fd, err;
+ char *dev_name;
+ AUDIO_INITINFO(&info);
+ if (getenv(AUDIODEV_ENV) != NULL)
+ dev_name = getenv(AUDIODEV_ENV);
+ else dev_name = DAC_NAME;
+ audio_fd = open(dev_name, O_RDONLY | O_NONBLOCK, 0);
+ if (audio_fd == -1)
+ audio_fd = open("/dev/audioctl", O_RDONLY | O_NONBLOCK, 0);
+ if (audio_fd == -1) return;
+ err = ioctl(audio_fd, AUDIO_GETINFO, &info);
+ if (err == -1) return;
+ err = ioctl(audio_fd, AUDIO_GETDEV, &ad);
+ if (err == -1) return;
+ pprint(mus_audio_moniker());
+ pprint("\n");
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "output: %s\n srate: %d, vol: %s, chans: %d, format %d-bit %s\n",
+ sun_out_device_name(info.play.port),
+ info.play.sample_rate,
+ sun_volume_name((float)info.play.gain / (float)AUDIO_MAX_GAIN, info.play.balance, 2),
+ info.play.channels,
+ info.play.precision,
+ sun_format_name(info.play.encoding));
+ pprint(audio_strbuf);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "input: %s\n srate: %d, vol: %s, chans: %d, format %d-bit %s\n",
+ sun_in_device_name(info.record.port),
+ info.record.sample_rate,
+ sun_volume_name((float)info.record.gain / (float)AUDIO_MAX_GAIN, info.record.balance, 2),
+ info.record.channels,
+ info.record.precision,
+ sun_format_name(info.record.encoding));
+ pprint(audio_strbuf);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "input->output vol: %.3f\n", (float)info.monitor_gain / (float)AUDIO_MAX_GAIN);
+ pprint(audio_strbuf);
+ if (info.play.pause) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "Playback is paused\n"); pprint(audio_strbuf);}
+ if (info.record.pause) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "Recording is paused\n"); pprint(audio_strbuf);}
+ if (info.output_muted) {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "Output is muted\n"); pprint(audio_strbuf);}
+#ifdef AUDIO_HWFEATURE_DUPLEX
+ if (info.hw_features == AUDIO_HWFEATURE_DUPLEX)
+ {mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "Simultaneous play and record supported\n"); pprint(audio_strbuf);}
+#endif
+#if HAVE_SYS_MIXER_H
+ {
+ int i, num = 0, choice;
+ #define LARGE_NUMBER 100
+ am_sample_rates_t *sr = NULL;
+ for (choice = 0; choice < 2; choice++)
+ {
+ for (num = 4; num < LARGE_NUMBER; num += 2)
+ {
+ sr = (am_sample_rates_t *)
+ malloc(AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(num));
+ sr->num_samp_rates = num;
+ sr->type = (choice == 0) ? AUDIO_PLAY : AUDIO_RECORD;
+ err = ioctl(audio_fd, AUDIO_MIXER_GET_SAMPLE_RATES, sr);
+ if ((int)(sr->num_samp_rates) <= num) break;
+ free(sr);
+ sr = NULL;
+ }
+ if (sr)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%s srates:", (choice == 0) ? "play" : "record");
+ pprint(audio_strbuf);
+ if (sr->type == MIXER_SR_LIMITS)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %d to %d", sr->samp_rates[0], sr->samp_rates[sr->num_samp_rates - 1]);
+ pprint(audio_strbuf);
+ }
+ else
+ {
+ for (i = 0; i < (int)(sr->num_samp_rates); i++)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %d", sr->samp_rates[i]);
+ pprint(audio_strbuf);
+ }
+ }
+ pprint("\n");
+ }
+ free(sr);
+ sr = NULL;
+ }
+ }
+#endif
+ mus_audio_close(audio_fd);
+}
+
+#endif
+
+
+
+/* ------------------------------- WINDOZE ----------------------------------------- */
+
+#if defined(MUS_WINDOZE) && (!(defined(__CYGWIN__)))
+#define AUDIO_OK
+
+#include <windows.h>
+#include <mmsystem.h>
+
+#define BUFFER_FILLED 1
+#define BUFFER_EMPTY 2
+
+#define OUTPUT_LINE 1
+#define INPUT_LINE 2
+
+#define SOUND_UNREADY 0
+#define SOUND_INITIALIZED 1
+#define SOUND_RUNNING 2
+
+static int buffer_size = 1024;
+static int db_state[2];
+static int sound_state = 0;
+static int current_chans = 1;
+static int current_datum_size = 2;
+static int current_buf = 0;
+WAVEHDR wh[2];
+HWAVEOUT fd;
+HWAVEIN record_fd;
+WAVEHDR rec_wh;
+static int rec_state = SOUND_UNREADY;
+
+static MMRESULT win_in_err = 0, win_out_err = 0;
+static char errstr[128], getstr[128];
+
+static char *win_err_buf = NULL;
+static mus_print_handler_t *old_handler;
+
+static void win_mus_print(char *msg)
+{
+ if ((win_in_err == 0) && (win_out_err == 0))
+ (*old_handler)(msg);
+ else
+ {
+ if (win_in_err)
+ waveInGetErrorText(win_in_err, getstr, PRINT_BUFFER_SIZE);
+ else waveOutGetErrorText(win_out_err, getstr, PRINT_BUFFER_SIZE);
+ mus_snprintf(errstr, PRINT_BUFFER_SIZE, "%s [%s]", msg, getstr);
+ (*old_handler)(errstr);
+ }
+}
+
+static void start_win_print(void)
+{
+ if (old_handler != win_mus_print)
+ old_handler = mus_print_set_handler(win_mus_print);
+}
+
+static void end_win_print(void)
+{
+ if (old_handler == win_mus_print)
+ mus_print_set_handler(NULL);
+ else mus_print_set_handler(old_handler);
+}
+
+#define RETURN_ERROR_EXIT(Error_Type, Ur_Error_Message) \
+ do { char *Error_Message; Error_Message = Ur_Error_Message; \
+ if (Error_Message) \
+ {MUS_STANDARD_ERROR(Error_Type, Error_Message); FREE(Error_Message);} \
+ else MUS_STANDARD_ERROR(Error_Type, mus_error_type_to_string(Error_Type)); \
+ end_win_print(); \
+ return(MUS_ERROR); \
+ } while (false)
+
+int mus_audio_systems(void)
+{
+ /* this number is available -- see below (user mixer number as in linux)->mixerGetNumDevs */
+ return(1);
+}
+char *mus_audio_system_name(int system) {return("Windoze");}
+
+DWORD CALLBACK next_buffer(HWAVEOUT w, UINT msg, DWORD user_data, DWORD p1, DWORD p2)
+{
+ if (msg == WOM_DONE)
+ {
+ db_state[current_buf] = BUFFER_EMPTY;
+ }
+ return(0);
+}
+
+int mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size)
+{
+ WAVEFORMATEX wf;
+ int dev;
+ start_win_print();
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ wf.nChannels = chans;
+ current_chans = chans;
+ wf.wFormatTag = WAVE_FORMAT_PCM;
+ wf.cbSize = 0;
+ if (format == MUS_UBYTE)
+ {
+ wf.wBitsPerSample = 8;
+ current_datum_size = 1;
+ }
+ else
+ {
+ wf.wBitsPerSample = 16;
+ current_datum_size = 2;
+ }
+ wf.nSamplesPerSec = srate;
+ wf.nBlockAlign = chans * current_datum_size;
+ wf.nAvgBytesPerSec = wf.nBlockAlign * wf.nSamplesPerSec;
+ win_out_err = waveOutOpen(&fd, WAVE_MAPPER, &wf, (DWORD)next_buffer, 0, CALLBACK_FUNCTION); /* 0 here = user_data above, other case = WAVE_FORMAT_QUERY */
+ if (win_out_err)
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE,
+ mus_format("can't open %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+ waveOutPause(fd);
+ if (size <= 0)
+ buffer_size = 1024;
+ else buffer_size = size;
+ wh[0].dwBufferLength = buffer_size * current_datum_size;
+ wh[0].dwFlags = 0;
+ wh[0].dwLoops = 0;
+ wh[0].lpData = (char *)CALLOC(wh[0].dwBufferLength, sizeof(char));
+ if ((wh[0].lpData) == 0)
+ {
+ waveOutClose(fd);
+ RETURN_ERROR_EXIT(MUS_AUDIO_SIZE_NOT_AVAILABLE,
+ mus_format("can't allocate buffer size %d for output %d (%s)",
+ buffer_size, dev,
+ mus_audio_device_name(dev)));
+ }
+ win_out_err = waveOutPrepareHeader(fd, &(wh[0]), sizeof(WAVEHDR));
+ if (win_out_err)
+ {
+ FREE(wh[0].lpData);
+ waveOutClose(fd);
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("can't setup output 'header' for %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+ }
+ db_state[0] = BUFFER_EMPTY;
+ wh[1].dwBufferLength = buffer_size * current_datum_size;
+ wh[1].dwFlags = 0;
+ wh[1].dwLoops = 0;
+ wh[1].lpData = (char *)CALLOC(wh[0].dwBufferLength, sizeof(char));
+ if ((wh[1].lpData) == 0)
+ {
+ FREE(wh[0].lpData);
+ waveOutClose(fd);
+ RETURN_ERROR_EXIT(MUS_AUDIO_SIZE_NOT_AVAILABLE,
+ mus_format("can't allocate buffer size %d for output %d (%s)",
+ buffer_size, dev,
+ mus_audio_device_name(dev)));
+ }
+ win_out_err = waveOutPrepareHeader(fd, &(wh[1]), sizeof(WAVEHDR));
+ if (win_out_err)
+ {
+ waveOutUnprepareHeader(fd, &(wh[0]), sizeof(WAVEHDR));
+ FREE(wh[0].lpData);
+ FREE(wh[1].lpData);
+ waveOutClose(fd);
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("can't setup output 'header' for %d (%s)",
+ dev,
+ mus_audio_device_name(dev)));
+ }
+ db_state[1] = BUFFER_EMPTY;
+ sound_state = SOUND_INITIALIZED;
+ current_buf = 0;
+ end_win_print();
+ return(OUTPUT_LINE);
+}
+
+static MMRESULT fill_buffer(int dbi, char *inbuf, int instart, int bytes)
+{
+ int i, j;
+ win_out_err = 0;
+ if (sound_state == SOUND_UNREADY) return(0);
+ for (i = instart, j = 0; j < bytes; j++, i++)
+ wh[dbi].lpData[j] = inbuf[i];
+ wh[dbi].dwBufferLength = bytes;
+ db_state[dbi] = BUFFER_FILLED;
+ if ((sound_state == SOUND_INITIALIZED) &&
+ (dbi == 1))
+ {
+ sound_state = SOUND_RUNNING;
+ win_out_err = waveOutRestart(fd);
+ }
+ return(win_out_err);
+}
+
+static void wait_for_empty_buffer(int buf)
+{
+ while (db_state[buf] != BUFFER_EMPTY)
+ {
+ Sleep(1); /* in millisecs, so even this may be too much if buf = 256 bytes */
+ }
+}
+
+int mus_audio_write(int line, char *buf, int bytes)
+{
+ int lim, leftover, start;
+ start_win_print();
+ if (line != OUTPUT_LINE)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE,
+ mus_format("write error: line %d != %d?",
+ line, OUTPUT_LINE));
+ win_out_err = 0;
+ leftover = bytes;
+ start = 0;
+ if (sound_state == SOUND_UNREADY)
+ {
+ end_win_print();
+ return(MUS_NO_ERROR);
+ }
+ while (leftover > 0)
+ {
+ lim = leftover;
+ if (lim > buffer_size) lim = buffer_size;
+ leftover -= lim;
+ wait_for_empty_buffer(current_buf);
+ win_out_err = fill_buffer(current_buf, buf, start, lim);
+ if (win_out_err)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE,
+ mus_format("write error on %d",
+ line));
+ win_out_err = waveOutWrite(fd, &wh[current_buf], sizeof(WAVEHDR));
+ if (win_out_err)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE,
+ mus_format("write error on %d",
+ line));
+ start += lim;
+ current_buf++;
+ if (current_buf > 1) current_buf = 0;
+ }
+ return(MUS_NO_ERROR);
+}
+
+static float unlog(unsigned short val)
+{
+ /* 1.0 linear is 0xffff, rest is said to be "logarithmic", whatever that really means here */
+ if (val == 0) return(0.0);
+ return((float)val / 65536.0);
+ /* return(pow(2.0, amp) - 1.0); */ /* doc seems to be bogus */
+}
+
+#define SRATE_11025_BITS (WAVE_FORMAT_1S16 | WAVE_FORMAT_1S08 | WAVE_FORMAT_1M16 | WAVE_FORMAT_1M08)
+#define SRATE_22050_BITS (WAVE_FORMAT_2S16 | WAVE_FORMAT_2S08 | WAVE_FORMAT_2M16 | WAVE_FORMAT_2M08)
+#define SRATE_44100_BITS (WAVE_FORMAT_4S16 | WAVE_FORMAT_4S08 | WAVE_FORMAT_4M16 | WAVE_FORMAT_4M08)
+#define SHORT_SAMPLE_BITS (WAVE_FORMAT_1S16 | WAVE_FORMAT_1M16 | WAVE_FORMAT_2S16 | WAVE_FORMAT_2M16 | WAVE_FORMAT_4S16 | WAVE_FORMAT_4M16)
+#define BYTE_SAMPLE_BITS (WAVE_FORMAT_1S08 | WAVE_FORMAT_1M08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_2M08 | WAVE_FORMAT_4S08 | WAVE_FORMAT_4M08)
+
+static char *mixer_status_name(int status)
+{
+ switch (status)
+ {
+ case MIXERLINE_LINEF_ACTIVE: return(", (active)"); break;
+ case MIXERLINE_LINEF_DISCONNECTED: return(", (disconnected)"); break;
+ case MIXERLINE_LINEF_SOURCE: return(", (source)"); break;
+ default: return(""); break;
+ }
+}
+
+static char *mixer_target_name(int type)
+{
+ switch (type)
+ {
+ case MIXERLINE_TARGETTYPE_UNDEFINED: return("undefined"); break;
+ case MIXERLINE_TARGETTYPE_WAVEOUT: return("output"); break;
+ case MIXERLINE_TARGETTYPE_WAVEIN: return("input"); break;
+ case MIXERLINE_TARGETTYPE_MIDIOUT: return("midi output"); break;
+ case MIXERLINE_TARGETTYPE_MIDIIN: return("midi input"); break;
+ case MIXERLINE_TARGETTYPE_AUX: return("aux"); break;
+ default: return(""); break;
+ }
+}
+
+static char *mixer_component_name(int type)
+{
+ switch (type)
+ {
+ case MIXERLINE_COMPONENTTYPE_DST_UNDEFINED: return("undefined"); break;
+ case MIXERLINE_COMPONENTTYPE_DST_DIGITAL: return("digital"); break;
+ case MIXERLINE_COMPONENTTYPE_DST_LINE: return("line"); break;
+ case MIXERLINE_COMPONENTTYPE_DST_MONITOR: return("monitor"); break;
+ case MIXERLINE_COMPONENTTYPE_DST_SPEAKERS: return("speakers"); break;
+ case MIXERLINE_COMPONENTTYPE_DST_HEADPHONES: return("headphones"); break;
+ case MIXERLINE_COMPONENTTYPE_DST_TELEPHONE: return("telephone"); break;
+ case MIXERLINE_COMPONENTTYPE_DST_WAVEIN: return("wave in"); break;
+ case MIXERLINE_COMPONENTTYPE_DST_VOICEIN: return("voice in"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED: return("undefined"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_DIGITAL: return("digital"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_LINE: return("line"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE: return("mic"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER: return("synth"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC: return("CD"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE: return("telephone"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER: return("speaker"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT: return("wave out"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY: return("aux"); break;
+ case MIXERLINE_COMPONENTTYPE_SRC_ANALOG: return("analog"); break;
+ default: return(""); break;
+ }
+}
+
+#define MAX_DESCRIBE_CHANS 8
+#define MAX_DESCRIBE_CONTROLS 16
+/* these actually need to be big enough to handle whatever comes along, since we can't read partial states */
+/* or they need to be expanded as necessary */
+
+char *mus_audio_moniker(void) {return("MS audio");} /* version number of some sort? */
+
+static void describe_audio_state_1(void)
+{
+ int devs, dev, srate, chans, format, need_comma, maker;
+ MMRESULT err;
+ unsigned long val, rate, pitch, version;
+ WAVEOUTCAPS wocaps;
+ WAVEINCAPS wicaps;
+ AUXCAPS wacaps;
+ HWAVEOUT hd;
+ WAVEFORMATEX pwfx;
+#ifdef MIXERR_BASE
+ MIXERCAPS wmcaps;
+ MIXERLINE mixline;
+ MIXERLINECONTROLS linecontrols;
+ MIXERCONTROL mc[MAX_DESCRIBE_CONTROLS];
+ MIXERCONTROLDETAILS controldetails;
+ MIXERCONTROLDETAILS_LISTTEXT clist[MAX_DESCRIBE_CHANS];
+ MIXERCONTROLDETAILS_BOOLEAN cbool[MAX_DESCRIBE_CHANS];
+ MIXERCONTROLDETAILS_UNSIGNED cline[MAX_DESCRIBE_CHANS];
+ MIXERCONTROLDETAILS_SIGNED csign[MAX_DESCRIBE_CHANS];
+ HMIXER mfd;
+ int control, controls, dest, dests, source, happy, dest_time, chan, mina, maxa, ctype;
+#endif
+ need_comma = 1;
+ chans = 1;
+ devs = waveOutGetNumDevs();
+ if (devs > 0)
+ {
+ pprint("Output:\n");
+ for (dev = 0; dev < devs; dev++)
+ {
+ err = waveOutGetDevCaps(dev, &wocaps, sizeof(wocaps));
+ if (!err)
+ {
+ version = wocaps.vDriverVersion;
+ maker = wocaps.wMid;
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s: version %d.%d\n",
+ wocaps.szPname, version >> 8, version & 0xff);
+ pprint(audio_strbuf);
+ if (wocaps.wChannels == 2) {chans = 2; pprint(" stereo");} else {chans = 1; pprint(" mono");}
+ if (wocaps.dwFormats & SRATE_11025_BITS) {srate = 11025; if (need_comma) pprint(", "); pprint(" 11025"); need_comma = 1;}
+ if (wocaps.dwFormats & SRATE_22050_BITS) {srate = 22050; if (need_comma) pprint(", "); pprint(" 22050"); need_comma = 1;}
+ if (wocaps.dwFormats & SRATE_44100_BITS) {srate = 44100; if (need_comma) pprint(", "); pprint(" 44100"); need_comma = 1;}
+ if (wocaps.dwFormats & BYTE_SAMPLE_BITS) {format = 8; if (need_comma) pprint(", "); pprint(" unsigned byte"); need_comma = 1;}
+ if (wocaps.dwFormats & SHORT_SAMPLE_BITS) {format = 16; if (need_comma) pprint(", "); pprint(" little-endian short"); need_comma = 1;}
+ if (need_comma) pprint("\n");
+ need_comma = 0;
+ pwfx.wFormatTag = WAVE_FORMAT_PCM;
+ pwfx.nChannels = chans;
+ pwfx.nSamplesPerSec = srate;
+ pwfx.nAvgBytesPerSec = srate;
+ pwfx.nBlockAlign = 1;
+ pwfx.wBitsPerSample = format;
+
+ err = waveOutOpen(&hd, dev, &pwfx, 0, 0, WAVE_FORMAT_QUERY);
+
+ if (wocaps.dwSupport & WAVECAPS_VOLUME)
+ {
+ err = waveOutGetVolume(hd, &val);
+ if (!err)
+ {
+ if (wocaps.dwSupport & WAVECAPS_LRVOLUME)
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ " vol: %.3f %.3f",
+ unlog((unsigned short)(val >> 16)),
+ unlog((unsigned short)(val & 0xffff)));
+ else mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ " vol: %.3f",
+ unlog((unsigned short)(val & 0xffff)));
+ pprint(audio_strbuf);
+ need_comma = 1;
+ }
+ }
+ if (!err)
+ {
+ /* this is just to get the hd data for subsequent info */
+ if (wocaps.dwSupport & WAVECAPS_PLAYBACKRATE)
+ {
+ err = waveOutGetPlaybackRate(hd, &rate);
+ if (!err)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ "%s playback rate: %.3f",
+ (need_comma ? ", " : ""),
+ (float)rate / 65536.0);
+ pprint(audio_strbuf);
+ need_comma = 1;
+ }
+ }
+ if (wocaps.dwSupport & WAVECAPS_PITCH)
+ {
+ err = waveOutGetPitch(hd, &pitch);
+ if (!err)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ "%s pitch: %.3f",
+ (need_comma ? ", " : ""),
+ (float)pitch / 65536.0);
+ pprint(audio_strbuf);
+ need_comma = 1;
+ }
+ }
+ waveOutClose(hd);
+ }
+ if (need_comma) {need_comma = 0; pprint("\n");}
+ }
+ }
+ }
+ devs = waveInGetNumDevs();
+ if (devs > 0)
+ {
+ pprint("Input:\n");
+ for (dev = 0; dev < devs; dev++)
+ {
+ err = waveInGetDevCaps(dev, &wicaps, sizeof(wicaps));
+ if (!err)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s", wicaps.szPname);
+ pprint(audio_strbuf);
+ if ((wicaps.wMid != maker) || (version != wicaps.vDriverVersion))
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, ": version %d.%d\n",
+ (wicaps.vDriverVersion >> 8),
+ wicaps.vDriverVersion & 0xff);
+ pprint(audio_strbuf);
+ }
+ else pprint("\n");
+ if (wicaps.wChannels == 2) pprint(" stereo"); else pprint(" mono");
+ if (wicaps.dwFormats & SRATE_11025_BITS) {pprint(", 11025"); need_comma = 1;}
+ if (wicaps.dwFormats & SRATE_22050_BITS) {if (need_comma) pprint(", "); pprint(" 22050"); need_comma = 1;}
+ if (wicaps.dwFormats & SRATE_44100_BITS) {if (need_comma) pprint(", "); pprint(" 44100"); need_comma = 1;}
+ if (wicaps.dwFormats & BYTE_SAMPLE_BITS) {if (need_comma) pprint(", "); pprint(" unsigned byte"); need_comma = 1;}
+ if (wicaps.dwFormats & SHORT_SAMPLE_BITS) {if (need_comma) pprint(", "); pprint(" little-endian short");}
+ pprint("\n");
+ }
+ }
+ }
+ devs = auxGetNumDevs();
+ if (devs > 0)
+ {
+ pprint("Auxiliary:\n");
+ for (dev = 0; dev < devs; dev++)
+ {
+ err = auxGetDevCaps(dev, &wacaps, sizeof(wacaps));
+ if (!err)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s", wacaps.szPname);
+ pprint(audio_strbuf);
+ if ((wacaps.wMid != maker) || (version != wacaps.vDriverVersion))
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, ": version %d.%d%s",
+ (wacaps.vDriverVersion >> 8), wacaps.vDriverVersion & 0xff,
+ (wacaps.wTechnology & AUXCAPS_CDAUDIO) ? " (CD)" : "");
+ else mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%s\n", (wacaps.wTechnology & AUXCAPS_CDAUDIO) ? " (CD)" : "");
+ pprint(audio_strbuf);
+ if (wacaps.dwSupport & AUXCAPS_VOLUME)
+ {
+ err = auxGetVolume(dev, &val);
+ if (!err)
+ {
+ if (wacaps.dwSupport & AUXCAPS_LRVOLUME)
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ " vol: %.3f %.3f\n",
+ unlog((unsigned short)(val >> 16)),
+ unlog((unsigned short)(val & 0xffff)));
+ else mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ " vol: %.3f\n",
+ unlog((unsigned short)(val & 0xffff)));
+ pprint(audio_strbuf);
+ }
+ }
+ }
+ }
+ }
+#ifdef MIXERR_BASE
+ devs = mixerGetNumDevs();
+ if (devs > 0)
+ {
+ pprint("Mixer:\n");
+ for (dev = 0; dev < devs; dev++)
+ {
+ err = mixerGetDevCaps(dev, &wmcaps, sizeof(wmcaps));
+ if (!err)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s", wmcaps.szPname);
+ pprint(audio_strbuf);
+ if ((wmcaps.wMid != maker) || (version != wmcaps.vDriverVersion))
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ ": version %d.%d\n",
+ (wmcaps.vDriverVersion >> 8),
+ wmcaps.vDriverVersion & 0xff);
+ pprint(audio_strbuf);
+ }
+ else pprint("\n");
+ dests = wmcaps.cDestinations;
+
+ err = mixerOpen(&mfd, dev, 0, 0, CALLBACK_NULL);
+ if (!err)
+ {
+ dest = 0;
+ source = 0;
+ dest_time = 1;
+ happy = 1;
+ while (happy)
+ {
+ if (dest_time)
+ {
+ mixline.dwDestination = dest;
+ mixline.cbStruct = sizeof(MIXERLINE);
+ err = mixerGetLineInfo((HMIXEROBJ)mfd, &mixline, MIXER_GETLINEINFOF_DESTINATION);
+ }
+ else
+ {
+ mixline.dwSource = source;
+ mixline.cbStruct = sizeof(MIXERLINE);
+ err = mixerGetLineInfo((HMIXEROBJ)mfd, &mixline, MIXER_GETLINEINFOF_SOURCE);
+ }
+ if (!err)
+ {
+ if ((source == 0) && (!dest_time)) pprint(" Sources:\n");
+ if ((dest == 0) && (dest_time)) pprint(" Destinations:\n");
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s: %s (%s), %d chan%s",
+ mixline.szName,
+ mixer_component_name(mixline.dwComponentType),
+ mixer_target_name(mixline.Target.dwType),
+
+ mixline.cChannels, ((mixline.cChannels != 1) ? "s" : ""));
+ pprint(audio_strbuf);
+ if (mixline.cConnections > 0)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, ", %d connection%s",
+ mixline.cConnections, ((mixline.cConnections != 1) ? "s" : ""));
+ pprint(audio_strbuf);
+ }
+ if (dest_time)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%s\n", mixer_status_name(mixline.fdwLine));
+ pprint(audio_strbuf);
+ }
+ else pprint("\n");
+ if (mixline.cControls > 0)
+ {
+ linecontrols.cbStruct = sizeof(MIXERLINECONTROLS);
+ linecontrols.dwLineID = mixline.dwLineID;
+ linecontrols.dwControlID = MIXER_GETLINECONTROLSF_ONEBYID;
+ if (mixline.cControls > MAX_DESCRIBE_CONTROLS)
+ linecontrols.cControls = MAX_DESCRIBE_CONTROLS;
+ else linecontrols.cControls = mixline.cControls;
+ linecontrols.pamxctrl = mc;
+ linecontrols.cbmxctrl = sizeof(MIXERCONTROL);
+ err = mixerGetLineControls((HMIXEROBJ)mfd, &linecontrols, MIXER_GETLINECONTROLSF_ALL);
+ if (!err)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE,
+ " %d control%s:\n",
+ linecontrols.cControls,
+ (linecontrols.cControls != 1) ? "s" : "");
+ pprint(audio_strbuf);
+ controls = linecontrols.cControls;
+ if (controls > MAX_DESCRIBE_CONTROLS) controls = MAX_DESCRIBE_CONTROLS;
+ for (control = 0; control < controls; control++)
+ {
+
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s", mc[control].szName);
+ pprint(audio_strbuf);
+ controldetails.cbStruct = sizeof(MIXERCONTROLDETAILS);
+ controldetails.dwControlID = mc[control].dwControlID;
+
+ ctype = (mc[control].dwControlType);
+ if ((ctype == MIXERCONTROL_CONTROLTYPE_EQUALIZER) ||
+ (ctype == MIXERCONTROL_CONTROLTYPE_MUX) ||
+ (ctype == MIXERCONTROL_CONTROLTYPE_MIXER) ||
+ (ctype == MIXERCONTROL_CONTROLTYPE_SINGLESELECT) ||
+ (ctype == MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT))
+ {
+ controldetails.cChannels = 1;
+ controldetails.cMultipleItems = mc[control].cMultipleItems;
+ controldetails.cbDetails = sizeof(MIXERCONTROLDETAILS_LISTTEXT);
+ controldetails.paDetails = clist;
+ err = mixerGetControlDetails((HMIXEROBJ)mfd, &controldetails, MIXER_GETCONTROLDETAILSF_LISTTEXT);
+ if (!err)
+ {
+ for (chan = 0; chan < mixline.cChannels; chan++)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " [%s]", clist[chan].szName);
+ pprint(audio_strbuf);
+ }
+ }
+ }
+ if (mixline.cChannels > MAX_DESCRIBE_CHANS)
+ controldetails.cChannels = MAX_DESCRIBE_CHANS;
+ else controldetails.cChannels = mixline.cChannels;
+ controldetails.cMultipleItems = 0;
+ err = 0;
+ switch (mc[control].dwControlType & MIXERCONTROL_CT_UNITS_MASK)
+ {
+ case MIXERCONTROL_CT_UNITS_BOOLEAN:
+ controldetails.cbDetails = sizeof(MIXERCONTROLDETAILS_BOOLEAN);
+ controldetails.paDetails = cbool;
+ break;
+ case MIXERCONTROL_CT_UNITS_SIGNED: case MIXERCONTROL_CT_UNITS_DECIBELS:
+ controldetails.cbDetails = sizeof(MIXERCONTROLDETAILS_SIGNED);
+ controldetails.paDetails = csign;
+ break;
+ case MIXERCONTROL_CT_UNITS_UNSIGNED: case MIXERCONTROL_CT_UNITS_PERCENT:
+ controldetails.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
+ controldetails.paDetails = cline;
+ break;
+ default: err = 1; break;
+ }
+ if (err)
+ pprint("\n");
+ else
+ {
+ err = mixerGetControlDetails((HMIXEROBJ)mfd, &controldetails, MIXER_GETCONTROLDETAILSF_VALUE);
+ if (!err)
+ {
+ chans = controldetails.cChannels;
+ if (chans > MAX_DESCRIBE_CHANS) chans = MAX_DESCRIBE_CHANS;
+ switch (mc[control].dwControlType & MIXERCONTROL_CT_UNITS_MASK)
+ {
+ case MIXERCONTROL_CT_UNITS_BOOLEAN:
+ for (chan = 0; chan < chans; chan++)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s", (cbool[chan].fValue) ? " on" : " off");
+ pprint(audio_strbuf);
+ }
+ break;
+ case MIXERCONTROL_CT_UNITS_SIGNED: case MIXERCONTROL_CT_UNITS_DECIBELS:
+ mina = mc[control].Bounds.lMinimum;
+ maxa = mc[control].Bounds.lMaximum;
+ if (maxa > mina)
+ {
+ for (chan = 0; chan < chans; chan++)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.3f",
+ (float)(csign[chan].lValue - mina) / (float)(maxa - mina));
+ pprint(audio_strbuf);
+ }
+ }
+ break;
+ case MIXERCONTROL_CT_UNITS_UNSIGNED: case MIXERCONTROL_CT_UNITS_PERCENT:
+ mina = mc[control].Bounds.dwMinimum;
+ maxa = mc[control].Bounds.dwMaximum;
+ if (maxa > mina)
+ {
+ for (chan = 0; chan < chans; chan++)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %.3f",
+ (float)(cline[chan].dwValue - mina) / (float)(maxa - mina));
+ pprint(audio_strbuf);
+ }
+ }
+ break;
+ default: break;
+ }
+ pprint("\n");
+ }
+ else pprint("\n");
+ }
+ }
+ }
+ }
+ }
+ else if (!dest_time) happy = 0;
+ if (dest_time) dest++; else source++;
+ if (dest == dests) dest_time = 0;
+ }
+ }
+ mixerClose(mfd);
+ }
+ }
+ }
+#endif
+}
+
+int mus_audio_initialize(void)
+{
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_close(int line)
+{
+ int i;
+ win_out_err = 0;
+ win_in_err = 0;
+ if (line == OUTPUT_LINE)
+ {
+ /* fill with a few zeros, wait for empty flag */
+ if (sound_state != SOUND_UNREADY)
+ {
+ wait_for_empty_buffer(current_buf);
+ for (i = 0; i < 128; i++) wh[current_buf].lpData[i] = 0;
+ wait_for_empty_buffer(current_buf);
+ win_out_err = waveOutClose(fd);
+ i = 0;
+ while (win_out_err == WAVERR_STILLPLAYING)
+ {
+ Sleep(1);
+ win_out_err = waveOutClose(fd);
+ i++;
+ if (i > 1024) break;
+ }
+ db_state[0] = BUFFER_EMPTY;
+ db_state[1] = BUFFER_EMPTY;
+ sound_state = SOUND_UNREADY;
+ waveOutUnprepareHeader(fd, &(wh[0]), sizeof(WAVEHDR));
+ waveOutUnprepareHeader(fd, &(wh[1]), sizeof(WAVEHDR));
+ FREE(wh[0].lpData);
+ FREE(wh[1].lpData);
+ if (win_out_err)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_CLOSE,
+ mus_format("close failed on %d",
+ line));
+ }
+ }
+ else
+ {
+ if (line == INPUT_LINE)
+ {
+ if (rec_state != SOUND_UNREADY)
+ {
+ waveInReset(record_fd);
+ waveInClose(record_fd);
+ waveInUnprepareHeader(record_fd, &rec_wh, sizeof(WAVEHDR));
+ if (rec_wh.lpData)
+ {
+ FREE(rec_wh.lpData);
+ rec_wh.lpData = NULL;
+ }
+ rec_state = SOUND_UNREADY;
+ }
+ }
+ else
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_CLOSE,
+ mus_format("can't close unrecognized line %d",
+ line));
+ }
+ return(MUS_NO_ERROR);
+}
+
+ /*
+ * waveInAddBuffer sends buffer to get data
+ * MM_WIM_DATA lParam->WAVEHDR dwBytesRecorded =>how much data actually in buffer
+ */
+
+static int current_record_chans = 0, current_record_datum_size = 0;
+
+DWORD CALLBACK next_input_buffer(HWAVEIN w, UINT msg, DWORD user_data, DWORD p1, DWORD p2)
+{
+ if (msg == WIM_DATA)
+ {
+ /* grab data */
+ /* p1->dwBytesRecorded */
+ }
+ return(0);
+}
+
+int mus_audio_open_input(int ur_dev, int srate, int chans, int format, int size)
+{
+ WAVEFORMATEX wf;
+ int dev;
+ win_in_err = 0;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ wf.nChannels = chans;
+ current_record_chans = chans;
+
+ wf.wFormatTag = WAVE_FORMAT_PCM;
+ wf.cbSize = 0;
+ if (format == MUS_UBYTE)
+ {
+ wf.wBitsPerSample = 8;
+ current_record_datum_size = 1;
+ }
+ else
+ {
+ wf.wBitsPerSample = 16;
+ current_record_datum_size = 2;
+ }
+ wf.nSamplesPerSec = srate;
+ wf.nBlockAlign = chans * current_datum_size;
+ wf.nAvgBytesPerSec = wf.nBlockAlign * wf.nSamplesPerSec;
+
+ rec_wh.dwBufferLength = size * current_record_datum_size;
+ rec_wh.dwFlags = 0;
+ rec_wh.dwLoops = 0;
+ rec_wh.lpData = (char *)CALLOC(rec_wh.dwBufferLength, sizeof(char));
+ if ((rec_wh.lpData) == 0)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SIZE_NOT_AVAILABLE,
+ mus_format("can't allocated %d bytes for input buffer of %d (%s)",
+ size, dev, mus_audio_device_name(dev)));
+ win_in_err = waveInOpen(&record_fd, WAVE_MAPPER, &wf, (DWORD)next_input_buffer, 0, CALLBACK_FUNCTION);
+ if (win_in_err)
+ {
+ FREE(rec_wh.lpData);
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE,
+ mus_format("can't open input device %d (%s)",
+ dev, mus_audio_device_name(dev)));
+ }
+ win_in_err = waveInPrepareHeader(record_fd, &(rec_wh), sizeof(WAVEHDR));
+ if (win_in_err)
+ {
+ FREE(rec_wh.lpData);
+ waveInClose(record_fd);
+ RETURN_ERROR_EXIT(MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ mus_format("can't prepare input 'header' for %d (%s)",
+ dev, mus_audio_device_name(dev)));
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_read(int line, char *buf, int bytes)
+{
+ win_in_err = 0;
+ return(MUS_ERROR);
+}
+
+int mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ int dev, sys;
+ unsigned long lval;
+ MMRESULT err;
+ sys = MUS_AUDIO_SYSTEM(ur_dev);
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ if (field == MUS_AUDIO_AMP)
+ {
+ err = auxGetVolume(sys, &lval);
+ if (!err)
+ {
+ if (chan == 0)
+ val[0] = unlog((unsigned short)(lval >> 16));
+ else val[0] = unlog((unsigned short)(lval & 0xffff));
+ return(MUS_NO_ERROR);
+ }
+ }
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ,
+ mus_format("can't read device %d (%s) field %s",
+ dev, mus_audio_device_name(dev),
+ mus_audio_device_name(field)));
+}
+
+int mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ int dev, sys;
+ unsigned long lval;
+ MMRESULT err;
+ sys = MUS_AUDIO_SYSTEM(ur_dev);
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ if (field == MUS_AUDIO_AMP)
+ {
+ err = auxGetVolume(sys, &lval);
+ if (!err)
+ {
+ if (chan == 0)
+ lval = (unsigned long)((lval & 0xffff) | (((unsigned short)(val[0] * 65535)) << 16));
+ else lval = (unsigned long)((lval & 0xffff0000) | ((unsigned short)(val[0] * 65535)));
+ err = auxSetVolume(sys, lval);
+ if (err) return(MUS_NO_ERROR);
+ }
+ }
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE,
+ mus_format("can't set device %d (%s) field %s",
+ dev, mus_audio_device_name(dev),
+ mus_audio_device_name(field)));
+}
+
+#endif
+
+
+
+/* ------------------------------- OSX ----------------------------------------- */
+
+/* this code based primarily on the CoreAudio headers and portaudio pa_mac_core.c,
+ * and to a much lesser extent, coreaudio.pdf and the HAL/Daisy examples.
+ */
+
+#ifdef MUS_MAC_OSX
+#define AUDIO_OK 1
+
+/*
+#include <CoreServices/CoreServices.h>
+#include <CoreAudio/CoreAudio.h>
+*/
+/* ./System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h */
+
+static char* osx_error(OSStatus err)
+{
+ if (err == noErr) return("no error");
+ switch (err)
+ {
+ case kAudioHardwareNoError: return("no error"); break;
+ case kAudioHardwareUnspecifiedError: return("unspecified audio hardware error"); break;
+ case kAudioHardwareNotRunningError: return("audio hardware not running"); break;
+ case kAudioHardwareUnknownPropertyError: return("unknown property"); break;
+ case kAudioHardwareBadPropertySizeError: return("bad property"); break;
+ case kAudioHardwareBadDeviceError: return("bad device"); break;
+ case kAudioHardwareBadStreamError: return("bad stream"); break;
+ case kAudioHardwareIllegalOperationError: return("illegal operation"); break;
+ case kAudioDeviceUnsupportedFormatError: return("unsupported format"); break;
+ case kAudioDevicePermissionsError: return("device permissions error"); break;
+ }
+ return("unknown error");
+}
+
+char *device_name(AudioDeviceID deviceID, int input_case)
+{
+ OSStatus err = noErr;
+ UInt32 size = 0, msize = 0, trans = 0, trans_size = 0;
+ char *name = NULL, *mfg = NULL, *full_name = NULL;
+ err = AudioDeviceGetPropertyInfo(deviceID, 0, false, kAudioDevicePropertyDeviceName, &size, NULL);
+ if (err == noErr) err = AudioDeviceGetPropertyInfo(deviceID, 0, false, kAudioDevicePropertyDeviceManufacturer, &msize, NULL);
+ if (err == noErr)
+ {
+ name = (char *)MALLOC(size + 2);
+ err = AudioDeviceGetProperty(deviceID, 0, input_case, kAudioDevicePropertyDeviceName, &size, name);
+ mfg = (char *)MALLOC(msize + 2);
+ err = AudioDeviceGetProperty(deviceID, 0, input_case, kAudioDevicePropertyDeviceManufacturer, &msize, mfg);
+ full_name = (char *)MALLOC(size + msize + 4);
+#if HAVE_KAUDIODEVICEPROPERTYTRANSPORTTYPE
+ trans_size = sizeof(UInt32);
+ err = AudioDeviceGetProperty(deviceID, 0, input_case, kAudioDevicePropertyTransportType, &trans_size, &trans);
+ if (err != noErr)
+#endif
+ trans = 0;
+ if (trans == 0)
+ mus_snprintf(full_name, size + msize + 4, "\n %s: %s", mfg, name);
+ else mus_snprintf(full_name, size + msize + 4, "\n %s: %s ('%c%c%c%c')",
+ mfg, name,
+ (char)((trans >> 24) & 0xff), (char)((trans >> 16) & 0xff), (char)((trans >> 8) & 0xff), (char)(trans & 0xff));
+ FREE(name);
+ FREE(mfg);
+ }
+ return(full_name);
+}
+
+static int max_chans_via_stream_configuration(AudioDeviceID device, bool input_case)
+{
+ /* apparently MOTU 828 has to be different (this code from portaudio) */
+ UInt32 size = 0;
+ Boolean writable;
+ OSStatus err = noErr;
+ err = AudioDeviceGetPropertyInfo(device, 0, input_case, kAudioDevicePropertyStreamConfiguration, &size, &writable);
+ if (err == noErr)
+ {
+ AudioBufferList *list;
+ list = (AudioBufferList *)malloc(size);
+ err = AudioDeviceGetProperty(device, 0, input_case, kAudioDevicePropertyStreamConfiguration, &size, list);
+ if (err == noErr)
+ {
+ int chans = 0, i;
+ for (i = 0; i < list->mNumberBuffers; i++)
+ chans += list->mBuffers[i].mNumberChannels;
+ free(list);
+ return(chans);
+ }
+ }
+ return(-1);
+}
+
+static void describe_audio_state_1(void)
+{
+ OSStatus err = noErr;
+ UInt32 num_devices = 0, msize = 0, size = 0, buffer_size = 0, mute = 0, alive = 0;
+ Float32 vol;
+ int i, j, k;
+ pid_t hogger = 0;
+ AudioDeviceID *devices = NULL;
+ AudioDeviceID device, default_output, default_input;
+ AudioStreamBasicDescription desc;
+ AudioStreamBasicDescription *descs = NULL;
+ int formats = 0, m;
+ bool input_case = false;
+ err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &msize, NULL);
+ if (err != noErr)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "get property info error: %s\n", osx_error(err));
+ pprint(audio_strbuf);
+ return;
+ }
+ num_devices = msize / sizeof(AudioDeviceID);
+ if (num_devices <= 0)
+ {
+ pprint("no audio devices found");
+ return;
+ }
+ devices = (AudioDeviceID *)MALLOC(msize);
+ size = sizeof(AudioDeviceID);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &size, &default_input);
+ if (err != noErr) default_input = 55555555; /* unsigned int -- I want some value that won't happen! */
+ size = sizeof(AudioDeviceID);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &default_output);
+ if (err != noErr) default_output = 55555555;
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &msize, (void *)devices);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "found %d audio device%s",
+ (int)num_devices, (num_devices != 1) ? "s" : "");
+ pprint(audio_strbuf);
+ for (m = 0; m < 2; m++)
+ {
+ for (i = 0; i < num_devices; i++)
+ {
+ device = devices[i];
+ pprint(device_name(device, input_case));
+ if (input_case)
+ {
+ if (device == default_input)
+ pprint(" (default input)");
+ else pprint(" (input)");
+ }
+ else
+ {
+ if (device == default_output)
+ pprint(" (default output)");
+ else pprint(" (output)");
+ }
+ size = sizeof(pid_t);
+ err = AudioDeviceGetProperty(device, 0, input_case, kAudioDevicePropertyHogMode, &size, &hogger);
+ if ((err == noErr) && (hogger >= 0))
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " currently owned (exclusively) by process %d", (int)hogger);
+ pprint(audio_strbuf);
+ }
+ size = sizeof(UInt32);
+ err = AudioDeviceGetProperty(device, 0, input_case, kAudioDevicePropertyDeviceIsAlive, &size, &alive);
+ if ((err == noErr) && (alive == 0))
+ pprint(" disconnected?");
+ size = sizeof(UInt32);
+ err = AudioDeviceGetProperty(device, 0, input_case, kAudioDevicePropertyBufferSize, &size, &buffer_size);
+ if (err != noErr) buffer_size = 0;
+ size = sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceGetProperty(device, 0, input_case, kAudioDevicePropertyStreamFormat, &size, &desc);
+ if (err == noErr)
+ {
+ int config_chans;
+ unsigned int trans;
+ trans = (unsigned int)(desc.mFormatID);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "\n srate: %d, chans: %d",
+ (int)(desc.mSampleRate),
+ (int)(desc.mChannelsPerFrame));
+ pprint(audio_strbuf);
+ config_chans = max_chans_via_stream_configuration(device, input_case);
+ if ((config_chans > 0) && (config_chans != (int)(desc.mChannelsPerFrame)))
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " (or %d?)", config_chans);
+ pprint(audio_strbuf);
+ }
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, ", bits/sample: %d, format: %c%c%c%c",
+ (int)(desc.mBitsPerChannel),
+ (trans >> 24) & 0xff, (trans >> 16) & 0xff, (trans >> 8) & 0xff, trans & 0xff);
+ pprint(audio_strbuf);
+ if (buffer_size > 0)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, ", buf: %d", (int)buffer_size);
+ pprint(audio_strbuf);
+ }
+ if ((int)(desc.mFormatFlags) != 0) /* assuming "PCM" here */
+ {
+ int flags;
+ flags = ((int)(desc.mFormatFlags));
+ pprint("\n flags: ");
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%s%s%s%s%s%s",
+ (flags & kLinearPCMFormatFlagIsFloat) ? "float " : "",
+ (flags & kLinearPCMFormatFlagIsBigEndian) ? "big-endian " : "",
+ (flags & kLinearPCMFormatFlagIsSignedInteger) ? "signed-int " : "",
+ (flags & kLinearPCMFormatFlagIsPacked) ? "packed " : "",
+ (flags & kLinearPCMFormatFlagIsAlignedHigh) ? "aligned-high " : "",
+#if HAVE_KLINEARPCMFORMATFLAGISNONINTERLEAVED
+ (flags & kLinearPCMFormatFlagIsNonInterleaved) ? "non-interleaved " : ""
+#else
+ ""
+#endif
+ );
+ pprint(audio_strbuf);
+ }
+
+ if ((int)(desc.mChannelsPerFrame) > 0)
+ {
+ pprint("\n vols:");
+ for (j = 0; j <= (int)(desc.mChannelsPerFrame); j++)
+ {
+ size = sizeof(Float32);
+ err = AudioDeviceGetProperty(device, j, input_case, kAudioDevicePropertyVolumeScalar, &size, &vol);
+ if (err == noErr)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s%.3f",
+ (j == 0) ? "master: " : "",
+ vol);
+ pprint(audio_strbuf);
+ }
+
+ if (j > 0)
+ {
+ size = sizeof(UInt32);
+ err = AudioDeviceGetProperty(device, j, input_case, kAudioDevicePropertyMute, &size, &mute);
+ if ((err == noErr) && (mute == 1))
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " (muted)");
+ pprint(audio_strbuf);
+ }
+ }
+ }
+ }
+ }
+ size = 0;
+ err = AudioDeviceGetPropertyInfo(device, 0, input_case, kAudioDevicePropertyStreamFormats, &size, NULL);
+ formats = size / sizeof(AudioStreamBasicDescription);
+ if (formats > 1)
+ {
+ descs = (AudioStreamBasicDescription *)CALLOC(formats, sizeof(AudioStreamBasicDescription));
+ size = formats * sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceGetProperty(device, 0, input_case, kAudioDevicePropertyStreamFormats, &size, descs);
+ if (err == noErr)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "\n This device supports %d formats: ", formats);
+ pprint(audio_strbuf);
+ for (k = 0; k < formats; k++)
+ {
+ unsigned int trans;
+ trans = (unsigned int)(descs[k].mFormatID);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "\n srate: %d, chans: %d, bits/sample: %d, format: %c%c%c%c",
+ (int)(descs[k].mSampleRate),
+ (int)(descs[k].mChannelsPerFrame),
+ (int)(descs[k].mBitsPerChannel),
+ (trans >> 24) & 0xff, (trans >> 16) & 0xff, (trans >> 8) & 0xff, trans & 0xff);
+ pprint(audio_strbuf);
+ }
+ }
+ FREE(descs);
+ }
+ pprint("\n");
+ }
+ input_case = true;
+ }
+ if (devices) FREE(devices);
+}
+
+#define MAX_BUFS 4
+static char **bufs = NULL;
+static int in_buf = 0, out_buf = 0;
+
+static OSStatus writer(AudioDeviceID inDevice,
+ const AudioTimeStamp *inNow,
+ const AudioBufferList *InputData, const AudioTimeStamp *InputTime,
+ AudioBufferList *OutputData, const AudioTimeStamp *OutputTime,
+ void *appGlobals)
+{
+ AudioBuffer abuf;
+ char *aplbuf, *sndbuf;
+ abuf = OutputData->mBuffers[0];
+ aplbuf = (char *)(abuf.mData);
+ sndbuf = bufs[out_buf];
+ memmove((void *)aplbuf, (void *)sndbuf, abuf.mDataByteSize);
+ out_buf++;
+ if (out_buf >= MAX_BUFS) out_buf = 0;
+ return(noErr);
+}
+
+static OSStatus reader(AudioDeviceID inDevice,
+ const AudioTimeStamp *inNow,
+ const AudioBufferList *InputData, const AudioTimeStamp *InputTime,
+ AudioBufferList *OutputData, const AudioTimeStamp *OutputTime,
+ void *appGlobals)
+{
+ AudioBuffer abuf;
+ char *aplbuf, *sndbuf;
+ abuf = InputData->mBuffers[0];
+ aplbuf = (char *)(abuf.mData);
+ sndbuf = bufs[out_buf];
+ memmove((void *)sndbuf, (void *)aplbuf, abuf.mDataByteSize);
+ out_buf++;
+ if (out_buf >= MAX_BUFS) out_buf = 0;
+ return(noErr);
+}
+
+
+static AudioDeviceID device = kAudioDeviceUnknown;
+static bool writing = false, open_for_input = false;
+
+int mus_audio_close(int line)
+{
+ OSStatus err = noErr;
+ UInt32 sizeof_running;
+ UInt32 running;
+ if (open_for_input)
+ {
+ in_buf = 0;
+ err = AudioDeviceStop(device, (AudioDeviceIOProc)reader);
+ if (err == noErr)
+ err = AudioDeviceRemoveIOProc(device, (AudioDeviceIOProc)reader);
+ }
+ else
+ {
+ if ((in_buf > 0) && (!writing))
+ {
+ /* short enough sound that we never got started? */
+ err = AudioDeviceAddIOProc(device, (AudioDeviceIOProc)writer, NULL);
+ if (err == noErr)
+ err = AudioDeviceStart(device, (AudioDeviceIOProc)writer); /* writer will be called right away */
+ if (err == noErr)
+ writing = true;
+ }
+ if (writing)
+ {
+ /* send out waiting buffers */
+ sizeof_running = sizeof(UInt32);
+ while (in_buf == out_buf)
+ {
+ err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyDeviceIsRunning, &sizeof_running, &running);
+ }
+ while (in_buf != out_buf)
+ {
+ err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyDeviceIsRunning, &sizeof_running, &running);
+ }
+ in_buf = 0;
+ err = AudioDeviceStop(device, (AudioDeviceIOProc)writer);
+ if (err == noErr)
+ err = AudioDeviceRemoveIOProc(device, (AudioDeviceIOProc)writer);
+ writing = false;
+ }
+ }
+ device = kAudioDeviceUnknown;
+ if (err == noErr)
+ return(MUS_NO_ERROR);
+ return(MUS_ERROR);
+}
+
+typedef enum {CONVERT_NOT, CONVERT_COPY, CONVERT_SKIP, CONVERT_COPY_AND_SKIP, CONVERT_SKIP_N, CONVERT_COPY_AND_SKIP_N} audio_convert_t;
+static audio_convert_t conversion_choice = CONVERT_NOT;
+static float conversion_multiplier = 1.0;
+static int dac_out_chans, dac_out_srate;
+static int incoming_out_chans = 1, incoming_out_srate = 44100;
+static int fill_point = 0;
+static unsigned int bufsize = 0, current_bufsize = 0;
+
+/* I'm getting bogus buffer sizes from the audio conversion stuff from Apple,
+ * and I think AudioConvert doesn't handle cases like 4->6 chans correctly
+ * so, I'll just do the conversions myself -- there is little need here
+ * for non-integer srate conversion anyway, and the rest is trivial.
+ */
+
+int mus_audio_open_output(int dev, int srate, int chans, int format, int size)
+{
+ OSStatus err = noErr;
+ UInt32 sizeof_device, sizeof_format, sizeof_bufsize;
+ AudioStreamBasicDescription device_desc;
+ sizeof_device = sizeof(AudioDeviceID);
+ sizeof_bufsize = sizeof(unsigned int);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &sizeof_device, (void *)(&device));
+ bufsize = 4096;
+ if (err == noErr)
+ err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyBufferSize, &sizeof_bufsize, &bufsize);
+ if (err != noErr)
+ {
+ fprintf(stderr,"open audio output err: %d %s\n", (int)err, osx_error(err));
+ return(MUS_ERROR);
+ }
+ /* now check for srate/chan mismatches and so on */
+ sizeof_format = sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyStreamFormat, &sizeof_format, &device_desc);
+ if (err != noErr)
+ {
+ fprintf(stderr,"open audio output (get device format) err: %d %s\n", (int)err, osx_error(err));
+ return(MUS_ERROR);
+ }
+ /* current DAC state: device_desc.mChannelsPerFrame, (int)(device_desc.mSampleRate) */
+ /* apparently get stream format can return noErr but chans == 0?? */
+ if ((device_desc.mChannelsPerFrame != chans) ||
+ ((int)(device_desc.mSampleRate) != srate))
+ {
+ /* try to match DAC settings to current sound */
+ device_desc.mChannelsPerFrame = chans;
+ device_desc.mSampleRate = srate;
+ device_desc.mBytesPerPacket = chans * 4; /* assume 1 frame/packet and float32 data */
+ device_desc.mBytesPerFrame = chans * 4;
+ sizeof_format = sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceSetProperty(device, 0, 0, false, kAudioDevicePropertyStreamFormat, sizeof_format, &device_desc);
+
+ /* this error is bogus in some cases -- other audio systems just ignore it,
+ * but in my case (a standard MacIntel with no special audio hardware), if I leave
+ * this block out, the sound is played back at the wrong rate, and the volume
+ * of outa is set to 0.0??
+ */
+
+ if (err != noErr)
+ {
+ /* it must have failed for some reason -- look for closest match available */
+ /* if srate = 22050 try 44100, if chans = 1 try 2 */
+ /* the "get closest match" business appears to be completely bogus... */
+ device_desc.mChannelsPerFrame = (chans == 1) ? 2 : chans;
+ device_desc.mSampleRate = (srate == 22050) ? 44100 : srate;
+ device_desc.mBytesPerPacket = device_desc.mChannelsPerFrame * 4; /* assume 1 frame/packet and float32 data */
+ device_desc.mBytesPerFrame = device_desc.mChannelsPerFrame * 4;
+ sizeof_format = sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceSetProperty(device, 0, 0, false, kAudioDevicePropertyStreamFormat, sizeof_format, &device_desc);
+ if (err != noErr)
+ {
+ sizeof_format = sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyStreamFormatMatch, &sizeof_format, &device_desc);
+ if (err == noErr)
+ {
+ /* match suggests: device_desc.mChannelsPerFrame, (int)(device_desc.mSampleRate) */
+ /* try to set DAC to reflect that match */
+ /* a bug here in emagic 2|6 -- we can get 6 channel match, but then can't set it?? */
+ sizeof_format = sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceSetProperty(device, 0, 0, false, kAudioDevicePropertyStreamFormat, sizeof_format, &device_desc);
+ if (err != noErr)
+ {
+ /* no luck -- get current DAC settings at least */
+ sizeof_format = sizeof(AudioStreamBasicDescription);
+ AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyStreamFormat, &sizeof_format, &device_desc);
+ }
+ }
+ }
+ else
+ {
+ /* nothing matches? -- get current DAC settings */
+ sizeof_format = sizeof(AudioStreamBasicDescription);
+ AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyStreamFormat, &sizeof_format, &device_desc);
+ }
+ }
+ }
+ /* now DAC claims it is ready for device_desc.mChannelsPerFrame, (int)(device_desc.mSampleRate) */
+ dac_out_chans = device_desc.mChannelsPerFrame; /* use better variable names */
+ dac_out_srate = (int)(device_desc.mSampleRate);
+ open_for_input = false;
+ if ((bufs == NULL) || (bufsize > current_bufsize))
+ {
+ int i;
+ if (bufs)
+ {
+ for (i = 0; i < MAX_BUFS; i++) FREE(bufs[i]);
+ FREE(bufs);
+ }
+ bufs = (char **)CALLOC(MAX_BUFS, sizeof(char *));
+ for (i = 0; i < MAX_BUFS; i++)
+ bufs[i] = (char *)CALLOC(bufsize, sizeof(char));
+ current_bufsize = bufsize;
+ }
+ in_buf = 0;
+ out_buf = 0;
+ fill_point = 0;
+ incoming_out_srate = srate;
+ incoming_out_chans = chans;
+ if (incoming_out_chans == dac_out_chans)
+ {
+ if (incoming_out_srate == dac_out_srate)
+ {
+ conversion_choice = CONVERT_NOT;
+ conversion_multiplier = 1.0;
+ }
+ else
+ {
+ /* here we don't get very fancy -- assume dac/2=in */
+ conversion_choice = CONVERT_COPY;
+ conversion_multiplier = 2.0;
+ }
+ }
+ else
+ {
+ if (incoming_out_srate == dac_out_srate)
+ {
+ if ((dac_out_chans == 2) && (incoming_out_chans == 1)) /* the usual case */
+ {
+ conversion_choice = CONVERT_SKIP;
+ conversion_multiplier = 2.0;
+ }
+ else
+ {
+ conversion_choice = CONVERT_SKIP_N;
+ conversion_multiplier = ((float)dac_out_chans / (float)incoming_out_chans);
+ }
+ }
+ else
+ {
+ if ((dac_out_chans == 2) && (incoming_out_chans == 1)) /* the usual case */
+ {
+ conversion_choice = CONVERT_COPY_AND_SKIP;
+ conversion_multiplier = 4.0;
+ }
+ else
+ {
+ conversion_choice = CONVERT_COPY_AND_SKIP_N;
+ conversion_multiplier = ((float)dac_out_chans / (float)incoming_out_chans) * 2;
+ }
+ }
+ }
+ return(MUS_NO_ERROR);
+}
+
+static void convert_incoming(char *to_buf, int fill_point, int lim, char *buf)
+{
+ int i, j, k, jc, kc, ic;
+ switch (conversion_choice)
+ {
+ case CONVERT_NOT:
+ /* no conversion needed */
+ for (i = 0; i < lim; i++)
+ to_buf[i + fill_point] = buf[i];
+ break;
+ case CONVERT_COPY:
+ /* copy sample to mimic lower srate */
+ for (i = 0, j = fill_point; i < lim; i += 8, j += 16)
+ for (k = 0; k < 8; k++)
+ {
+ to_buf[j + k] = buf[i + k];
+ to_buf[j + k + 8] = buf[i + k];
+ }
+ break;
+ case CONVERT_SKIP:
+ /* skip sample for empty chan */
+ for (i = 0, j = fill_point; i < lim; i += 4, j += 8)
+ for (k = 0; k < 4; k++)
+ {
+ to_buf[j + k] = buf[i + k];
+ to_buf[j + k + 4] = 0;
+ }
+ break;
+ case CONVERT_SKIP_N:
+ /* copy incoming_out_chans then skip up to dac_out_chans */
+ jc = dac_out_chans * 4;
+ ic = incoming_out_chans * 4;
+ for (i = 0, j = fill_point; i < lim; i += ic, j += jc)
+ {
+ for (k = 0; k < ic; k++) to_buf[j + k] = buf[i + k];
+ for (k = ic; k < jc; k++) to_buf[j + k] = 0;
+ }
+ break;
+ case CONVERT_COPY_AND_SKIP:
+ for (i = 0, j = fill_point; i < lim; i += 4, j += 16)
+ for (k = 0; k < 4; k++)
+ {
+ to_buf[j + k] = buf[i + k];
+ to_buf[j + k + 4] = 0;
+ to_buf[j + k + 8] = buf[i + k];
+ to_buf[j + k + 12] = 0;
+ }
+ break;
+ case CONVERT_COPY_AND_SKIP_N:
+ /* copy for each active chan, skip rest */
+ jc = dac_out_chans * 8;
+ ic = incoming_out_chans * 4;
+ kc = dac_out_chans * 4;
+ for (i = 0, j = fill_point; i < lim; i += ic, j += jc)
+ {
+ for (k = 0; k < ic; k++)
+ {
+ to_buf[j + k] = buf[i + k];
+ to_buf[j + k + kc] = buf[i + k];
+ }
+ for (k = ic; k < kc; k++)
+ {
+ to_buf[j + k] = 0;
+ to_buf[j + k + kc] = 0;
+ }
+ }
+ break;
+ }
+}
+
+int mus_audio_write(int line, char *buf, int bytes)
+{
+ OSStatus err = noErr;
+ int lim, bp, out_bytes;
+ UInt32 sizeof_running;
+ UInt32 running;
+ char *to_buf;
+ to_buf = bufs[in_buf];
+ out_bytes = (int)(bytes * conversion_multiplier);
+ if ((fill_point + out_bytes) > bufsize)
+ out_bytes = bufsize - fill_point;
+ lim = (int)(out_bytes / conversion_multiplier);
+ if (!writing)
+ {
+ convert_incoming(to_buf, fill_point, lim, buf);
+ fill_point += out_bytes;
+ if (fill_point >= bufsize)
+ {
+ in_buf++;
+ fill_point = 0;
+ if (in_buf == MAX_BUFS)
+ {
+ in_buf = 0;
+ err = AudioDeviceAddIOProc(device, (AudioDeviceIOProc)writer, NULL);
+ if (err == noErr)
+ err = AudioDeviceStart(device, (AudioDeviceIOProc)writer); /* writer will be called right away */
+ if (err == noErr)
+ {
+ writing = true;
+ return(MUS_NO_ERROR);
+ }
+ else return(MUS_ERROR);
+ }
+ }
+ return(MUS_NO_ERROR);
+ }
+ if ((fill_point == 0) && (in_buf == out_buf))
+ {
+ bp = out_buf;
+ sizeof_running = sizeof(UInt32);
+ while (bp == out_buf)
+ {
+ /* i.e. just kill time without hanging */
+ err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyDeviceIsRunning, &sizeof_running, &running);
+ /* usleep(10); */
+ }
+ }
+ to_buf = bufs[in_buf];
+ if (fill_point == 0) memset((void *)to_buf, 0, bufsize);
+ convert_incoming(to_buf, fill_point, lim, buf);
+ fill_point += out_bytes;
+ if (fill_point >= bufsize)
+ {
+ in_buf++;
+ fill_point = 0;
+ if (in_buf >= MAX_BUFS) in_buf = 0;
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_open_input(int dev, int srate, int chans, int format, int size)
+{
+ OSStatus err = noErr;
+ UInt32 sizeof_device;
+ UInt32 sizeof_bufsize;
+ sizeof_device = sizeof(AudioDeviceID);
+ sizeof_bufsize = sizeof(unsigned int);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &sizeof_device, (void *)(&device));
+ bufsize = 4096;
+ if (err == noErr)
+ err = AudioDeviceGetProperty(device, 0, true, kAudioDevicePropertyBufferSize, &sizeof_bufsize, &bufsize);
+ if (err != noErr)
+ {
+ fprintf(stderr,"open audio input err: %d %s\n", (int)err, osx_error(err));
+ return(MUS_ERROR);
+ }
+ open_for_input = true;
+ /* assume for now that recorder (higher level) will enforce match */
+ if ((bufs == NULL) || (bufsize > current_bufsize))
+ {
+ int i;
+ if (bufs)
+ {
+ for (i = 0; i < MAX_BUFS; i++) FREE(bufs[i]);
+ FREE(bufs);
+ }
+ bufs = (char **)CALLOC(MAX_BUFS, sizeof(char *));
+ for (i = 0; i < MAX_BUFS; i++)
+ bufs[i] = (char *)CALLOC(bufsize, sizeof(char));
+ current_bufsize = bufsize;
+ }
+ in_buf = 0;
+ out_buf = 0;
+ fill_point = 0;
+ incoming_out_srate = srate;
+ incoming_out_chans = chans;
+ err = AudioDeviceAddIOProc(device, (AudioDeviceIOProc)reader, NULL);
+ if (err == noErr)
+ err = AudioDeviceStart(device, (AudioDeviceIOProc)reader);
+ if (err != noErr)
+ {
+ fprintf(stderr,"add open audio input err: %d %s\n", (int)err, osx_error(err));
+ return(MUS_ERROR);
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_read(int line, char *buf, int bytes)
+{
+ OSStatus err = noErr;
+ int bp;
+ UInt32 sizeof_running;
+ UInt32 running;
+ char *to_buf;
+ if (in_buf == out_buf)
+ {
+ bp = out_buf;
+ sizeof_running = sizeof(UInt32);
+ while (bp == out_buf)
+ {
+ err = AudioDeviceGetProperty(device, 0, true, kAudioDevicePropertyDeviceIsRunning, &sizeof_running, &running);
+ if (err != noErr)
+ fprintf(stderr,"wait err: %s ", osx_error(err));
+ }
+ }
+ to_buf = bufs[in_buf];
+ if (bytes <= bufsize)
+ memmove((void *)buf, (void *)to_buf, bytes);
+ else memmove((void *)buf, (void *)to_buf, bufsize);
+ in_buf++;
+ if (in_buf >= MAX_BUFS) in_buf = 0;
+ return(MUS_ERROR);
+}
+
+static int max_chans(AudioDeviceID device, int input)
+{
+ int maxc = 0, formats, k, config_chans;
+ UInt32 size;
+ OSStatus err;
+ AudioStreamBasicDescription desc;
+ AudioStreamBasicDescription *descs;
+ size = sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceGetProperty(device, 0, input, kAudioDevicePropertyStreamFormat, &size, &desc);
+ if (err == noErr)
+ {
+ maxc = (int)(desc.mChannelsPerFrame);
+ size = 0;
+ err = AudioDeviceGetPropertyInfo(device, 0, input, kAudioDevicePropertyStreamFormats, &size, NULL);
+ formats = size / sizeof(AudioStreamBasicDescription);
+ if (formats > 1)
+ {
+ descs = (AudioStreamBasicDescription *)CALLOC(formats, sizeof(AudioStreamBasicDescription));
+ size = formats * sizeof(AudioStreamBasicDescription);
+ err = AudioDeviceGetProperty(device, 0, input, kAudioDevicePropertyStreamFormats, &size, descs);
+ if (err == noErr)
+ for (k = 0; k < formats; k++)
+ if ((int)(descs[k].mChannelsPerFrame) > maxc) maxc = (int)(descs[k].mChannelsPerFrame);
+ FREE(descs);
+ }
+ }
+ else fprintf(stderr, "read chans hit: %s\n", osx_error(err));
+ config_chans = max_chans_via_stream_configuration(device, input);
+ if (config_chans > maxc) return(config_chans);
+ return(maxc);
+}
+
+int mus_audio_mixer_read(int dev1, int field, int chan, float *val)
+{
+ AudioDeviceID dev = kAudioDeviceUnknown;
+ OSStatus err = noErr;
+ UInt32 size;
+ Float32 amp;
+ int i, curdev;
+ bool in_case = false;
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ size = sizeof(AudioDeviceID);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &dev);
+ size = sizeof(Float32);
+ err = AudioDeviceGetProperty(dev, chan + 1, false, kAudioDevicePropertyVolumeScalar, &size, &amp);
+ if (err == noErr)
+ val[0] = (Float)amp;
+ else val[0] = 0.0;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ curdev = MUS_AUDIO_DEVICE(dev1);
+ size = sizeof(AudioDeviceID);
+ in_case = ((curdev == MUS_AUDIO_MICROPHONE) || (curdev == MUS_AUDIO_LINE_IN));
+ if (in_case)
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &size, &dev);
+ else err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &dev);
+ if (err != noErr) fprintf(stderr, "get default: %s\n", osx_error(err));
+ val[0] = max_chans(dev, in_case);
+ break;
+ case MUS_AUDIO_SRATE:
+ val[0] = 44100;
+ break;
+ case MUS_AUDIO_FORMAT:
+ /* never actually used except perhaps play.scm */
+ val[0] = 1.0;
+#if MUS_LITTLE_ENDIAN
+ val[1] = MUS_LFLOAT;
+#else
+ val[1] = MUS_BFLOAT;
+#endif
+ break;
+ case MUS_AUDIO_PORT:
+ i = 0;
+ if (1 < chan) val[1] = MUS_AUDIO_MICROPHONE;
+ if (2 < chan) val[2] = MUS_AUDIO_DAC_OUT;
+ val[0] = 2;
+ break;
+ case MUS_AUDIO_SAMPLES_PER_CHANNEL:
+ /* bufsize / 16: mulaw 22050 mono -> float 44100 stereo => 16:1 expansion */
+ {
+ int bufsize = 4096;
+ UInt32 sizeof_bufsize;
+ sizeof_bufsize = sizeof(unsigned int);
+ curdev = MUS_AUDIO_DEVICE(dev1);
+ size = sizeof(AudioDeviceID);
+ in_case = ((curdev == MUS_AUDIO_MICROPHONE) || (curdev == MUS_AUDIO_LINE_IN));
+ if (in_case)
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &size, &dev);
+ else err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &dev);
+ if (err != noErr)
+ fprintf(stderr, "get samps/chan: %s\n", osx_error(err));
+ else
+ {
+ err = AudioDeviceGetProperty(dev, 0, true, kAudioDevicePropertyBufferSize, &sizeof_bufsize, &bufsize);
+ if (err == noErr) val[0] = (float)(bufsize / 16);
+ }
+ }
+ break;
+ default:
+ return(MUS_ERROR);
+ break;
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_mixer_write(int dev1, int field, int chan, float *val)
+{
+ AudioDeviceID dev = kAudioDeviceUnknown;
+ OSStatus err = noErr;
+ Boolean writable;
+ UInt32 size;
+ Float32 amp;
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ size = sizeof(AudioDeviceID);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, (void *)(&dev));
+ err = AudioDeviceGetPropertyInfo(dev, chan + 1, false, kAudioDevicePropertyVolumeScalar, NULL, &writable); /* "false" -> output */
+ amp = (Float32)(val[0]);
+ if ((err == kAudioHardwareNoError) && (writable))
+ err = AudioDeviceSetProperty(dev, NULL, chan + 1, false, kAudioDevicePropertyVolumeScalar, sizeof(Float32), &amp);
+ break;
+ default:
+ return(MUS_ERROR);
+ break;
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_initialize(void) {return(MUS_NO_ERROR);}
+int mus_audio_systems(void) {return(1);}
+char *mus_audio_system_name(int system) {return("Mac OSX");}
+
+char *mus_audio_moniker(void) {return("Mac OSX audio");}
+#endif
+
+
+
+/* -------------------------------- ESD -------------------------------- */
+
+/* ESD audio IO for Linux *
+ * Nick Bailey <nick@bailey-family.org.uk> *
+ * also n.bailey@elec.gla.ac.uk */
+
+/* ESD is pretty well undocumented, and I've not looked at snd before, *
+ * but here goes... *
+ * *
+ * History: *
+ * 14th Nov 2000: copied SUN drivers here and started to hack. NJB. *
+ * */
+
+#ifdef MUS_ESD
+#define AUDIO_OK
+
+#include <esd.h>
+
+static int esd_play_sock = -1;
+static int esd_rec_sock = -1;
+static char esd_name[] = "Enlightened Sound Daemon";
+static int swap_end, resign; /* How to handle samples on write */
+
+int mus_audio_initialize(void) {return(MUS_NO_ERROR);}
+int mus_audio_systems(void) {return(1);}
+char *mus_audio_system_name(int system) {return esd_name;}
+static char our_name[LABEL_BUFFER_SIZE];
+char *mus_audio_moniker(void)
+{
+#ifdef MUS_ESD_VERSION
+ #ifdef MUS_AUDIOFILE_VERSION
+ mus_snprintf(our_name, LABEL_BUFFER_SIZE, "%s: %s (Audiofile %s)", esd_name, MUS_ESD_VERSION, MUS_AUDIOFILE_VERSION);
+ #else
+ mus_snprintf(our_name, LABEL_BUFFER_SIZE, "%s: %s", esd_name, MUS_ESD_VERSION);
+ #endif
+ return(our_name);
+#else
+ return(esd_name);
+#endif
+}
+
+int mus_audio_api(void) {return(0);}
+
+#define RETURN_ERROR_EXIT(Error_Type, Audio_Line, Ur_Error_Message) \
+ do { char *Error_Message; Error_Message = Ur_Error_Message; \
+ if (esd_play_sock != -1) close(esd_play_sock); \
+ if (esd_rec_sock != -1) close(esd_rec_sock); \
+ if (Error_Message) \
+ {MUS_STANDARD_ERROR(Error_Type, Error_Message); FREE(Error_Message);} \
+ else MUS_STANDARD_ERROR(Error_Type, mus_error_type_to_string(Error_Type)); \
+ return(MUS_ERROR); \
+ } while (false)
+
+/* No we're laughing. snd think's its talking to a real piece of hardware
+ so it'll only try to open it once. We can just use the socket numbers */
+
+/* REVOLTING HACK! to_esd_format is called from mus_audio_open, and
+ /as a side effect/, sets a flag to tell the write routine whether
+ or not to change the endienness of the audio sample data (afaik,
+ esd can't do this for us). Same goes for signed-ness.
+ If it gets called from elsewhere, it could be nasty. */
+
+static int to_esd_format(int snd_format)
+{
+ /* Try this on the Macs: it may be esd expects Bigendian on those */
+ switch (snd_format) { /* Only some are supported */
+ case MUS_UBYTE: swap_end = 0; resign = 0; return ESD_BITS8;
+ case MUS_LSHORT: swap_end = 0; resign = 0; return ESD_BITS16;
+ case MUS_BSHORT: swap_end = 1; resign = 0; return ESD_BITS16;
+ case MUS_ULSHORT: swap_end = 0; resign = 1; return ESD_BITS16;
+ case MUS_UBSHORT: swap_end = 1; resign = 1; return ESD_BITS16;
+ }
+ return MUS_ERROR;
+}
+
+int mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size)
+{
+ int esd_prop = ESD_STREAM;
+ int esd_format;
+
+ if ((esd_format = to_esd_format(format)) == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, audio_out,
+ mus_format("Can't handle format %d (%s) through esd",
+ format, mus_data_format_name(format)));
+ else
+ esd_prop |= esd_format;
+
+ if (chans < 1 || chans > 2)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_out,
+ mus_format("Can't handle format %d channels through esd",
+ format));
+ else
+ esd_prop |= chans == 1 ? ESD_MONO : ESD_STEREO;
+
+ esd_play_sock = esd_play_stream(esd_prop, srate,
+ NULL, "snd playback stream");
+
+ if (esd_play_sock == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, audio_out,
+ mus_format("Sonorus device %d (%s) not available",
+ ur_dev, mus_audio_device_name(ur_dev)));
+ else
+ return esd_play_sock;
+}
+
+int mus_audio_write(int line, char *buf, int bytes)
+{
+ int written;
+ char *to = buf;
+
+ /* Esd can't do endianness or signed/unsigned conversion,
+ so it's our problem. We won't screw up the callers data */
+
+ if (swap_end) {
+ char *from = buf;
+ char *p;
+ int samps = bytes/2;
+ p = to = (char *)alloca(bytes);
+ while (samps--) {
+ *p++ = *(from+1);
+ *p++ = *(from);
+ from += 2;
+ }
+ }
+
+ /* Need to do something about sign correction here */
+
+ do {
+ written = write(line, to, bytes);
+ if (written > 0) {
+ bytes -= written;
+ to += written;
+ }
+ else
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("write error: %s", strerror(errno)));
+ } while (bytes > 0);
+ return MUS_NO_ERROR;
+}
+
+int mus_audio_close(int line)
+{
+ esd_close(line);
+ if (esd_play_sock == line) esd_play_sock = -1;
+ else if (esd_rec_sock == line) esd_rec_sock = -1;
+ return MUS_NO_ERROR;
+}
+
+int mus_audio_read(int line, char *buf, int bytes)
+{
+ int bytes_read;
+
+ do {
+ bytes_read = read(line, buf, bytes);
+ if (bytes_read > 0) { /* 0 -> EOF; we'll regard that as an error */
+ bytes -= bytes_read;
+ buf += bytes_read;
+ } else
+ RETURN_ERROR_EXIT(MUS_AUDIO_WRITE_ERROR, -1,
+ mus_format("read error: %s", strerror(errno)));
+ } while (bytes > 0);
+ return MUS_NO_ERROR;
+}
+
+int mus_audio_open_input(int ur_dev, int srate, int chans, int format, int size)
+{
+ int esd_prop = ESD_STREAM;
+ int esd_format;
+
+ if ((esd_format = to_esd_format(format)) == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, audio_out,
+ mus_format("Can't handle format %d (%s) through esd",
+ format, mus_data_format_name(format)));
+ else
+ esd_prop |= esd_format;
+
+ if (chans < 1 || chans > 2)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CHANNELS_NOT_AVAILABLE, audio_out,
+ mus_format("Can't handle format %d channels through esd",
+ chans));
+ else
+ esd_prop |= chans == 1 ? ESD_MONO : ESD_STEREO;
+
+ esd_rec_sock = esd_play_stream(esd_prop, srate,
+ NULL, "snd record stream");
+
+ if (esd_rec_sock == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_DEVICE_NOT_AVAILABLE, audio_out,
+ mus_format("Device %d (%s) not available",
+ ur_dev, mus_audio_device_name(ur_dev)));
+ else
+ return esd_rec_sock;
+}
+
+int mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ /* Not really sure what to do here. Mixer is at the other end of the
+ socket. Needs work. NJB */
+
+ /* int card = MUS_AUDIO_SYSTEM(ur_dev); */
+ int device = MUS_AUDIO_DEVICE(ur_dev);
+
+ if (device == MUS_AUDIO_MIXER) {
+ val[0] = 0.0;
+ return MUS_NO_ERROR;
+ }
+
+ if (field == MUS_AUDIO_PORT) {
+ val[0] = 1.0;
+ return MUS_NO_ERROR;
+ }
+
+ switch (field) {
+ case MUS_AUDIO_AMP:
+ /* amplitude value */
+ val[0] = 1.0;
+ break;
+ case MUS_AUDIO_SAMPLES_PER_CHANNEL:
+ val[0] = 44100;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ /* number of channels */
+ val[0] = 2.0;
+ if (chan > 1) {
+ val[1] = 1.0;
+ val[2] = 2.0;
+ }
+ break;
+ case MUS_AUDIO_SRATE:
+ /* supported sample rates */
+ val[0] = 44100;
+ if (chan > 1) {
+ val[1] = 8000;
+ val[2] = 48000;
+ }
+ break;
+ case MUS_AUDIO_FORMAT:
+ /* supported formats (ugly...) */
+ val[0] = 3.0;
+ val[1] = MUS_UBYTE;
+ val[2] = MUS_LSHORT;
+ val[3] = MUS_BSHORT;
+ break;
+
+ case MUS_AUDIO_DIRECTION: /* Needs sorting. NJB */
+ /* 0-->playback, 1-->capture */
+ val[0] = 0;
+ break;
+
+ default:
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, -1, NULL);
+ /* return(mus_error(MUS_AUDIO_CANT_READ, NULL)); */ /* Bill 14-Nov-02 -- avoid possibly uncaught throw */
+ break;
+ }
+ return(MUS_NO_ERROR);
+}
+
+
+int mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ /* Ditto */
+ val[0] = 0.0;
+ return MUS_NO_ERROR;
+}
+
+/* pause can be implemented with play.pause and record.pause */
+
+
+void describe_audio_state_1(void)
+{
+ pprint("Enlightened Sound Daemon via socket connexion to default host");
+}
+
+#endif
+
+
+/* ------------------------------- JACK ----------------------------------------- */
+
+/* Kjetil S. Matheussen. k.s.matheussen@notam02.no */
+/* Based on code from ceres. */
+
+#if HAVE_JACK
+#define AUDIO_OK
+#include <jack/jack.h>
+#include <samplerate.h>
+#include <sys/mman.h>
+#include <signal.h>
+
+#if MUS_LITTLE_ENDIAN
+# define MUS_COMP_SHORT MUS_LSHORT
+# define MUS_COMP_FLOAT MUS_LFLOAT
+#else
+# define MUS_COMP_SHORT MUS_BSHORT
+# define MUS_COMP_FLOAT MUS_BFLOAT
+#endif
+
+#define SRC_QUALITY SRC_SINC_BEST_QUALITY
+
+/*************/
+/* Jack Part */
+/*************/
+
+#define SNDJACK_NUMINCHANNELS 4
+
+#define SNDJACK_MAXSNDS 20
+
+#define SNDJACK_BUFFERSIZE 32768
+
+typedef jack_default_audio_sample_t sample_t;
+typedef jack_nframes_t nframes_t;
+
+struct SndjackChannel{
+ jack_port_t *port;
+ sample_t *buffer;
+};
+
+static jack_client_t *sndjack_client = NULL;
+
+
+/*************************/
+/* Variables for reading */
+/*************************/
+static int sndjack_num_read_channels_allocated=0;
+static int sndjack_num_read_channels_inuse=0;
+static struct SndjackChannel *sndjack_read_channels=NULL;
+static pthread_cond_t sndjack_read_cond= PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t sndjack_read_mutex= PTHREAD_MUTEX_INITIALIZER;
+static int sj_r_buffersize=0;
+static int sj_r_writeplace=0;
+static int sj_r_readplace=0;
+static int sj_r_unread=0;
+static int sj_r_xrun=0;
+static int sj_r_totalxrun=0;
+
+/*************************/
+/* Variables for writing */
+/*************************/
+static pthread_cond_t sndjack_cond= PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t sndjack_mutex= PTHREAD_MUTEX_INITIALIZER;
+
+enum{SJ_STOPPED,SJ_RUNNING,SJ_ABOUTTOSTOP};
+
+// Variables for the ringbuffer:
+static int sj_writeplace=0;
+static int sj_readplace=0;
+static int sj_unread=0;
+static int sj_buffersize;
+static int sj_jackbuffersize; // number of frames sent to sndjack_process.
+static int sj_totalxrun=0;
+static int sj_xrun=0;
+static int sj_status=SJ_STOPPED;
+
+static int sndjack_num_channels_allocated=0;
+static int sndjack_num_channels_inuse=0;
+static struct SndjackChannel *sndjack_channels=NULL;
+static int sndjack_read_format;
+
+static SRC_STATE **sndjack_srcstates;
+static double sndjack_srcratio=1.0;
+
+static int jack_mus_watchdog_counter=0;
+
+
+#define SJ_MAX(a,b) (((a)>(b))?(a):(b))
+
+static void sndjack_read_process(jack_nframes_t nframes){
+ int i,ch;
+ sample_t *out[sndjack_num_channels_allocated];
+
+ if(sndjack_num_read_channels_inuse==0) return;
+
+ for(ch=0;ch<sndjack_num_read_channels_allocated;ch++){
+ out[ch]=(sample_t*)jack_port_get_buffer(sndjack_read_channels[ch].port,nframes);
+ }
+
+ for(i=0;i<nframes;i++){
+ if(sj_r_unread==sj_buffersize){
+ sj_r_xrun+=nframes-i;
+ goto exit;
+ }
+ for(ch=0;ch<sndjack_num_read_channels_inuse;ch++)
+ sndjack_read_channels[ch].buffer[sj_r_writeplace]=out[ch][i];
+ sj_r_unread++;
+ sj_r_writeplace++;
+ if(sj_r_writeplace==sj_r_buffersize)
+ sj_r_writeplace=0;
+ }
+ exit:
+ pthread_cond_broadcast(&sndjack_read_cond);
+}
+
+
+static void sndjack_write_process(jack_nframes_t nframes){
+ int ch,i;
+ sample_t *out[sndjack_num_channels_allocated];
+
+ for(ch=0;ch<sndjack_num_channels_allocated;ch++){
+ out[ch]=(sample_t*)jack_port_get_buffer(sndjack_channels[ch].port,nframes);
+ }
+
+ if(sj_status==SJ_STOPPED){
+ for(ch=0;ch<sndjack_num_channels_allocated;ch++){
+ memset(out[ch],0,nframes*sizeof(sample_t));
+ }
+ }else{
+
+ // First null out unused channels, if any.
+ if(sndjack_num_channels_inuse==1 && sndjack_num_channels_allocated>=2){
+ for(ch=2;ch<sndjack_num_channels_allocated;ch++){
+ memset(out[ch],0,nframes*sizeof(sample_t));
+ }
+ }else{
+ for(ch=sndjack_num_channels_inuse;ch<sndjack_num_channels_allocated;ch++){
+ memset(out[ch],0,nframes*sizeof(sample_t));
+ }
+ }
+
+ for(i=0;i<nframes;i++){
+ if(sj_unread==0){
+ if(sj_status==SJ_RUNNING)
+ sj_xrun+=nframes-i;
+ for(;i<nframes;i++){
+ for(ch=0;ch<sndjack_num_channels_inuse;ch++){
+ out[ch][i]=0.0f;
+ }
+ }
+ break;
+ }
+
+ if(sndjack_num_channels_inuse==1 && sndjack_num_channels_allocated>=2){
+ for(ch=0;ch<2;ch++){
+ out[ch][i]=sndjack_channels[0].buffer[sj_readplace];
+ }
+ }else{
+ for(ch=0;ch<sndjack_num_channels_inuse;ch++){
+ out[ch][i]=sndjack_channels[ch].buffer[sj_readplace];
+ }
+ }
+ sj_unread--;
+ sj_readplace++;
+ if(sj_readplace==sj_buffersize)
+ sj_readplace=0;
+ }
+
+ pthread_cond_broadcast(&sndjack_cond);
+
+ if(sj_status==SJ_ABOUTTOSTOP && sj_unread==0)
+ sj_status=SJ_STOPPED;
+ }
+
+}
+
+
+
+static int sndjack_process(jack_nframes_t nframes, void *arg){
+ sndjack_read_process(nframes);
+ sndjack_write_process(nframes);
+ return 0;
+}
+
+
+static int sndjack_read(void *buf,int bytes,int chs){
+ int i,ch;
+ int nframes=bytes /
+ sndjack_read_format==MUS_COMP_FLOAT ? sizeof(float) :
+ sndjack_read_format==MUS_COMP_SHORT ? sizeof(short) :
+ 1;
+ float *buf_f=buf;
+ short *buf_s=buf;
+ char *buf_c=buf;
+
+ for(i=0;i<nframes;i++){
+ while(sj_r_unread==0){
+ pthread_cond_wait(&sndjack_read_cond,&sndjack_read_mutex);
+ jack_mus_watchdog_counter++;
+ }
+
+ if(sj_r_xrun>0){
+ sj_r_totalxrun+=sj_r_xrun;
+ sj_r_xrun=0;
+ return -1;
+ }
+ for(ch=0;ch<chs;ch++){
+ switch(sndjack_read_format){
+ case MUS_BYTE:
+ buf_c[i*chs+ch]=sndjack_read_channels[ch].buffer[sj_r_readplace] * 127.9f;
+ break;
+ case MUS_COMP_SHORT:
+ buf_s[i*chs+ch]=sndjack_read_channels[ch].buffer[sj_r_readplace] * 32767.9f;
+ break;
+ case MUS_COMP_FLOAT:
+ buf_f[i*chs+ch]=sndjack_read_channels[ch].buffer[sj_r_readplace];
+ break;
+ }}
+ sj_r_unread--;
+ sj_r_readplace++;
+ if(sj_r_readplace==sj_r_buffersize)
+ sj_r_readplace=0;
+ }
+ return 0;
+}
+
+static void sndjack_write(sample_t **buf,int nframes,int latencyframes,int chs){
+ int ch;
+ int i;
+
+ if(sj_xrun>0){
+ if(sj_status==SJ_RUNNING){
+ printf("Warning. %d frames delayed.\n",sj_xrun);
+ sj_totalxrun+=sj_xrun;
+ }
+ sj_xrun=0;
+ }
+
+ for(i=0;i<nframes;i++){
+ while(
+ sj_status==SJ_RUNNING
+ && (sj_unread==sj_buffersize
+ || sj_unread >= SJ_MAX(sj_jackbuffersize*2, latencyframes))
+ )
+ {
+ jack_mus_watchdog_counter++;
+ pthread_cond_wait(&sndjack_cond,&sndjack_mutex);
+ }
+
+ for(ch=0;ch<chs;ch++)
+ sndjack_channels[ch].buffer[sj_writeplace]=buf[ch][i];
+
+ sj_unread++;
+ sj_writeplace++;
+ if(sj_writeplace==sj_buffersize)
+ sj_writeplace=0;
+ }
+
+ if(sj_status==SJ_STOPPED)
+ if(sj_unread>=sj_jackbuffersize)
+ sj_status=SJ_RUNNING;
+}
+
+static int sndjack_buffersizecallback(jack_nframes_t nframes, void *arg){
+ sj_jackbuffersize=nframes;
+ return 0;
+}
+
+static int sndjack_getnumoutchannels(void){
+ int lokke=0;
+ const char **ports=jack_get_ports(sndjack_client,NULL,NULL,JackPortIsPhysical|JackPortIsInput);
+ while(ports!=NULL && ports[lokke]!=NULL){
+ lokke++;
+ }
+ if(lokke<2) return 2;
+ return lokke;
+}
+
+static int sndjack_getnuminchannels(void){
+ int lokke=0;
+ const char **ports=jack_get_ports(sndjack_client,NULL,NULL,JackPortIsPhysical|JackPortIsOutput);
+ while(ports!=NULL && ports[lokke]!=NULL){
+ lokke++;
+ }
+ if(lokke<2) return 2;
+ return lokke;
+}
+
+
+static int sndjack_init(void){
+ int ch;
+ int numch;
+ int numch_read;
+ int num=0;
+
+ while(num<SNDJACK_MAXSNDS){
+ char temp[500];
+ sprintf(temp,"sndlib%d",num);
+ if ((sndjack_client=jack_client_new(temp)) != 0) {
+ break;
+ }
+ num++;
+ }
+
+ if(sndjack_client==NULL){
+ /* printf("Unable to create new jack_client\n"); */
+ return -1;
+ }
+
+ pthread_mutex_init(&sndjack_mutex,NULL);
+ pthread_cond_init(&sndjack_cond,NULL);
+ pthread_mutex_init(&sndjack_read_mutex,NULL);
+ pthread_cond_init(&sndjack_read_cond,NULL);
+
+ jack_set_process_callback(sndjack_client,sndjack_process,NULL);
+
+ sndjack_num_channels_allocated = numch = sndjack_getnumoutchannels();
+ numch_read=sndjack_getnuminchannels();
+ sndjack_num_read_channels_allocated=SJ_MAX(SNDJACK_NUMINCHANNELS,numch_read);
+
+ sndjack_channels=calloc(sizeof(struct SndjackChannel),numch);
+ sndjack_read_channels=calloc(sizeof(struct SndjackChannel),sndjack_num_read_channels_allocated);
+
+ for(ch=0;ch<numch;ch++){
+ sndjack_channels[ch].buffer=calloc(sizeof(sample_t),SNDJACK_BUFFERSIZE);
+ }
+ for(ch=0;ch<sndjack_num_read_channels_allocated;ch++){
+ sndjack_read_channels[ch].buffer=calloc(sizeof(sample_t),SNDJACK_BUFFERSIZE);
+ }
+ sj_buffersize=SNDJACK_BUFFERSIZE;
+
+ for(ch=0;ch<numch;ch++){
+ char temp[500];
+ sprintf(temp,"out_%d",ch+1);
+ if((sndjack_channels[ch].port=jack_port_register(
+ sndjack_client,
+ strdup(temp),
+ JACK_DEFAULT_AUDIO_TYPE,
+ JackPortIsOutput,
+ 0
+ ))==NULL)
+ {
+ fprintf(stderr,"Error. Could not register jack port.\n");
+ goto failed_register;
+ }
+ }
+
+ for(ch=0;ch<sndjack_num_read_channels_allocated;ch++){
+ char temp[500];
+ sprintf(temp,"in_%d",ch+1);
+ if((sndjack_read_channels[ch].port=jack_port_register(
+ sndjack_client,
+ strdup(temp),
+ JACK_DEFAULT_AUDIO_TYPE,
+ JackPortIsInput,
+ 0
+ ))==NULL)
+ {
+ fprintf(stderr,"Error. Could not register jack port.\n");
+ goto failed_register;
+ }
+ }
+
+
+
+
+ sj_jackbuffersize=jack_get_buffer_size(sndjack_client);
+ jack_set_buffer_size_callback(sndjack_client,sndjack_buffersizecallback,NULL);
+
+ if (jack_activate (sndjack_client)) {
+ fprintf (stderr, "Error. Cannot activate jack client.\n");
+ goto failed_activate;
+ }
+
+ {
+ const char **outportnames=jack_get_ports(sndjack_client,NULL,NULL,JackPortIsPhysical|JackPortIsInput);
+ for(ch=0;outportnames && outportnames[ch]!=NULL && ch<numch;ch++){
+ if (
+ jack_connect(
+ sndjack_client,
+ jack_port_name(sndjack_channels[ch].port),
+ outportnames[ch]
+ )
+ )
+ {
+ printf ("Warning. Cannot connect jack output port %d: \"%s\".\n",ch,outportnames[ch]);
+ }
+ }
+ }
+
+ {
+ const char **inportnames=jack_get_ports(sndjack_client,NULL,NULL,JackPortIsPhysical|JackPortIsOutput);
+ for(ch=0;inportnames && inportnames[ch]!=NULL && ch<numch;ch++){
+ if (
+ jack_connect(
+ sndjack_client,
+ inportnames[ch],
+ jack_port_name(sndjack_read_channels[ch].port)
+ )
+ )
+ {
+ printf ("Warning. Cannot connect jack input port %d: \"%s\".\n",ch,inportnames[ch]);
+ }
+ }
+ }
+ return 0;
+
+ // failed_connect:
+ failed_activate:
+ jack_deactivate(sndjack_client);
+
+ failed_register:
+ jack_client_close(sndjack_client);
+ sndjack_client=NULL;
+
+ return -1;
+}
+static void sndjack_cleanup(void){
+ int ch;
+ for(ch=0;ch<sndjack_num_channels_allocated;ch++){
+ src_delete(sndjack_srcstates[ch]);
+ }
+ jack_deactivate(sndjack_client);
+ jack_client_close(sndjack_client);
+
+}
+
+
+
+/***************/
+/* Sndlib Part */
+/***************/
+
+static int sndjack_format;
+static sample_t **sndjack_buffer;
+static sample_t *sndjack_srcbuffer;
+
+static int sndjack_dev;
+static int sndjack_read_dev;
+
+/* prototypes for the jack sndlib functions */
+static int jack_mus_audio_initialize(void);
+static void jack_mus_oss_set_buffers(int num, int size);
+static int jack_mus_audio_systems(void);
+static char* jack_mus_audio_system_name(int system);
+static char* jack_mus_audio_moniker(void);
+static int jack_mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size);
+static int jack_mus_audio_open_input(int ur_dev, int srate, int chans, int format, int requested_size);
+static int jack_mus_audio_write(int id, char *buf, int bytes);
+static int jack_mus_audio_read(int id, char *buf, int bytes);
+static int jack_mus_audio_close(int id);
+static int jack_mus_audio_mixer_read(int ur_dev, int field, int chan, float *val);
+static int jack_mus_audio_mixer_write(int ur_dev, int field, int chan, float *val);
+static void jack_describe_audio_state_1(void);
+
+
+static int jack_mus_audio_initialize(void) {
+ int ch;
+
+ if(audio_initialized){
+ return MUS_NO_ERROR;
+ }
+
+ if(sndjack_init()!=0)
+ return MUS_ERROR;
+
+ sndjack_buffer=calloc(sizeof(sample_t*),sndjack_num_channels_allocated);
+ for(ch=0;ch<sndjack_num_channels_allocated;ch++)
+ sndjack_buffer[ch]=calloc(sizeof(sample_t),SNDJACK_BUFFERSIZE);
+ sndjack_srcbuffer=calloc(sizeof(sample_t),SNDJACK_BUFFERSIZE);
+
+ sndjack_srcstates=calloc(sizeof(SRC_STATE*),sndjack_num_channels_allocated);
+ for(ch=0;ch<sndjack_num_channels_allocated;ch++){
+ sndjack_srcstates[ch]=src_new(SRC_QUALITY,1,NULL);
+ }
+
+ atexit(sndjack_cleanup);
+
+ api = JACK_API;
+ vect_mus_audio_initialize = jack_mus_audio_initialize;
+ vect_mus_oss_set_buffers = jack_mus_oss_set_buffers;
+ vect_mus_audio_systems = jack_mus_audio_systems;
+ vect_mus_audio_system_name = jack_mus_audio_system_name;
+ vect_mus_audio_moniker = jack_mus_audio_moniker;
+ vect_mus_audio_open_output = jack_mus_audio_open_output;
+ vect_mus_audio_open_input = jack_mus_audio_open_input;
+ vect_mus_audio_write = jack_mus_audio_write;
+ vect_mus_audio_read = jack_mus_audio_read;
+ vect_mus_audio_close = jack_mus_audio_close;
+ vect_mus_audio_mixer_read = jack_mus_audio_mixer_read;
+ vect_mus_audio_mixer_write = jack_mus_audio_mixer_write;
+ vect_describe_audio_state_1 = jack_describe_audio_state_1;
+
+ audio_initialized = true;
+
+#if 0
+
+ /* Locking all future memory shouldn't be that necessary, and might even freeze the machine in certain situations. */
+ /* So remove MCL_FUTURE from the mlockall call. (No. We can't do that. It can screw up code using the realtime extension. -Kjetil.*/
+ munlockall();
+ //mlockall(MCL_CURRENT);
+
+ // Instead we just do this: (which is not enough, but maybe better than nothing)
+ {
+ mlock(sndjack_channels,sizeof(struct SndjackChannel)*sndjack_num_channels_allocated);
+ mlock(sndjack_read_channels,sizeof(struct SndjackChannel)*sndjack_num_read_channels_allocated);
+
+ for(ch=0;ch<numch;ch++){
+ mlock(sndjack_channels[ch].buffer,sizeof(sample_t)*SNDJACK_BUFFERSIZE);
+ }
+ for(ch=0;ch<sndjack_num_read_channels_allocated;ch++){
+ mlock(sndjack_read_channels[ch].buffer,sizeof(sample_t)*SNDJACK_BUFFERSIZE);
+ }
+ }
+#endif
+
+ return MUS_NO_ERROR;
+}
+
+// ??
+static void jack_mus_oss_set_buffers(int num, int size){
+}
+
+static int jack_mus_isrunning=0;
+static pid_t jack_mus_player_pid;
+static pthread_t jack_mus_watchdog_thread;
+
+static void *jack_mus_audio_watchdog(void *arg){
+ struct sched_param par;
+
+ par.sched_priority = sched_get_priority_max(SCHED_RR);
+ if(sched_setscheduler(0,SCHED_RR,&par)==-1){
+ fprintf(stderr,"SNDLIB: Unable to set SCHED_RR realtime priority for the watchdog thread. No watchdog.\n");
+ goto exit;
+ }
+
+ for(;;){
+ int last=jack_mus_watchdog_counter;
+ sleep(1);
+
+ if(jack_mus_isrunning && jack_mus_watchdog_counter<last+10){
+ struct sched_param par;
+ fprintf(stderr,"SNDLIB: Setting player to non-realtime for 2 seconds.\n");
+
+ par.sched_priority = 0;
+ if(sched_setscheduler(jack_mus_player_pid,SCHED_OTHER,&par)==-1){
+ fprintf(stderr,"SNDLIB: Unable to set non-realtime priority. Must kill player thread. Sorry!\n");
+ while(1){
+ kill(jack_mus_player_pid,SIGKILL);
+ sleep(2);
+ }
+ }
+
+ sleep(2);
+
+ if(jack_mus_isrunning){
+ par.sched_priority = sched_get_priority_min(SCHED_RR)+1;
+ if(sched_setscheduler(jack_mus_player_pid,SCHED_RR,&par)==-1){
+ fprintf(stderr,"SNDLIB: Could not set back to realtime priority...\n");
+ }else
+ fprintf(stderr,"SNDLIB: Play thread set back to realtime priority.\n");
+ }
+
+ }
+ }
+ exit:
+ fprintf(stderr,"SNDLIB: Watchdog exiting\n");
+ return NULL;
+}
+
+
+
+static void jack_mus_audio_set_realtime(void){
+ struct sched_param par;
+ static int watchdog_started=0;
+
+ jack_mus_player_pid=getpid();
+
+ if(watchdog_started==0){
+ if(pthread_create(&jack_mus_watchdog_thread,NULL,jack_mus_audio_watchdog,NULL)!=0){
+ fprintf(stderr,"Could not create watchdog. Not running realtime\n");
+ return;
+ }
+ watchdog_started=1;
+ }
+
+ jack_mus_isrunning=1;
+
+ par.sched_priority = sched_get_priority_min(SCHED_RR)+1;
+ if(sched_setscheduler(0,SCHED_RR,&par)==-1){
+ fprintf(stderr,"SNDLIB: Unable to set SCHED_RR realtime priority for the player thread.\n");
+ }{
+ //fprintf(stderr,"Set realtime priority\n");
+ }
+}
+
+static void jack_mus_audio_set_non_realtime(void){
+ struct sched_param par;
+ par.sched_priority = 0;
+ sched_setscheduler(0,SCHED_OTHER,&par);
+ //fprintf(stderr,"Set non-realtime priority\n");
+ jack_mus_isrunning=0;
+}
+
+int jack_mus_audio_open_output(int dev, int srate, int chans, int format, int size){
+ if(sndjack_client==NULL){
+ if(jack_mus_audio_initialize()==MUS_ERROR)
+ return MUS_ERROR;
+ }
+
+ if(sndjack_num_channels_allocated<chans){
+ printf("Error. Can not play back %d channels. (Only %d)\n",chans,sndjack_num_channels_allocated);
+ return MUS_ERROR;
+ }
+
+ if(format!=MUS_BYTE && format!=MUS_COMP_SHORT && format!=MUS_COMP_FLOAT){
+ printf("Error, unable to handle format %s.\n",mus_data_format_to_string(format));
+ return MUS_ERROR;
+ }
+
+ while(sj_status!=SJ_STOPPED) usleep(5);
+
+ sj_unread=0;
+ sj_writeplace=0;
+ sj_readplace=0;
+
+
+ if(srate!=jack_get_sample_rate(sndjack_client)){
+ int lokke;
+ //printf("Warning, sample-rate differs between snd and jack. Sound will not be played correctly! %d/%d\n",srate,jack_get_sample_rate(sndjack_client));
+ sndjack_srcratio=(double)jack_get_sample_rate(sndjack_client)/(double)srate;
+ for(lokke=0;lokke<chans;lokke++){
+ src_reset(sndjack_srcstates[lokke]);
+ }
+ }else{
+ sndjack_srcratio=1.0;
+ }
+
+ sndjack_format=format;
+ sndjack_num_channels_inuse=chans;
+ sndjack_dev=dev;
+
+ jack_mus_audio_set_realtime();
+
+ return(MUS_NO_ERROR);
+}
+
+static int sndjack_from_byte(int ch,int chs,char *buf,float *out,int bytes){
+ int i;
+ int len=bytes/chs;
+ if(len>SNDJACK_BUFFERSIZE) return -1;
+
+ for(i=0;i<len;i++){
+ out[i]=MUS_BYTE_TO_SAMPLE(buf[i*chs+ch]);
+ }
+ return len;
+}
+
+static int sndjack_from_short(int ch,int chs,short *buf,float *out,int bytes){
+ int i;
+ int len=bytes/(sizeof(short)*chs);
+ if(len>SNDJACK_BUFFERSIZE) return -1;
+
+ for(i=0;i<len;i++){
+ out[i]=(float)buf[i*chs+ch]/32768.1f;
+ }
+ return len;
+}
+
+static int sndjack_from_float(int ch,int chs,float *buf,float *out,int bytes){
+ int i;
+ int len=bytes/(sizeof(float)*chs);
+ if(len>SNDJACK_BUFFERSIZE) return -1;
+
+ for(i=0;i<len;i++){
+ out[i]=buf[i*chs+ch];
+ }
+ return len;
+}
+
+
+int jack_mus_audio_write(int line, char *buf, int bytes){
+ int i;
+ int ch;
+ int outlen=0;
+
+ for(ch=0;ch<sndjack_num_channels_inuse;ch++){
+ int len = 0;
+ float *buf2=sndjack_srcratio==1.0?sndjack_buffer[ch]:sndjack_srcbuffer;
+
+ switch(sndjack_format){
+ case MUS_BYTE:
+ len=sndjack_from_byte(ch,sndjack_num_channels_inuse,buf,buf2,bytes);
+ break;
+ case MUS_COMP_SHORT:
+ len=sndjack_from_short(ch,sndjack_num_channels_inuse,(short *)buf,buf2,bytes);
+ break;
+ case MUS_COMP_FLOAT:
+ len=sndjack_from_float(ch,sndjack_num_channels_inuse,(float *)buf,buf2,bytes);
+ break;
+ }
+ if(len<0){
+ printf("Errur. Input buffer to large for mus_audio_write.\n");
+ return MUS_ERROR;
+ }
+
+ if(sndjack_srcratio!=1.0){
+ SRC_DATA src_data={
+ buf2,sndjack_buffer[ch],
+ len,SNDJACK_BUFFERSIZE,
+ 0,0,
+ 0,
+ sndjack_srcratio
+ };
+ int res=src_process(sndjack_srcstates[ch],&src_data);
+ if(res!=0){
+ printf("Error while resampling. (%s)\n",src_strerror(res));
+ return MUS_ERROR;
+ }
+ if(src_data.input_frames!=len){
+ printf("Unsuccessfull resampling: Should have used %d bytes, used %d.",len,src_data.input_frames);
+ return MUS_ERROR;
+ }
+ if(ch>0 && src_data.output_frames_gen!=outlen){
+ printf("Error, src_process did not output the same number of frames as previous resampled channel (%d/%d).\n"
+ "Please report this problem to k.s.matheussen@notam02.no. Thanks!\n",src_data.output_frames_gen,outlen);
+ return MUS_ERROR;
+ }
+ outlen=src_data.output_frames_gen;
+ }else{
+ outlen=len;
+ }
+ }
+
+
+ sndjack_write(sndjack_buffer,outlen,outlen*2,sndjack_num_channels_inuse);
+
+ return MUS_NO_ERROR;
+}
+
+int jack_mus_audio_close(int line)
+{
+ jack_mus_audio_set_non_realtime();
+ if(line==sndjack_dev){
+ sj_status=SJ_ABOUTTOSTOP;
+ sndjack_num_channels_inuse=0;
+ }
+ return MUS_NO_ERROR;
+ }
+
+int jack_mus_audio_mixer_read(int dev, int field, int chan, float *val)
+{
+ //printf("dev: %d, field: %d, chan: %d\n",dev,field,chan);
+
+ switch(field){
+ case MUS_AUDIO_FORMAT:
+ val[1]=MUS_COMP_FLOAT;
+ val[0]=1;
+ break;
+ case MUS_AUDIO_PORT:
+ val[0]=1;
+ val[1]=MUS_AUDIO_DIGITAL_IN;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ val[0]=sndjack_num_read_channels_allocated;
+ break;
+ case MUS_AUDIO_AMP:
+ val[0] = 1.0f;
+ break;
+ default:
+ printf("Got unknown request with field %d %d\n",field, MUS_AUDIO_AMP);
+ return MUS_ERROR;
+ }
+
+ return MUS_NO_ERROR;
+}
+
+int jack_mus_audio_mixer_write(int dev, int field, int chan, float *val){
+ return(MUS_NO_ERROR);
+}
+
+int jack_mus_audio_open_input(int dev, int srate, int chans, int format, int size){
+ if(sndjack_client==NULL){
+ if(jack_mus_audio_initialize()==MUS_ERROR)
+ return MUS_ERROR;
+ }
+
+ if(sndjack_num_read_channels_allocated<chans){
+ printf("Error. Can not record %d channels. (Only %d)\n",chans,sndjack_num_read_channels_allocated);
+ return MUS_ERROR;
+ }
+
+ printf("dev: %d\n" ,dev);
+ if(format!=MUS_BYTE && format!=MUS_COMP_SHORT && format!=MUS_COMP_FLOAT){
+ printf("Error, unable to handle format %s.\n",mus_data_format_to_string(format));
+ return MUS_ERROR;
+ }
+
+ if(srate!=jack_get_sample_rate(sndjack_client)){
+ printf("Warning, jacks samplerate is %d (and not %d), and the recording will use this samplerate too.\n",jack_get_sample_rate(sndjack_client),srate);
+ }
+
+ sndjack_read_format=format;
+ sndjack_num_read_channels_inuse=chans;
+ sndjack_read_dev=dev;
+
+ return(MUS_NO_ERROR);
+}
+
+int jack_mus_audio_read(int line, char *buf, int bytes){
+ if(sndjack_read(buf,bytes,sndjack_num_read_channels_inuse)==-1)
+ return(MUS_ERROR);
+ return MUS_NO_ERROR;
+}
+
+
+static void jack_describe_audio_state_1(void) {
+ char temp[500];
+
+ pprint("jack audio:\n");
+ sprintf(temp,"\tNumber of output channels: %d\n",sndjack_num_channels_allocated);pprint(temp);
+ sprintf(temp,"\tNumber of input channels: %d\n",sndjack_num_read_channels_allocated);pprint(temp);
+ sprintf(temp,"\tSamplerate: %d\n",jack_get_sample_rate(sndjack_client));pprint(temp);
+ sprintf(temp,"\tJack buffersize: %d\n",sj_jackbuffersize);pprint(temp);
+ sprintf(temp,"\tSndjack buffersize: %d\n",SNDJACK_BUFFERSIZE);pprint(temp);
+ sprintf(temp,"\tMax number of instances: %d\n",SNDJACK_MAXSNDS);pprint(temp);
+ sprintf(temp,"\tTotal number of frames delayed: %d\n",sj_totalxrun);pprint(temp);
+ sprintf(temp,"\tCurrent cpu-load: %f\n",jack_cpu_load(sndjack_client));pprint(temp);
+ sprintf(temp,"\tIs running realtime: %s\n",jack_is_realtime(sndjack_client)==1?"yes":"no");pprint(temp);
+ sprintf(temp,"\tResample quality (only used when needed): %s (%s)\n",src_get_name(SRC_QUALITY),src_get_description(SRC_QUALITY));pprint(temp);
+ sprintf(temp,"\tIs able to handle the following audio formats: %s %s %s\n",mus_data_format_to_string(MUS_BYTE),mus_data_format_to_string(MUS_COMP_SHORT),mus_data_format_to_string(MUS_COMP_FLOAT));pprint(temp);
+ sprintf(temp,"\tPrefered audio format: %s\n",mus_data_format_to_string(MUS_COMP_FLOAT));pprint(temp);
+}
+
+
+int jack_mus_audio_systems(void) {
+ return(2);
+}
+
+char *jack_mus_audio_system_name(int system) {return("linux jack");}
+char *jack_mus_audio_moniker(void) {return("jack");}
+#endif
+
+
+
+/* ------------------------------- HPUX ----------------------------------------- */
+
+/* if this is basically the same as the Sun case with different macro names,
+ * then it could perhaps be updated to match the new Sun version above --
+ * Sun version changed 28-Jan-99
+ */
+
+#if defined(MUS_HPUX) && (!(defined(AUDIO_OK)))
+#define AUDIO_OK
+#include <sys/audio.h>
+
+#define RETURN_ERROR_EXIT(Error_Type, Audio_Line, Ur_Error_Message) \
+ do { char *Error_Message; Error_Message = Ur_Error_Message; \
+ if (Audio_Line != -1) close(Audio_Line); \
+ if (Error_Message) \
+ {MUS_STANDARD_ERROR(Error_Type, Error_Message); FREE(Error_Message);} \
+ else MUS_STANDARD_ERROR(Error_Type, mus_error_type_to_string(Error_Type)); \
+ return(MUS_ERROR); \
+ } while (false)
+
+char *mus_audio_moniker(void) {return("HPUX audio");}
+
+int mus_audio_open_output(int ur_dev, int srate, int chans, int format, int size)
+{
+ int fd, i, dev;
+ struct audio_describe desc;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ fd = open("/dev/audio", O_RDWR);
+ if (fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, -1,
+ mus_format("can't open /dev/audio for output: %s",
+ strerror(errno)));
+ ioctl(fd, AUDIO_SET_CHANNELS, chans);
+ if (dev == MUS_AUDIO_SPEAKERS)
+ ioctl(fd, AUDIO_SET_OUTPUT, AUDIO_OUT_SPEAKER);
+ else
+ if (dev == MUS_AUDIO_LINE_OUT)
+ ioctl(fd, AUDIO_SET_OUTPUT, AUDIO_OUT_LINE);
+ else ioctl(fd, AUDIO_SET_OUTPUT, AUDIO_OUT_HEADPHONE);
+ if (format == MUS_BSHORT)
+ ioctl(fd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_LINEAR16BIT);
+ else
+ if (format == MUS_MULAW)
+ ioctl(fd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_ULAW);
+ else
+ if (format == MUS_ALAW)
+ ioctl(fd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_ALAW);
+ else
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, fd,
+ mus_format("can't set output format to %d (%s) for %d (%s)",
+ format, mus_audio_format_name(format),
+ dev,
+ mus_audio_device_name(dev)));
+ ioctl(fd, AUDIO_DESCRIBE, &desc);
+ for(i = 0; i < desc.nrates; i++)
+ if(srate == desc.sample_rate[i])
+ break;
+ if (i == desc.nrates)
+ RETURN_ERROR_EXIT(SRATE_NOT_AVAILABLE, fd,
+ mus_format("can't set srate to %d on %d (%s)",
+ srate, dev,
+ mus_audio_device_name(dev)));
+ ioctl(fd, AUDIO_SET_SAMPLE_RATE, srate);
+ return(fd);
+}
+
+int mus_audio_write(int line, char *buf, int bytes)
+{
+ write(line, buf, bytes);
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_close(int line)
+{
+ close(line);
+ return(MUS_NO_ERROR);
+}
+
+static void describe_audio_state_1(void)
+{
+ struct audio_describe desc;
+ struct audio_gain gain;
+ int mina, maxa, fd, tmp;
+ int g[2];
+ fd = open("/dev/audio", O_RDWR);
+ if (fd == -1) return;
+ ioctl(fd, AUDIO_GET_OUTPUT, &tmp);
+ switch (tmp)
+ {
+ case AUDIO_OUT_SPEAKER: pprint("output: speakers\n"); break;
+ case AUDIO_OUT_HEADPHONE: pprint("output: headphone\n"); break;
+ case AUDIO_OUT_LINE: pprint("output: line out\n"); break;
+ }
+ ioctl(fd, AUDIO_GET_INPUT, &tmp);
+ switch (tmp)
+ {
+ case AUDIO_IN_MIKE: pprint("input: mic\n"); break;
+ case AUDIO_IN_LINE: pprint("input: line in\n"); break;
+ }
+ ioctl(fd, AUDIO_GET_DATA_FORMAT, &tmp);
+ switch (tmp)
+ {
+ case AUDIO_FORMAT_LINEAR16BIT: pprint("format: 16-bit linear\n"); break;
+ case AUDIO_FORMAT_ULAW: pprint("format: mulaw\n"); break;
+ case AUDIO_FORMAT_ALAW: pprint("format: alaw\n"); break;
+ }
+ ioctl(fd, AUDIO_DESCRIBE, &desc);
+ gain.channel_mask = (AUDIO_CHANNEL_LEFT | AUDIO_CHANNEL_RIGHT);
+ ioctl(fd, AUDIO_GET_GAINS, &gain);
+ close(fd);
+ g[0] = gain.cgain[0].transmit_gain;
+ g[1] = gain.cgain[1].transmit_gain;
+ mina = desc.min_transmit_gain;
+ maxa = desc.max_transmit_gain;
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "out vols: %.3f %.3f\n",
+ (float)(g[0] - mina) / (float)(maxa - mina),
+ (float)(g[1] - mina) / (float)(maxa - mina));
+ pprint(audio_strbuf);
+ g[0] = gain.cgain[0].receive_gain;
+ g[1] = gain.cgain[1].receive_gain;
+ mina = desc.min_receive_gain;
+ maxa = desc.max_receive_gain;
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "in vols: %.3f %.3f\n",
+ (float)(g[0] - mina) / (float)(maxa - mina),
+ (float)(g[1] - mina) / (float)(maxa - mina));
+ pprint(audio_strbuf);
+ g[0] = gain.cgain[0].monitor_gain;
+ g[1] = gain.cgain[1].monitor_gain;
+ mina = desc.min_monitor_gain;
+ maxa = desc.max_monitor_gain;
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "monitor vols: %.3f %.3f\n",
+ (float)(g[0] - mina) / (float)(maxa - mina),
+ (float)(g[1] - mina) / (float)(maxa - mina));
+ pprint(audio_strbuf);
+}
+
+int mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ struct audio_describe desc;
+ struct audio_gain gain;
+ int audio_fd = -1, srate, g, maxa, mina, dev, err = MUS_NO_ERROR;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ if (field == MUS_AUDIO_PORT)
+ {
+ val[0] = 4;
+ if (chan > 1) val[1] = MUS_AUDIO_MICROPHONE;
+ if (chan > 2) val[2] = MUS_AUDIO_DAC_OUT;
+ if (chan > 3) val[3] = MUS_AUDIO_LINE_OUT;
+ if (chan > 4) val[4] = MUS_AUDIO_LINE_IN;
+ }
+ else
+ {
+ if (field == FORMAT_FIELD)
+ {
+ val[0] = 3;
+ if (chan > 1) val[1] = MUS_BSHORT;
+ if (chan > 2) val[2] = MUS_MULAW;
+ if (chan > 3) val[3] = MUS_ALAW;
+ }
+ else
+ {
+ audio_fd = open("/dev/audio", O_RDWR);
+ ioctl(audio_fd, AUDIO_DESCRIBE, &desc);
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DAC_OUT:
+ case MUS_AUDIO_SPEAKERS:
+ case MUS_AUDIO_LINE_OUT:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ ioctl(audio_fd, AUDIO_GET_GAINS, &gain);
+ if (chan == 0)
+ g = gain.cgain[0].transmit_gain;
+ else g = gain.cgain[1].transmit_gain;
+ mina = desc.min_transmit_gain;
+ maxa = desc.max_transmit_gain;
+ val[0] = (float)(g - mina) / (float)(maxa - mina);
+ break;
+ case MUS_AUDIO_CHANNEL:
+ val[0] = 2;
+ break;
+ case MUS_AUDIO_SRATE:
+ ioctl(audio_fd, AUDIO_GET_SAMPLE_RATE, &srate);
+ val[0] = srate;
+ break;
+ default:
+ err = MUS_ERROR;
+ break;
+ }
+ break;
+ case MUS_AUDIO_MICROPHONE:
+ case MUS_AUDIO_LINE_IN:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ ioctl(audio_fd, AUDIO_GET_GAINS, &gain);
+ if (chan == 0)
+ g = gain.cgain[0].receive_gain;
+ else g = gain.cgain[1].receive_gain;
+ mina = desc.min_receive_gain;
+ maxa = desc.max_receive_gain;
+ val[0] = (float)(g - mina) / (float)(maxa - mina);
+ break;
+ case MUS_AUDIO_CHANNEL:
+ val[0] = 2;
+ break;
+ case MUS_AUDIO_SRATE:
+ ioctl(audio_fd, AUDIO_GET_SAMPLE_RATE, &srate);
+ val[0] = srate;
+ break;
+ default:
+ err = MUS_ERROR;
+ break;
+ }
+ break;
+ default:
+ err = MUS_ERROR;
+ break;
+ }
+ }
+ }
+ if (err == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't read %s field of device %d (%s)",
+ mus_audio_device_name(field),
+ dev,
+ mus_audio_device_name(dev)));
+
+ if (audio_fd != -1) close(audio_fd);
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ struct audio_describe desc;
+ struct audio_gain gain;
+ int audio_fd = -1, srate, g, maxa, mina, dev, err = MUS_NO_ERROR;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ audio_fd = open("/dev/audio", O_RDWR);
+ ioctl(audio_fd, AUDIO_DESCRIBE, &desc);
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DAC_OUT:
+ case MUS_AUDIO_SPEAKERS:
+ case MUS_AUDIO_LINE_OUT:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ mina = desc.min_transmit_gain;
+ maxa = desc.max_transmit_gain;
+ ioctl(audio_fd, AUDIO_GET_GAINS, &gain);
+ g = mina + val[0] * (maxa - mina);
+ if (chan == 0)
+ gain.cgain[0].transmit_gain = g;
+ else gain.cgain[1].transmit_gain = g;
+ ioctl(audio_fd, AUDIO_SET_GAINS, &gain);
+ break;
+ case MUS_AUDIO_SRATE:
+ srate = val[0];
+ ioctl(audio_fd, AUDIO_SET_SAMPLE_RATE, srate);
+ break;
+ default:
+ err = MUS_ERROR;
+ break;
+ }
+ break;
+ case MUS_AUDIO_MICROPHONE:
+ case MUS_AUDIO_LINE_IN:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ mina = desc.min_receive_gain;
+ maxa = desc.max_receive_gain;
+ ioctl(audio_fd, AUDIO_GET_GAINS, &gain);
+ g = mina + val[0] * (maxa - mina);
+ if (chan == 0)
+ gain.cgain[0].receive_gain = g;
+ else gain.cgain[1].receive_gain = g;
+ ioctl(audio_fd, AUDIO_SET_GAINS, &gain);
+ break;
+ case MUS_AUDIO_SRATE:
+ srate = val[0];
+ ioctl(audio_fd, AUDIO_SET_SAMPLE_RATE, srate);
+ break;
+ default:
+ err = MUS_ERROR;
+ break;
+ }
+ break;
+ default:
+ err = MUS_ERROR;
+ break;
+ }
+ if (err == MUS_ERROR)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't set %s field of device %d (%s)",
+ mus_audio_device_name(field),
+ dev,
+ mus_audio_device_name(dev)));
+
+ if (audio_fd != -1) close(audio_fd);
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_initialize(void) {return(MUS_NO_ERROR);}
+
+int mus_audio_systems(void) {return(1);}
+char *mus_audio_system_name(int system) {return("HPUX");}
+
+/* struct audio_status status_b;
+ * ioctl(devAudio, AUDIO_GET_STATUS, &status_b)
+ * not_busy = (status_b.transmit_status == AUDIO_DONE);
+*/
+
+int mus_audio_open_input(int ur_dev, int srate, int chans, int format, int size)
+{
+ int fd, i, dev;
+ struct audio_describe desc;
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ fd = open("/dev/audio", O_RDWR);
+ if (fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, NULL,
+ mus_format("can't open /dev/audio for input: %s",
+ strerror(errno)));
+ ioctl(fd, AUDIO_SET_CHANNELS, chans);
+ if (dev == MUS_AUDIO_MICROPHONE)
+ ioctl(fd, AUDIO_SET_INPUT, AUDIO_IN_MIKE);
+ else ioctl(fd, AUDIO_SET_INPUT, AUDIO_IN_LINE);
+ if (format == MUS_BSHORT)
+ ioctl(fd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_LINEAR16BIT);
+ else
+ if (format == MUS_MULAW)
+ ioctl(fd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_ULAW);
+ else
+ if (format == MUS_ALAW)
+ ioctl(fd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_ALAW);
+ else
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, fd,
+ mus_format("can't set input format to %d (%s) on %d (%s)",
+ format, mus_audio_format_name(format),
+ dev,
+ mus_audio_device_name(dev)));
+ ioctl(fd, AUDIO_DESCRIBE, &desc);
+ for(i = 0; i < desc.nrates; i++)
+ if(srate == desc.sample_rate[i])
+ break;
+ if (i == desc.nrates)
+ RETURN_ERROR_EXIT(MUS_AUDIO_SRATE_NOT_AVAILABLE, fd,
+ mus_format("can't set srate to %d on %d (%s)",
+ srate, dev,
+ mus_audio_device_name(dev)));
+ ioctl(fd, AUDIO_SET_SAMPLE_RATE, srate);
+ return(fd);
+}
+
+int mus_audio_read(int line, char *buf, int bytes)
+{
+ read(line, buf, bytes);
+ return(MUS_NO_ERROR);
+}
+
+#endif
+
+
+
+/* ------------------------------- NETBSD ----------------------------------------- */
+
+#if defined(MUS_NETBSD) && (!(defined(AUDIO_OK)))
+#define AUDIO_OK
+/* started from Xanim a long time ago..., bugfixes from Thomas Klausner 30-Jul-05, worked into better shape Aug-05 */
+#include <fcntl.h>
+#include <sys/audioio.h>
+#include <sys/ioctl.h>
+
+#define RETURN_ERROR_EXIT(Error_Type, Audio_Line, Ur_Error_Message) \
+ do { char *Error_Message; Error_Message = Ur_Error_Message; \
+ if (Audio_Line != -1) close(Audio_Line); \
+ if (Error_Message) \
+ {MUS_STANDARD_ERROR(Error_Type, Error_Message); FREE(Error_Message);} \
+ else MUS_STANDARD_ERROR(Error_Type, mus_error_type_to_string(Error_Type)); \
+ return(MUS_ERROR); \
+ } while (false)
+
+static int bsd_format_to_sndlib(int encoding)
+{
+ switch (encoding)
+ {
+ case AUDIO_ENCODING_ULAW: return(MUS_MULAW); break;
+ case AUDIO_ENCODING_ALAW: return(MUS_ALAW); break;
+ case AUDIO_ENCODING_LINEAR: return(MUS_BSHORT); break; /* "sun compatible" so probably big-endian? */
+ case AUDIO_ENCODING_SLINEAR:
+ case AUDIO_ENCODING_LINEAR8: return(MUS_BYTE); break;
+ case AUDIO_ENCODING_SLINEAR_LE: return(MUS_LSHORT); break;
+ case AUDIO_ENCODING_SLINEAR_BE: return(MUS_BSHORT); break;
+ case AUDIO_ENCODING_ULINEAR_LE: return(MUS_ULSHORT); break;
+ case AUDIO_ENCODING_ULINEAR_BE: return(MUS_UBSHORT); break;
+ case AUDIO_ENCODING_ULINEAR: return(MUS_UBYTE); break;
+ case AUDIO_ENCODING_NONE:
+ case AUDIO_ENCODING_ADPCM:
+ default: return(MUS_UNKNOWN); break;
+ }
+ return(MUS_UNKNOWN);
+}
+
+static int sndlib_format_to_bsd(int encoding)
+{
+ switch (encoding)
+ {
+ case MUS_MULAW: return(AUDIO_ENCODING_ULAW); break;
+ case MUS_ALAW: return(AUDIO_ENCODING_ALAW); break;
+ case MUS_BYTE: return(AUDIO_ENCODING_SLINEAR); break;
+ case MUS_LSHORT: return(AUDIO_ENCODING_SLINEAR_LE); break;
+ case MUS_BSHORT: return(AUDIO_ENCODING_SLINEAR_BE); break;
+ case MUS_ULSHORT: return(AUDIO_ENCODING_ULINEAR_LE); break;
+ case MUS_UBSHORT: return(AUDIO_ENCODING_ULINEAR_BE); break;
+ case MUS_UBYTE: return(AUDIO_ENCODING_ULINEAR); break;
+ }
+ return(AUDIO_ENCODING_NONE);
+}
+
+int mus_audio_initialize(void)
+{
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_systems(void)
+{
+ return(1);
+}
+
+char *mus_audio_system_name(int system)
+{
+ return("NetBSD");
+}
+
+char *mus_audio_moniker(void)
+{
+ return("NetBSD audio");
+}
+
+static int cur_chans = 1, cur_srate = 22050;
+
+int mus_audio_write(int line, char *buf, int bytes)
+{
+ /* trouble... AUDIO_WSEEK always returns 0, no way to tell that I'm about to
+ * hit "hiwat", but when I do, it hangs. Can't use AUDIO_DRAIN --
+ * it introduces interruptions. Not sure what to do...
+ */
+ int b = 0;
+ b = write(line, buf, bytes);
+ usleep(10000);
+ if ((b != bytes) && (b > 0)) /* b <= 0 presumably some sort of error, and we want to avoid infinite recursion below */
+ {
+ /* hangs at close if we don't handle this somehow */
+ if ((cur_chans == 1) || (cur_srate == 22050))
+ sleep(1);
+ else usleep(10000);
+ mus_audio_write(line, (char *)(buf + b), bytes - b);
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_audio_close(int line)
+{
+ usleep(100000);
+ ioctl(line, AUDIO_FLUSH, 0);
+ close(line);
+ return(MUS_NO_ERROR);
+}
+
+static int netbsd_default_outputs = (AUDIO_HEADPHONE | AUDIO_LINE_OUT | AUDIO_SPEAKER);
+
+void mus_netbsd_set_outputs(int speakers, int headphones, int line_out)
+{
+ netbsd_default_outputs = 0;
+ if (speakers) netbsd_default_outputs |= AUDIO_SPEAKER;
+ if (headphones) netbsd_default_outputs |= AUDIO_HEADPHONE;
+ if (line_out) netbsd_default_outputs |= AUDIO_LINE_OUT;
+}
+
+int mus_audio_open_output(int dev, int srate, int chans, int format, int size)
+{
+ int line, encode;
+ audio_info_t a_info;
+
+ line = open("/dev/sound", O_WRONLY | O_NDELAY); /* /dev/audio assumes mono 8-bit mulaw */
+ if (line == -1)
+ {
+ if (errno == EBUSY)
+ return(mus_error(MUS_AUDIO_CANT_OPEN, NULL));
+ else return(mus_error(MUS_AUDIO_DEVICE_NOT_AVAILABLE, NULL));
+ }
+ AUDIO_INITINFO(&a_info);
+
+ /* a_info.blocksize = size; */
+ encode = sndlib_format_to_bsd(format);
+ if (encode == AUDIO_ENCODING_NONE)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, -1,
+ mus_format("format %d (%s) not available",
+ format,
+ mus_data_format_name(format)));
+ a_info.play.encoding = encode;
+ a_info.mode = AUMODE_PLAY | AUMODE_PLAY_ALL;
+ a_info.play.precision = mus_bytes_per_sample(format) * 8;
+ a_info.play.sample_rate = srate;
+ if (dev == MUS_AUDIO_LINE_OUT)
+ a_info.play.port = AUDIO_LINE_OUT;
+ else
+ {
+ if (dev == MUS_AUDIO_SPEAKERS)
+ a_info.play.port = AUDIO_SPEAKER | (netbsd_default_outputs & AUDIO_HEADPHONE);
+ else a_info.play.port = netbsd_default_outputs;
+ }
+ a_info.play.channels = chans;
+ ioctl(line, AUDIO_SETINFO, &a_info);
+ /* actually doesn't set the "ports" field -- always 0 */
+
+ ioctl(line, AUDIO_GETINFO, &a_info);
+
+ if ((int)(a_info.play.sample_rate) != srate)
+ mus_print("srate: %d -> %d\n", srate, a_info.play.sample_rate);
+ if ((int)(a_info.play.encoding) != sndlib_format_to_bsd(format))
+ mus_print("encoding: %d -> %d\n", sndlib_format_to_bsd(format), a_info.play.encoding);
+ if ((int)(a_info.play.channels) != chans)
+ mus_print("chans: %d -> %d\n", chans, a_info.play.channels);
+
+ cur_chans = chans;
+ cur_srate = srate;
+
+ return(line);
+}
+
+int mus_audio_read(int line, char *buf, int bytes)
+{
+ read(line, buf, bytes);
+ return(MUS_NO_ERROR);
+}
+
+static void describe_audio_state_1(void)
+{
+ audio_device_t dev;
+ int i = 0, val, err = 0;
+ int line;
+ float amp;
+ audio_info_t a_info;
+ audio_encoding_t e_info;
+
+ pprint("NetBSD ");
+ line = open("/dev/sound", O_WRONLY | O_NDELAY);
+ if (line == -1)
+ return;
+
+ pprint("/dev/sound:\n");
+ err = ioctl(line, AUDIO_GETDEV, &dev);
+ if (err == 0)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "%s: version: %s (%s)", dev.name, dev.version, dev.config);
+ pprint(audio_strbuf);
+ }
+
+ err = ioctl(line, AUDIO_GETPROPS, &val);
+ if (err == 0)
+ {
+ if (val & AUDIO_PROP_FULLDUPLEX)
+ pprint(" full-duplex");
+ else pprint(" half-duplex");
+ }
+ pprint("\n");
+
+ err = ioctl(line, AUDIO_GETINFO, &a_info);
+ if (err == 0)
+ {
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " play: srate: %d, chans: %d, format: %s (%d bits), ",
+ a_info.play.sample_rate,
+ a_info.play.channels,
+ mus_data_format_short_name(bsd_format_to_sndlib(a_info.play.encoding)),
+ a_info.play.precision);
+ pprint(audio_strbuf);
+
+ amp = (float)(a_info.play.gain - AUDIO_MIN_GAIN) / (float)(AUDIO_MAX_GAIN - AUDIO_MIN_GAIN);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "volume: %.3f %.3f (gain: %d, balance: %d)\n",
+ amp * (1.0 - ((float)(a_info.play.balance) / (float)(2 * AUDIO_MID_BALANCE))),
+ amp * ((float)(a_info.play.balance) / (float)(2 * AUDIO_MID_BALANCE)),
+ a_info.play.gain, a_info.play.balance);
+ pprint(audio_strbuf);
+
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " record: srate: %d, chans: %d, format: %s (%d bits), ",
+ a_info.record.sample_rate,
+ a_info.record.channels,
+ mus_data_format_short_name(bsd_format_to_sndlib(a_info.record.encoding)),
+ a_info.record.precision);
+ pprint(audio_strbuf);
+
+ amp = (float)(a_info.record.gain - AUDIO_MIN_GAIN) / (float)(AUDIO_MAX_GAIN - AUDIO_MIN_GAIN);
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, "volume: %.3f %.3f (gain: %d, balance: %d)\n",
+ amp * (1.0 - ((float)(a_info.record.balance) / (float)(2 * AUDIO_MID_BALANCE))),
+ amp * ((float)(a_info.record.balance) / (float)(2 * AUDIO_MID_BALANCE)),
+ a_info.record.gain, a_info.record.balance);
+ pprint(audio_strbuf);
+ }
+
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " available encodings:\n");
+ pprint(audio_strbuf);
+
+ for (i = 0; ; i++)
+ {
+ e_info.index = i;
+ err = ioctl(line, AUDIO_GETENC, &e_info);
+ if (err != 0) break;
+ mus_snprintf(audio_strbuf, PRINT_BUFFER_SIZE, " %s (%s, bits: %d)\n",
+ mus_data_format_short_name(bsd_format_to_sndlib(e_info.encoding)),
+ e_info.name,
+ e_info.precision);
+ pprint(audio_strbuf);
+ }
+
+ close(line);
+
+#if 0
+ /* I don't see anything useful in all this mixer data, so I'll omit it */
+ fprintf(stderr,"/dev/mixer:\n");
+ line = open("/dev/mixer", O_RDONLY | O_NDELAY);
+ if (line == -1)
+ return;
+ val = ioctl(line, AUDIO_GETDEV, &dev);
+ fprintf(stderr, "\n%d, name: %s, version: %s, config: %s\n",
+ val, dev.name, dev.version, dev.config);
+ for (i = 0; ; i++)
+ {
+ mdev.index = i;
+ val = ioctl(line, AUDIO_MIXER_DEVINFO, &mdev);
+ if (val != 0) break;
+ fprintf(stderr,"%d: name: %s ", i, mdev.label.name);
+ fprintf(stderr,"class: %d, type: %d, units: %s, chans: %d, delta: %d\n",
+ mdev.mixer_class, mdev.type, mdev.un.v.units.name, mdev.un.v.num_channels, mdev.un.v.delta);
+ mx.dev = i;
+ ioctl(line, AUDIO_MIXER_READ, &mx);
+ switch (mx.type)
+ {
+ case AUDIO_MIXER_CLASS:
+ fprintf(stderr, "mixer read: class type?\n");
+ break;
+ case AUDIO_MIXER_ENUM:
+ fprintf(stderr, "mixer read: enum: %d\n", mx.un.ord);
+ break;
+ case AUDIO_MIXER_SET:
+ case AUDIO_MIXER_VALUE:
+ {
+ int j;
+ ml = mx.un.value;
+ fprintf(stderr, "mixer read: level: %d chans [", ml.num_channels);
+ for (j = 0; j < ml.num_channels; j++)
+ fprintf(stderr, "%d ", (int)(ml.level[j]));
+ fprintf(stderr, "]\n");
+ }
+ break;
+ default:
+ fprintf(stderr, "mixer read: unknown type? %d\n", mx.type);
+ break;
+ }
+ }
+#endif
+}
+
+int mus_audio_mixer_read(int ur_dev, int field, int chan, float *val)
+{
+ int i, audio_fd, err, dev;
+ audio_info_t info;
+ bool ok = true;
+
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ AUDIO_INITINFO(&info);
+ audio_fd = open("/dev/sound", O_RDONLY | O_NONBLOCK, 0);
+ if (audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, -1,
+ mus_format("can't open /dev/sound: %s",
+ strerror(errno)));
+ err = ioctl(audio_fd, AUDIO_GETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't get dac info"));
+
+ if (field == MUS_AUDIO_PORT)
+ {
+ val[0] = 1;
+ val[1] = MUS_AUDIO_MICROPHONE;
+ }
+ else
+ {
+ if (field == MUS_AUDIO_FORMAT)
+ {
+ audio_encoding_t e_info;
+ for (i = 0; ; i++)
+ {
+ e_info.index = i;
+ err = ioctl(audio_fd, AUDIO_GETENC, &e_info);
+ if (err != 0) break;
+ val[i + 1] = bsd_format_to_sndlib(e_info.encoding);
+ }
+ val[0] = i;
+ }
+ else
+ {
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DAC_OUT:
+ case MUS_AUDIO_SPEAKERS:
+ case MUS_AUDIO_LINE_OUT:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ {
+ float amp;
+ amp = (float)(info.play.gain - AUDIO_MIN_GAIN) / (float)(AUDIO_MAX_GAIN - AUDIO_MIN_GAIN);
+ if (chan == 0)
+ val[0] = amp * (1.0 - ((float)(info.play.balance) / (float)(2 * AUDIO_MID_BALANCE)));
+ else val[0] = amp * ((float)(info.play.balance) / (float)(2 * AUDIO_MID_BALANCE));
+ }
+ break;
+ case MUS_AUDIO_CHANNEL:
+ val[0] = 2;
+ break;
+ case MUS_AUDIO_SRATE:
+ val[0] = (float)info.play.sample_rate;
+ break;
+ default:
+ ok = false;
+ break;
+ }
+ break;
+ case MUS_AUDIO_MICROPHONE:
+ case MUS_AUDIO_LINE_IN:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ case MUS_AUDIO_CD:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ {
+ float amp;
+ amp = (float)(info.record.gain - AUDIO_MIN_GAIN) / (float)(AUDIO_MAX_GAIN - AUDIO_MIN_GAIN);
+ if (chan == 0)
+ val[0] = amp * (1.0 - ((float)(info.record.balance) / (float)(2 * AUDIO_MID_BALANCE)));
+ else val[0] = amp * ((float)(info.record.balance) / (float)(2 * AUDIO_MID_BALANCE));
+ }
+ break;
+ case MUS_AUDIO_CHANNEL:
+ val[0] = 1;
+ break;
+ case MUS_AUDIO_SRATE:
+ val[0] = (float)(info.record.sample_rate);
+ break;
+ default:
+ ok = false;
+ break;
+ }
+ break;
+ default:
+ ok = false;
+ break;
+ }
+ }
+ }
+ if (!ok)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't read %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ return(mus_audio_close(audio_fd));
+}
+
+int mus_audio_mixer_write(int ur_dev, int field, int chan, float *val)
+{
+ audio_info_t info;
+ int dev, audio_fd, err;
+ bool ok = true;
+
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ AUDIO_INITINFO(&info);
+
+ audio_fd = open("/dev/sound", O_RDWR | O_NONBLOCK, 0);
+ if (audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, -1,
+ mus_format("can't open /dev/sound: %s",
+ strerror(errno)));
+
+ err = ioctl(audio_fd, AUDIO_GETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_READ, audio_fd,
+ mus_format("can't get /dev/sound info"));
+
+ switch (dev)
+ {
+ case MUS_AUDIO_DEFAULT:
+ case MUS_AUDIO_DAC_OUT:
+ case MUS_AUDIO_SPEAKERS:
+ case MUS_AUDIO_LINE_OUT:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ info.play.balance = AUDIO_MID_BALANCE;
+ info.play.gain = AUDIO_MIN_GAIN + (int)((AUDIO_MAX_GAIN - AUDIO_MIN_GAIN) * val[0]);
+ break;
+ case MUS_AUDIO_CHANNEL:
+ info.play.channels = (int)val[0];
+ break;
+ case MUS_AUDIO_SRATE:
+ info.play.sample_rate = (int)val[0];
+ break;
+ default:
+ ok = false;
+ break;
+ }
+ break;
+ case MUS_AUDIO_MICROPHONE:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ info.record.gain = AUDIO_MIN_GAIN + (int)((AUDIO_MAX_GAIN - AUDIO_MIN_GAIN) * val[0]);
+ info.record.balance = AUDIO_MID_BALANCE;
+ break;
+ case MUS_AUDIO_CHANNEL:
+ info.record.channels = (int)val[0];
+ break;
+ case MUS_AUDIO_SRATE:
+ info.record.sample_rate = (int)val[0];
+ break;
+ default:
+ ok = false;
+ break;
+ }
+ break;
+ case MUS_AUDIO_LINE_IN:
+ case MUS_AUDIO_DUPLEX_DEFAULT:
+ case MUS_AUDIO_CD:
+ switch (field)
+ {
+ case MUS_AUDIO_AMP:
+ info.record.balance = AUDIO_MID_BALANCE;
+ info.record.gain = AUDIO_MIN_GAIN + (int)((AUDIO_MAX_GAIN - AUDIO_MIN_GAIN) * val[0]);
+ break;
+ case MUS_AUDIO_CHANNEL:
+ info.record.channels = (int)val[0];
+ break;
+ case MUS_AUDIO_SRATE:
+ info.record.sample_rate = (int)val[0];
+ break;
+ default:
+ ok = false;
+ break;
+ }
+ break;
+ default:
+ ok = false;
+ break;
+ }
+ if (ok)
+ ioctl(audio_fd, AUDIO_SETINFO, &info);
+ else
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't write %s field %d (%s)",
+ mus_audio_device_name(dev),
+ field,
+ mus_audio_device_name(field)));
+ return(mus_audio_close(audio_fd));
+}
+
+int mus_audio_open_input(int ur_dev, int srate, int chans, int format, int size)
+{
+ audio_info_t info;
+ int encode, bits, dev, audio_fd, err;
+
+ dev = MUS_AUDIO_DEVICE(ur_dev);
+ encode = sndlib_format_to_bsd(format);
+ bits = 8 * mus_bytes_per_sample(format);
+ if (encode == AUDIO_ENCODING_NONE)
+ RETURN_ERROR_EXIT(MUS_AUDIO_FORMAT_NOT_AVAILABLE, -1,
+ mus_format("format %s not available for recording",
+ mus_data_format_name(format)));
+
+ if (dev != MUS_AUDIO_DUPLEX_DEFAULT)
+ audio_fd = open("/dev/sound", O_RDONLY, 0);
+ else audio_fd = open("/dev/sound", O_RDWR, 0);
+ if (audio_fd == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_OPEN, -1,
+ mus_format("can't open /dev/sound: %s",
+ strerror(errno)));
+
+ AUDIO_INITINFO(&info);
+ info.record.sample_rate = srate;
+ info.record.channels = chans;
+ info.record.precision = bits;
+ info.record.encoding = encode;
+ info.record.port = AUDIO_MICROPHONE;
+ err = ioctl(audio_fd, AUDIO_SETINFO, &info);
+ if (err == -1)
+ RETURN_ERROR_EXIT(MUS_AUDIO_CANT_WRITE, audio_fd,
+ mus_format("can't set up for recording"));
+ return(audio_fd);
+}
+
+#endif
+
+
+
+/* ------------------------------- STUBS ----------------------------------------- */
+
+#ifndef AUDIO_OK
+static void describe_audio_state_1(void) {pprint("audio stubbed out");}
+int mus_audio_open_output(int dev, int srate, int chans, int format, int size) {return(MUS_ERROR);}
+int mus_audio_open_input(int dev, int srate, int chans, int format, int size) {return(MUS_ERROR);}
+int mus_audio_write(int line, char *buf, int bytes) {return(MUS_ERROR);}
+int mus_audio_close(int line) {return(MUS_ERROR);}
+int mus_audio_read(int line, char *buf, int bytes) {return(MUS_ERROR);}
+int mus_audio_mixer_read(int dev, int field, int chan, float *val) {return(MUS_ERROR);}
+int mus_audio_mixer_write(int dev, int field, int chan, float *val) {return(MUS_ERROR);}
+int mus_audio_initialize(void) {return(MUS_ERROR);}
+int mus_audio_systems(void) {return(0);}
+char *mus_audio_system_name(int system) {return("none");}
+char *mus_audio_moniker(void) {return("no audio support");}
+#endif
+
+
+
+static char *save_it = NULL;
+static int print_it = 1;
+static int save_it_len = 0;
+static int save_it_loc = 0;
+
+static void pprint(char *str)
+{
+ int i, len;
+ if ((str) && (*str))
+ {
+ if ((print_it) || (!(save_it)))
+ {
+ mus_print(str);
+ }
+ else
+ {
+ len = strlen(str);
+ if ((len + save_it_loc + 2) >= save_it_len)
+ {
+ save_it_len = (len + save_it_loc + 1024);
+ save_it = (char *)REALLOC(save_it, save_it_len * sizeof(char));
+ }
+ for (i = 0; i < len; i++)
+ save_it[save_it_loc++] = str[i];
+ save_it[save_it_loc] = 0;
+ }
+ }
+}
+
+char *mus_audio_report(void)
+{
+ mus_audio_initialize();
+ if (!(save_it))
+ {
+ save_it_len = 1024;
+ save_it = (char *)CALLOC(save_it_len, sizeof(char));
+ }
+ save_it_loc = 0;
+ print_it = 0;
+ if (!audio_strbuf) audio_strbuf = (char *)CALLOC(PRINT_BUFFER_SIZE, sizeof(char));
+ describe_audio_state_1();
+ return(save_it);
+}
+
+void mus_audio_describe(void)
+{
+ mus_audio_initialize();
+ print_it = 1;
+ if (!audio_strbuf) audio_strbuf = (char *)CALLOC(PRINT_BUFFER_SIZE, sizeof(char));
+ describe_audio_state_1();
+}
+
+/* for CLM */
+void mus_reset_audio_c(void)
+{
+ audio_initialized = false;
+ save_it = NULL;
+ version_name = NULL;
+#ifdef MUS_SUN
+ sun_vol_name = NULL;
+#endif
+ save_it_len = 0;
+ audio_strbuf = NULL;
+}
+
+
+int mus_audio_compatible_format(int dev)
+{
+#if HAVE_ALSA || HAVE_JACK
+ int err, i;
+ float val[32];
+ int ival[32];
+ err = mus_audio_mixer_read(dev, MUS_AUDIO_FORMAT, 32, val);
+ if (err != MUS_ERROR)
+ {
+ for (i = 0; i <= (int)(val[0]); i++) ival[i] = (int)(val[i]);
+ /* ^ this cast is vital! Memory clobbered otherwise in LinuxPPC */
+ for (i = 1; i <= ival[0]; i++)
+ if (ival[i] == MUS_AUDIO_COMPATIBLE_FORMAT)
+ return(MUS_AUDIO_COMPATIBLE_FORMAT);
+ for (i = 1; i <= ival[0]; i++)
+ if ((ival[i] == MUS_BINT) || (ival[i] == MUS_LINT) ||
+ (ival[i] == MUS_BFLOAT) || (ival[i] == MUS_LFLOAT) ||
+ (ival[i] == MUS_BSHORT) || (ival[i] == MUS_LSHORT))
+ return(ival[i]);
+ for (i = 1; i <= ival[0]; i++)
+ if ((ival[i] == MUS_MULAW) || (ival[i] == MUS_ALAW) ||
+ (ival[i] == MUS_UBYTE) || (ival[i] == MUS_BYTE))
+ return(ival[i]);
+ return(ival[1]);
+ }
+#endif
+ return(MUS_AUDIO_COMPATIBLE_FORMAT);
+}
+
+
+/* next two added 17-Dec-02 for non-interleaved audio IO */
+static char *output_buffer = NULL;
+static int output_buffer_size = 0;
+
+int mus_audio_write_buffers(int port, int frames, int chans, mus_sample_t **bufs, int output_format, bool clipped)
+{
+ int bytes;
+ bytes = chans * frames * mus_bytes_per_sample(output_format);
+ if (output_buffer_size < bytes)
+ {
+ if (output_buffer) free(output_buffer);
+ output_buffer = (char *)malloc(bytes);
+ output_buffer_size = bytes;
+ }
+ mus_file_write_buffer(output_format, 0, frames - 1, chans, bufs, output_buffer, clipped);
+ return(mus_audio_write(port, output_buffer, bytes));
+}
+
+static char *input_buffer = NULL;
+static int input_buffer_size = 0;
+
+int mus_audio_read_buffers(int port, int frames, int chans, mus_sample_t **bufs, int input_format)
+{
+ int bytes;
+ bytes = chans * frames * mus_bytes_per_sample(input_format);
+ if (input_buffer_size < bytes)
+ {
+ if (input_buffer) free(input_buffer);
+ input_buffer = (char *)malloc(bytes);
+ input_buffer_size = bytes;
+ }
+ mus_audio_read(port, input_buffer, bytes);
+ return(mus_file_read_buffer(input_format, 0, chans, frames, bufs, input_buffer));
+}
diff --git a/third_party/resample/sndlib-20/configure b/third_party/resample/sndlib-20/configure
new file mode 100644
index 00000000..251a436e
--- /dev/null
+++ b/third_party/resample/sndlib-20/configure
@@ -0,0 +1,13033 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.60 for sndlib 20.
+#
+# Report bugs to <bil@ccrma.stanford.edu>.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 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 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
+
+
+# PATH needs CR
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+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.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+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
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+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
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+# 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
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+# 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
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. 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" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # 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
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+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
+fi
+echo >conf$$.file
+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 -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+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=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
+
+# 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 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, 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=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='sndlib'
+PACKAGE_TARNAME='sndlib'
+PACKAGE_VERSION='20'
+PACKAGE_STRING='sndlib 20'
+PACKAGE_BUGREPORT='bil@ccrma.stanford.edu'
+
+ac_unique_file="io.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+CPP
+GREP
+EGREP
+SNDLIB_BITS
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+GSL_CONFIG
+GSL_LIBS
+GSL_CFLAGS
+GUILE_LIBS
+GUILE_CFLAGS
+GAUCHE_CONFIG
+FTH_VERSION
+FTH_CFLAGS
+FTH_LIBS
+FTH_HAVE_COMPLEX
+FTH_HAVE_RATIO
+FTH
+XM_LIBS
+AUDIO_LIB
+LDSO_FLAGS
+SO_FLAGS
+SO_INSTALL
+A_INSTALL
+SO_LD
+A_LD
+A_LD_FLAGS
+LD_FLAGS
+SNDLIB_VERSION
+SNDLIB_LANGUAGE
+SNDLIB_MODULES
+AUDIO_CHOICE
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# 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=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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval enable_$ac_feature=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_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval enable_$ac_feature=\$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_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval with_$ac_package=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval with_$ac_package=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 ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ 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'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute directory names.
+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
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+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
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ 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 .` ||
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# 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 -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
+ 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 .."
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ 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 sndlib 20 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/sndlib]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of sndlib 20:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-largefile omit support for large files
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-esd use ESD
+ --with-alsa use ALSA
+ --with-jack use JACK
+ --with-static-alsa use ALSA statically loaded
+ --with-doubles use doubles throughout
+ --with-guile use Guile
+ --with-modules use if sndlib uses modules
+ --with-hobbit include hobbit-style function arity checking
+ --with-gauche use Gauche
+ --with-float-samples use floats as the internal sample respresentation
+ --with-sample-width=N use N bits of samples
+ --with-ruby-prefix=PFX where Ruby is installed
+ --with-ruby try to use Ruby as the extension language
+ --with-forth try to use Forth as the extension language
+
+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>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+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 <bil@ccrma.stanford.edu>.
+_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" || continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`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
+ 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
+sndlib configure 20
+generated by GNU Autoconf 2.60
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 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
+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 sndlib $as_me 20, which was
+generated by GNU Autoconf 2.60. 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=.
+ 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=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$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
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export 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
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ 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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_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
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ 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'; { (exit 1); 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
+
+# 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
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -n "$CONFIG_SITE"; then
+ set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
+fi
+shift
+for ac_site_file
+do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ 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.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+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,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+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
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`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.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+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
+
+
+SNDLIB_VERSION=20
+
+ac_config_files="$ac_config_files makefile"
+
+ac_config_files="$ac_config_files sndlib-config"
+
+ac_config_files="$ac_config_files sndins/Makefile"
+
+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
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+ { (exit 1); exit 1; }; }
+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 ||
+ { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 &&
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
+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
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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` ||
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
+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
+
+
+ac_config_headers="$ac_config_headers mus-config.h sndlib.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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$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
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$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
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$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
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_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"
+ echo "$as_me:$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
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$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
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$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
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out 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.
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; 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 | *.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
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; 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 | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; 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 ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ 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
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$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
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* 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"
+ 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+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)
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ xno)
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+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
+
+
+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
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f 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
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+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
+
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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"
+ { test -f "$ac_path_GREP" && $as_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
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ 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
+ ac_count=`expr $ac_count + 1`
+ 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
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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"
+ { test -f "$ac_path_EGREP" && $as_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
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ 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
+ ac_count=`expr $ac_count + 1`
+ 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
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ 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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+audio_system="unknown"
+
+#--------------------------------------------------------------------------------
+# configuration options
+# --with-alsa use ALSA if possible
+# --with-jack use Jack
+# --with-static-alsa use ALSA statically loaded (for RPM generation)
+# --with-doubles use doubles throughout (default is floats)
+# --with-float-samples represent samples internally as floats
+# --with-sample-width=N use N bits of samples (default = 24)
+# --with-esd use Enlightened Sound Daemon
+# --with-guile build with Guile (default)
+# --with-ruby try to use Ruby as the extension language
+# --with-ruby-prefix set prefix for ruby.h
+# --with-forth use Forth as extension language
+# --with-gauche use Gauche as extension language
+# --with-static-gsl try to statically load GSL
+# --with-modules put sndlib names into modules
+# --with-hobbit include hobbit-style function arity checking
+#--------------------------------------------------------------------------------
+
+
+# Check whether --with-esd was given.
+if test "${with_esd+set}" = set; then
+ withval=$with_esd;
+fi
+
+
+# Check whether --with-alsa was given.
+if test "${with_alsa+set}" = set; then
+ withval=$with_alsa;
+fi
+
+
+# Check whether --with-jack was given.
+if test "${with_jack+set}" = set; then
+ withval=$with_jack;
+fi
+
+
+# Check whether --with-static-alsa was given.
+if test "${with_static_alsa+set}" = set; then
+ withval=$with_static_alsa;
+fi
+
+
+# Check whether --with-doubles was given.
+if test "${with_doubles+set}" = set; then
+ withval=$with_doubles;
+fi
+
+
+# Check whether --with-guile was given.
+if test "${with_guile+set}" = set; then
+ withval=$with_guile;
+fi
+
+
+# Check whether --with-modules was given.
+if test "${with_modules+set}" = set; then
+ withval=$with_modules;
+fi
+
+
+# Check whether --with-hobbit was given.
+if test "${with_hobbit+set}" = set; then
+ withval=$with_hobbit;
+fi
+
+
+# Check whether --with-gauche was given.
+if test "${with_gauche+set}" = set; then
+ withval=$with_gauche;
+fi
+
+
+if test "$with_doubles" = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define Float double
+_ACEOF
+
+else
+ cat >>confdefs.h <<\_ACEOF
+#define Float float
+_ACEOF
+
+fi
+
+if test "$with_hobbit" = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define WITH_HOBBIT 1
+_ACEOF
+
+fi
+
+SNDLIB_BITS="24"
+
+# Check whether --with-float-samples was given.
+if test "${with_float_samples+set}" = set; then
+ withval=$with_float_samples; if test "$with_float_samples" = yes ; then
+ cat >>confdefs.h <<\_ACEOF
+#define SNDLIB_USE_FLOATS 1
+_ACEOF
+
+ if test "$with_doubles" = yes ; then
+ SNDLIB_BITS="8"
+ else
+ SNDLIB_BITS="4"
+ fi
+ else
+ cat >>confdefs.h <<\_ACEOF
+#define SNDLIB_USE_FLOATS 0
+_ACEOF
+
+ fi
+else
+ cat >>confdefs.h <<\_ACEOF
+#define SNDLIB_USE_FLOATS 0
+_ACEOF
+
+fi
+
+
+
+# Check whether --with-sample-width was given.
+if test "${with_sample_width+set}" = set; then
+ withval=$with_sample_width; { echo "$as_me:$LINENO: result: Using $with_sample_width bit samples" >&5
+echo "${ECHO_T}Using $with_sample_width bit samples" >&6; }
+ cat >>confdefs.h <<_ACEOF
+#define MUS_SAMPLE_BITS $with_sample_width
+_ACEOF
+
+ SNDLIB_BITS=$with_sample_width
+
+else
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_SAMPLE_BITS 24
+_ACEOF
+
+
+fi
+
+
+
+
+
+#--------------------------------------------------------------------------------
+# standard libraries, header files, functions, OSS special cases
+#--------------------------------------------------------------------------------
+
+# 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.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_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
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+IFS=$as_save_IFS
+
+
+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
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$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'
+
+
+
+{ echo "$as_me:$LINENO: checking for main in -lm" >&5
+echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_m_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_m_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
+echo "${ECHO_T}$ac_cv_lib_m_main" >&6; }
+if test $ac_cv_lib_m_main = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for main in -lc" >&5
+echo $ECHO_N "checking for main in -lc... $ECHO_C" >&6; }
+if test "${ac_cv_lib_c_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_c_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_c_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_c_main" >&5
+echo "${ECHO_T}$ac_cv_lib_c_main" >&6; }
+if test $ac_cv_lib_c_main = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBC 1
+_ACEOF
+
+ LIBS="-lc $LIBS"
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for main in -ldl" >&5
+echo $ECHO_N "checking for main in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_main" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_main" >&6; }
+if test $ac_cv_lib_dl_main = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
+LIBS=""
+
+# 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=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+
+
+
+for ac_header in fcntl.h limits.h unistd.h string.h sys/soundcard.h machine/soundcard.h sys/mixer.h byteswap.h stdbool.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in libc.h stdint.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+if test "${ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for /usr/local/lib/oss/include/sys/soundcard.h" >&5
+echo $ECHO_N "checking for /usr/local/lib/oss/include/sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking /usr/local/lib/oss/include/sys/soundcard.h usability" >&5
+echo $ECHO_N "checking /usr/local/lib/oss/include/sys/soundcard.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include </usr/local/lib/oss/include/sys/soundcard.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking /usr/local/lib/oss/include/sys/soundcard.h presence" >&5
+echo $ECHO_N "checking /usr/local/lib/oss/include/sys/soundcard.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include </usr/local/lib/oss/include/sys/soundcard.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: /usr/local/lib/oss/include/sys/soundcard.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for /usr/local/lib/oss/include/sys/soundcard.h" >&5
+echo $ECHO_N "checking for /usr/local/lib/oss/include/sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h" >&6; }
+
+fi
+if test $ac_cv_header__usr_local_lib_oss_include_sys_soundcard_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_HAVE_USR_LOCAL_LIB_OSS 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header__usr_lib_oss_include_sys_soundcard_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for /usr/lib/oss/include/sys/soundcard.h" >&5
+echo $ECHO_N "checking for /usr/lib/oss/include/sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header__usr_lib_oss_include_sys_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header__usr_lib_oss_include_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header__usr_lib_oss_include_sys_soundcard_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking /usr/lib/oss/include/sys/soundcard.h usability" >&5
+echo $ECHO_N "checking /usr/lib/oss/include/sys/soundcard.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include </usr/lib/oss/include/sys/soundcard.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking /usr/lib/oss/include/sys/soundcard.h presence" >&5
+echo $ECHO_N "checking /usr/lib/oss/include/sys/soundcard.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include </usr/lib/oss/include/sys/soundcard.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: /usr/lib/oss/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: /usr/lib/oss/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/lib/oss/include/sys/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: /usr/lib/oss/include/sys/soundcard.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: /usr/lib/oss/include/sys/soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: /usr/lib/oss/include/sys/soundcard.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/lib/oss/include/sys/soundcard.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: /usr/lib/oss/include/sys/soundcard.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/lib/oss/include/sys/soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: /usr/lib/oss/include/sys/soundcard.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/lib/oss/include/sys/soundcard.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: /usr/lib/oss/include/sys/soundcard.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/lib/oss/include/sys/soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: /usr/lib/oss/include/sys/soundcard.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /usr/lib/oss/include/sys/soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: /usr/lib/oss/include/sys/soundcard.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for /usr/lib/oss/include/sys/soundcard.h" >&5
+echo $ECHO_N "checking for /usr/lib/oss/include/sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header__usr_lib_oss_include_sys_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header__usr_lib_oss_include_sys_soundcard_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header__usr_lib_oss_include_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header__usr_lib_oss_include_sys_soundcard_h" >&6; }
+
+fi
+if test $ac_cv_header__usr_lib_oss_include_sys_soundcard_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_HAVE_USR_LIB_OSS 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header__opt_oss_include_sys_soundcard_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for /opt/oss/include/sys/soundcard.h" >&5
+echo $ECHO_N "checking for /opt/oss/include/sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header__opt_oss_include_sys_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header__opt_oss_include_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header__opt_oss_include_sys_soundcard_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking /opt/oss/include/sys/soundcard.h usability" >&5
+echo $ECHO_N "checking /opt/oss/include/sys/soundcard.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include </opt/oss/include/sys/soundcard.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking /opt/oss/include/sys/soundcard.h presence" >&5
+echo $ECHO_N "checking /opt/oss/include/sys/soundcard.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include </opt/oss/include/sys/soundcard.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: /opt/oss/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: /opt/oss/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /opt/oss/include/sys/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: /opt/oss/include/sys/soundcard.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: /opt/oss/include/sys/soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: /opt/oss/include/sys/soundcard.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /opt/oss/include/sys/soundcard.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: /opt/oss/include/sys/soundcard.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /opt/oss/include/sys/soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: /opt/oss/include/sys/soundcard.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /opt/oss/include/sys/soundcard.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: /opt/oss/include/sys/soundcard.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /opt/oss/include/sys/soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: /opt/oss/include/sys/soundcard.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /opt/oss/include/sys/soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: /opt/oss/include/sys/soundcard.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for /opt/oss/include/sys/soundcard.h" >&5
+echo $ECHO_N "checking for /opt/oss/include/sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header__opt_oss_include_sys_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header__opt_oss_include_sys_soundcard_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header__opt_oss_include_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header__opt_oss_include_sys_soundcard_h" >&6; }
+
+fi
+if test $ac_cv_header__opt_oss_include_sys_soundcard_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_HAVE_OPT_OSS 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header__var_lib_oss_include_sys_soundcard_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for /var/lib/oss/include/sys/soundcard.h" >&5
+echo $ECHO_N "checking for /var/lib/oss/include/sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header__var_lib_oss_include_sys_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header__var_lib_oss_include_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header__var_lib_oss_include_sys_soundcard_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking /var/lib/oss/include/sys/soundcard.h usability" >&5
+echo $ECHO_N "checking /var/lib/oss/include/sys/soundcard.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include </var/lib/oss/include/sys/soundcard.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking /var/lib/oss/include/sys/soundcard.h presence" >&5
+echo $ECHO_N "checking /var/lib/oss/include/sys/soundcard.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include </var/lib/oss/include/sys/soundcard.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: /var/lib/oss/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: /var/lib/oss/include/sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /var/lib/oss/include/sys/soundcard.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: /var/lib/oss/include/sys/soundcard.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: /var/lib/oss/include/sys/soundcard.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: /var/lib/oss/include/sys/soundcard.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /var/lib/oss/include/sys/soundcard.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: /var/lib/oss/include/sys/soundcard.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /var/lib/oss/include/sys/soundcard.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: /var/lib/oss/include/sys/soundcard.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /var/lib/oss/include/sys/soundcard.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: /var/lib/oss/include/sys/soundcard.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /var/lib/oss/include/sys/soundcard.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: /var/lib/oss/include/sys/soundcard.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: /var/lib/oss/include/sys/soundcard.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: /var/lib/oss/include/sys/soundcard.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for /var/lib/oss/include/sys/soundcard.h" >&5
+echo $ECHO_N "checking for /var/lib/oss/include/sys/soundcard.h... $ECHO_C" >&6; }
+if test "${ac_cv_header__var_lib_oss_include_sys_soundcard_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header__var_lib_oss_include_sys_soundcard_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header__var_lib_oss_include_sys_soundcard_h" >&5
+echo "${ECHO_T}$ac_cv_header__var_lib_oss_include_sys_soundcard_h" >&6; }
+
+fi
+if test $ac_cv_header__var_lib_oss_include_sys_soundcard_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_HAVE_VAR_LIB_OSS 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header_sys_sam9407_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for sys/sam9407.h" >&5
+echo $ECHO_N "checking for sys/sam9407.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_sam9407_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_sam9407_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_sam9407_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking sys/sam9407.h usability" >&5
+echo $ECHO_N "checking sys/sam9407.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/sam9407.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking sys/sam9407.h presence" >&5
+echo $ECHO_N "checking sys/sam9407.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/sam9407.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sys/sam9407.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/sam9407.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sam9407.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/sam9407.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sys/sam9407.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/sam9407.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sam9407.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/sam9407.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sam9407.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/sam9407.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sam9407.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/sam9407.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sam9407.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/sam9407.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/sam9407.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/sam9407.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for sys/sam9407.h" >&5
+echo $ECHO_N "checking for sys/sam9407.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_sam9407_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_sam9407_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_sam9407_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_sam9407_h" >&6; }
+
+fi
+if test $ac_cv_header_sys_sam9407_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SAM_9407 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header_gnu_libc_version_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for gnu/libc-version.h" >&5
+echo $ECHO_N "checking for gnu/libc-version.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_gnu_libc_version_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_gnu_libc_version_h" >&5
+echo "${ECHO_T}$ac_cv_header_gnu_libc_version_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking gnu/libc-version.h usability" >&5
+echo $ECHO_N "checking gnu/libc-version.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <gnu/libc-version.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking gnu/libc-version.h presence" >&5
+echo $ECHO_N "checking gnu/libc-version.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <gnu/libc-version.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: gnu/libc-version.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: gnu/libc-version.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: gnu/libc-version.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: gnu/libc-version.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: gnu/libc-version.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: gnu/libc-version.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: gnu/libc-version.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: gnu/libc-version.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: gnu/libc-version.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: gnu/libc-version.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: gnu/libc-version.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: gnu/libc-version.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: gnu/libc-version.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: gnu/libc-version.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: gnu/libc-version.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: gnu/libc-version.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for gnu/libc-version.h" >&5
+echo $ECHO_N "checking for gnu/libc-version.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_gnu_libc_version_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_gnu_libc_version_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_gnu_libc_version_h" >&5
+echo "${ECHO_T}$ac_cv_header_gnu_libc_version_h" >&6; }
+
+fi
+if test $ac_cv_header_gnu_libc_version_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_GNU_LIBC_VERSION_H 1
+_ACEOF
+
+fi
+
+
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
+echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_alsa_asoundlib_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking alsa/asoundlib.h usability" >&5
+echo $ECHO_N "checking alsa/asoundlib.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <alsa/asoundlib.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking alsa/asoundlib.h presence" >&5
+echo $ECHO_N "checking alsa/asoundlib.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <alsa/asoundlib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
+echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_alsa_asoundlib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_alsa_asoundlib_h" >&6; }
+
+fi
+if test $ac_cv_header_alsa_asoundlib_h = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALSA_ASOUNDLIB_H 1
+_ACEOF
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_time=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_time=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for mode_t" >&5
+echo $ECHO_N "checking for mode_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_mode_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef mode_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_mode_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_mode_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
+echo "${ECHO_T}$ac_cv_type_mode_t" >&6; }
+if test $ac_cv_type_mode_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef size_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_size_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_size_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_pid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef pid_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_pid_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_pid_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6; }
+if test $ac_cv_type_pid_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/param.h>
+
+int
+main ()
+{
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_bigendian=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_bigendian=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+ # try to guess the endianness by grepping values into an object file
+ ac_cv_c_bigendian=unknown
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+int
+main ()
+{
+ _ascii (); _ebcdic ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; 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
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_bigendian=no
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
+case $ac_cv_c_bigendian in
+ yes)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_LITTLE_ENDIAN 0
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+
+ case "$host" in
+ *-apple-*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_AUDIO_COMPATIBLE_FORMAT MUS_BFLOAT
+_ACEOF
+
+ ;;
+ *)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_AUDIO_COMPATIBLE_FORMAT MUS_BSHORT
+_ACEOF
+
+ ;;
+ esac
+ if test "$with_float_samples" != no ; then
+ if test "$with_doubles" = yes ; then
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_OUT_FORMAT MUS_BDOUBLE
+_ACEOF
+
+ else
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_OUT_FORMAT MUS_BFLOAT
+_ACEOF
+
+ fi
+ else
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_OUT_FORMAT MUS_BINT
+_ACEOF
+
+ fi
+ ;;
+ no)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_LITTLE_ENDIAN 1
+_ACEOF
+
+ case "$host" in
+ *-apple-*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_AUDIO_COMPATIBLE_FORMAT MUS_LFLOAT
+_ACEOF
+
+ ;;
+ *)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_AUDIO_COMPATIBLE_FORMAT MUS_LSHORT
+_ACEOF
+
+ ;;
+ esac
+ if test "$with_float_samples" != no ; then
+ if test "$with_doubles" = yes ; then
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_OUT_FORMAT MUS_LDOUBLE
+_ACEOF
+
+ else
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_OUT_FORMAT MUS_LFLOAT
+_ACEOF
+
+ fi
+ else
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_OUT_FORMAT MUS_LINT
+_ACEOF
+
+ fi
+ ;;
+ *)
+ { { echo "$as_me:$LINENO: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+echo "$as_me: error: unknown endianness
+presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+ enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+ { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+ 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sys_largefile_CC=' -n32'; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ while :; do
+ ac_cv_sys_file_offset_bits=no
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sys_file_offset_bits=64; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
+if test "$ac_cv_sys_file_offset_bits" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+
+fi
+rm -f conftest*
+ { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ while :; do
+ ac_cv_sys_large_files=no
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sys_large_files=1; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ break
+done
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
+if test "$ac_cv_sys_large_files" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+
+fi
+rm -f conftest*
+fi
+
+{ echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_off_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef off_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_off_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_off_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6; }
+if test $ac_cv_type_off_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
+_ACEOF
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_off_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef off_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_off_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_off_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6; }
+
+{ echo "$as_me:$LINENO: checking size of off_t" >&5
+echo $ECHO_N "checking size of off_t... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_off_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_off_t" = yes; then
+ # The cast to long int works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef off_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_off_t=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (off_t)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; } ;;
+esac
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef off_t ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%lu\n", i);
+ }
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_off_t=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (off_t)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_off_t=0
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_OFF_T $ac_cv_sizeof_off_t
+_ACEOF
+
+
+
+if test "$SIZEOF_INT" = "0" ; then
+ { { echo "$as_me:$LINENO: error: big trouble: configure thinks ints have 0 bytes" >&5
+echo "$as_me: error: big trouble: configure thinks ints have 0 bytes" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+{ echo "$as_me:$LINENO: checking whether isnan is declared" >&5
+echo $ECHO_N "checking whether isnan is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_isnan+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <math.h>
+
+int
+main ()
+{
+#ifndef isnan
+ char *p = (char *) isnan;
+ return !p;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_isnan=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_isnan=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isnan" >&5
+echo "${ECHO_T}$ac_cv_have_decl_isnan" >&6; }
+if test $ac_cv_have_decl_isnan = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ISNAN 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ISNAN 0
+_ACEOF
+
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking whether isinf is declared" >&5
+echo $ECHO_N "checking whether isinf is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_isinf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <math.h>
+
+int
+main ()
+{
+#ifndef isinf
+ char *p = (char *) isinf;
+ return !p;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_decl_isinf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_isinf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isinf" >&5
+echo "${ECHO_T}$ac_cv_have_decl_isinf" >&6; }
+if test $ac_cv_have_decl_isinf = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ISINF 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ISINF 0
+_ACEOF
+
+
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
+if test "${ac_cv_type_signal+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <signal.h>
+
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_signal=int
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_signal=void
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in getcwd strerror access vsnprintf snprintf memmove strdup fileno strftime
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); 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 $ac_func
+
+/* 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 $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# having <complex.h> + a cacos declaration is not enough: C++ dies with a complaint about a "deprecated header"
+if test "$with_gsl" != yes; then
+ LIBS="$LIBS -lm"
+ { echo "$as_me:$LINENO: checking for complex trig" >&5
+echo $ECHO_N "checking for complex trig... $ECHO_C" >&6; }
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <complex.h>
+int
+main ()
+{
+ _Complex double val;
+ double rl, im;
+ val = 1.0 + 0.5 * _Complex_I;
+ rl = creal(val);
+ im = cimag(val);
+ val = ccosh(cacosh(1.5) / 100.0)
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_COMPLEX_TRIG 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ with_gsl=no
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+
+
+# -------- GSL --------
+GSL_LIBS=""
+GSL_CFLAGS=""
+if test "$with_gsl" != no; then
+# Extract the first word of "gsl-config", so it can be a program name with args.
+set dummy gsl-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_GSL_CONFIG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $GSL_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GSL_CONFIG="$GSL_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_GSL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_GSL_CONFIG" && ac_cv_path_GSL_CONFIG="no"
+ ;;
+esac
+fi
+GSL_CONFIG=$ac_cv_path_GSL_CONFIG
+if test -n "$GSL_CONFIG"; then
+ { echo "$as_me:$LINENO: result: $GSL_CONFIG" >&5
+echo "${ECHO_T}$GSL_CONFIG" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+{ echo "$as_me:$LINENO: checking for GSL" >&5
+echo $ECHO_N "checking for GSL... $ECHO_C" >&6; }
+if test "$GSL_CONFIG" = "no" ; then
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+else
+ GSL_CFLAGS=`$GSL_CONFIG --cflags`
+ GSL_PREFIX=`$GSL_CONFIG --prefix`
+ if test "$with_static_gsl" = yes ; then
+ as_ac_File=`echo "ac_cv_file_$GSL_PREFIX/lib/libgsl.a" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $GSL_PREFIX/lib/libgsl.a" >&5
+echo $ECHO_N "checking for $GSL_PREFIX/lib/libgsl.a... $ECHO_C" >&6; }
+if { as_var=$as_ac_File; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+if test -r "$GSL_PREFIX/lib/libgsl.a"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+ac_res=`eval echo '${'$as_ac_File'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+ GSL_LIBS="$GSL_PREFIX/lib/libgsl.a"
+else
+ GSL_LIBS=`$GSL_CONFIG --libs`
+ with_static_gsl=no
+ { echo "$as_me:$LINENO: WARNING: can't find libgsl.a" >&5
+echo "$as_me: WARNING: can't find libgsl.a" >&2;}
+fi
+
+ else
+ GSL_LIBS=`$GSL_CONFIG --libs`
+ fi
+ gsl_version="`$GSL_CONFIG --version`"
+ { echo "$as_me:$LINENO: result: $gsl_version" >&5
+echo "${ECHO_T}$gsl_version" >&6; }
+ cat >>confdefs.h <<_ACEOF
+#define MUS_GSL_VERSION "${gsl_version}"
+_ACEOF
+
+ if test "`$GSL_CONFIG --version`" = "0.6" || test "`$GSL_CONFIG --version`" = "0.7"; then
+ { echo "$as_me:$LINENO: WARNING: sndlib needs GSL 0.8 or later" >&5
+echo "$as_me: WARNING: sndlib needs GSL 0.8 or later" >&2;}
+ else
+ if test "`$GSL_CONFIG --version`" = "0.8" && test "$with_static_gsl" = yes ; then
+ GSL_LIBS="$GSL_LIBS $GSL_PREFIX/lib/libgslcblas.a"
+ fi
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_GSL 1
+_ACEOF
+
+ fi
+fi
+fi
+
+
+
+
+SNDLIB_LANGUAGE="None"
+RUBY="ruby"
+
+# Check whether --with-ruby-prefix was given.
+if test "${with_ruby_prefix+set}" = set; then
+ withval=$with_ruby_prefix; ruby_prefix="$withval"
+ RUBY="$ruby_prefix/bin/ruby"
+else
+ ruby_prefix=""
+fi
+
+
+
+# Check whether --with-ruby was given.
+if test "${with_ruby+set}" = set; then
+ withval=$with_ruby; if test "$with_ruby" = yes ; then
+ { echo "$as_me:$LINENO: checking for Ruby" >&5
+echo $ECHO_N "checking for Ruby... $ECHO_C" >&6; }
+ RUBY_VERSION=`$RUBY -e 'puts RUBY_VERSION'`
+ RUBY_RELEASE_DATE=`$RUBY -e 'puts RUBY_RELEASE_DATE'`
+ if test "$RUBY_VERSION" > "0" ; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_RUBY 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: $RUBY_VERSION" >&5
+echo "${ECHO_T}$RUBY_VERSION" >&6; }
+ cat >>confdefs.h <<_ACEOF
+#define MUS_RUBY_VERSION "${RUBY_VERSION}"
+_ACEOF
+
+ cat >>confdefs.h <<_ACEOF
+#define RUBY_RELEASE_DATE "${RUBY_RELEASE_DATE}"
+_ACEOF
+
+
+ GUILE_CFLAGS=`$RUBY -e '\$:.each {|path| print "-I", path, " "}'`
+ GUILE_LIBS=`$RUBY -e '\$:.each {|path| print "-L", path, " "}'`
+# RUBY_SEARCH_PATH=`$RUBY -e [['\$:.each {|path| print path, ":"}']]`
+ RUBY_LIBS=`$RUBY -e 'require "rbconfig"; include Config; print CONFIG["LIBS"]'`
+
+ GUILE_LIBS="$GUILE_LIBS -lruby $RUBY_LIBS"
+ { echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
+echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; }
+if test "${ac_cv_lib_readline_readline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lreadline "-lncurses" $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 readline ();
+int
+main ()
+{
+return readline ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_readline_readline=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_readline_readline=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
+echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; }
+if test $ac_cv_lib_readline_readline = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_READLINE 1
+_ACEOF
+
+ GUILE_LIBS="$GUILE_LIBS -lreadline -lncurses"
+fi
+
+
+
+ SNDLIB_LANGUAGE="Ruby"
+
+ OLD_LIBS="$LIBS"
+ LIBS="$GUILE_LIBS"
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$GUILE_CFLAGS -lm"
+ { echo "$as_me:$LINENO: checking for rb_gc_disable in -lruby" >&5
+echo $ECHO_N "checking for rb_gc_disable in -lruby... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ruby_rb_gc_disable+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lruby $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 rb_gc_disable ();
+int
+main ()
+{
+return rb_gc_disable ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_ruby_rb_gc_disable=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_ruby_rb_gc_disable=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ruby_rb_gc_disable" >&5
+echo "${ECHO_T}$ac_cv_lib_ruby_rb_gc_disable" >&6; }
+if test $ac_cv_lib_ruby_rb_gc_disable = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_RB_GC_DISABLE 1
+_ACEOF
+
+fi
+
+ { echo "$as_me:$LINENO: checking for rb_ary_dup in -lruby" >&5
+echo $ECHO_N "checking for rb_ary_dup in -lruby... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ruby_rb_ary_dup+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lruby $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 rb_ary_dup ();
+int
+main ()
+{
+return rb_ary_dup ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_ruby_rb_ary_dup=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_ruby_rb_ary_dup=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ruby_rb_ary_dup" >&5
+echo "${ECHO_T}$ac_cv_lib_ruby_rb_ary_dup" >&6; }
+if test $ac_cv_lib_ruby_rb_ary_dup = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_RB_ARY_DUP 1
+_ACEOF
+
+fi
+
+ LIBS="$OLD_LIBS"
+ CFLAGS="$OLD_CFLAGS"
+
+ else
+ { echo "$as_me:$LINENO: WARNING: can't find Ruby!" >&5
+echo "$as_me: WARNING: can't find Ruby!" >&2;}
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_RUBY 0
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 0
+_ACEOF
+
+ fi
+ fi
+fi
+
+
+#--------------------------------------------------------------------------------
+# Gauche
+#--------------------------------------------------------------------------------
+
+if test "$with_gauche" = yes ; then
+ # Extract the first word of "gauche-config", so it can be a program name with args.
+set dummy gauche-config; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_GAUCHE_CONFIG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $GAUCHE_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GAUCHE_CONFIG="$GAUCHE_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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_GAUCHE_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_GAUCHE_CONFIG" && ac_cv_path_GAUCHE_CONFIG="no"
+ ;;
+esac
+fi
+GAUCHE_CONFIG=$ac_cv_path_GAUCHE_CONFIG
+if test -n "$GAUCHE_CONFIG"; then
+ { echo "$as_me:$LINENO: result: $GAUCHE_CONFIG" >&5
+echo "${ECHO_T}$GAUCHE_CONFIG" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ { echo "$as_me:$LINENO: checking for Gauche" >&5
+echo $ECHO_N "checking for Gauche... $ECHO_C" >&6; }
+ if test "$GAUCHE_CONFIG" = "no" ; then
+ { echo "$as_me:$LINENO: WARNING: can't find Gauche!" >&5
+echo "$as_me: WARNING: can't find Gauche!" >&2;}
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 0
+_ACEOF
+
+ else
+ # check for version >= 0.8.7
+ gauche_version="`$GAUCHE_CONFIG -V`"
+ { echo "$as_me:$LINENO: result: $gauche_version" >&5
+echo "${ECHO_T}$gauche_version" >&6; }
+
+ OLD_CFLAGS="CFLAGS"
+ # gauche-config inserts idiotic single-quotes in the -I and -L results thereby rendering them useless,
+ # so the following sed command tries to remove them. You apparently can't quote a single-quote
+ # in this context, so I use \x27 = ASCII for single quote.
+# GUILE_CFLAGS=`$GAUCHE_CONFIG -I | sed 's/\x27//g'`
+ GUILE_CFLAGS=`$GAUCHE_CONFIG -I | tr -d "'"`
+ CFLAGS="$CFLAGS $GUILE_CFLAGS"
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <gauche.h>
+int
+main ()
+{
+#if (GAUCHE_MAJOR_VERSION == 0)
+ #if (GAUCHE_MINOR_VERSION < 8)
+ #error too old
+ #else
+ #if (GAUCHE_MINOR_VERSION == 8) && (GAUCHE_MICRO_VERSION < 7)
+ #error too old
+ #endif
+ #endif
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_GAUCHE 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCHEME 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 1
+_ACEOF
+
+ GUILE_LIBS=`$GAUCHE_CONFIG -L | sed 's/\x27//g'`
+ GUILE_LIBS="$GUILE_LIBS -lgauche"
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+ { echo "$as_me:$LINENO: WARNING: We need Gauche 0.8.7 or later" >&5
+echo "$as_me: WARNING: We need Gauche 0.8.7 or later" >&2;}
+ with_gauche=no
+ CFLAGS="$OLD_CFLAGS"
+ GUILE_CFLAGS=""
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+fi
+
+#--------------------------------------------------------------------------------
+# Forth
+#--------------------------------------------------------------------------------
+
+## fth.m4 -- Autoconf macros for configuring FTH -*- Autoconf -*-
+
+## Copyright (C) 2006 Michael Scholz
+
+## Author: Michael Scholz <scholz-micha@gmx.de>
+## Created: Mon Mar 13 17:14:46 CET 2006
+## Changed: Thu Mar 23 13:46:43 CET 2006
+## Ident: $Id: fth.m4,v 1.1.1.1 2006/03/25 21:29:50 mi-scholz Exp $
+
+## This file is part of FTH.
+
+## 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
+
+## Commentary:
+
+# FTH_CHECK_LIB(action-if-found, [action-if-not-found])
+#
+# Usage: FTH_CHECK_LIB([AC_DEFINE([HAVE_FORTH])])
+#
+# Don't quote this macro: [FTH_CHECK_LIB(...)] isn't correct.
+# Instead call it FTH_CHECK_LIB(...).
+#
+# Six variables will be substituted:
+#
+# FTH fth program path or no
+# FTH_VERSION version string or ""
+# FTH_CFLAGS -I${prefix}/include/fth or ""
+# FTH_LIBS -L${prefix}/lib -lfth or ""
+# FTH_HAVE_COMPLEX yes or no
+# FTH_HAVE_RATIO yes or no
+
+## Code:
+
+# AC_CHECK_LIB was written by David MacKenzie.
+# This version is slightly changed to fit to FTH_CHECK_LIB.
+
+# fth_AC_CHECK_LIB
+
+# FTH_CHECK_LIB
+
+## fth.m4 ends here
+
+
+# Check whether --with-forth was given.
+if test "${with_forth+set}" = set; then
+ withval=$with_forth; if test "$with_forth" = yes ; then
+
+ # Extract the first word of "fth", so it can be a program name with args.
+set dummy fth; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_path_FTH+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $FTH in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_FTH="$FTH" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_FTH="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_FTH" && ac_cv_path_FTH="no"
+ ;;
+esac
+fi
+FTH=$ac_cv_path_FTH
+if test -n "$FTH"; then
+ { echo "$as_me:$LINENO: result: $FTH" >&5
+echo "${ECHO_T}$FTH" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ FTH_VERSION=""
+ FTH_CFLAGS=""
+ FTH_LIBS=""
+ FTH_HAVE_COMPLEX=no
+ FTH_HAVE_RATIO=no
+ { echo "$as_me:$LINENO: checking for Forth" >&5
+echo $ECHO_N "checking for Forth... $ECHO_C" >&6; }
+ if test "${FTH}" != no ; then
+ FTH_VERSION=`${FTH} --no-init-file --eval .version`
+ FTH_CFLAGS=`${FTH} --no-init-file --eval .cflags`
+ FTH_LIBS=`${FTH} --no-init-file --eval .libs`
+ { echo "$as_me:$LINENO: result: FTH version ${FTH_VERSION}" >&5
+echo "${ECHO_T}FTH version ${FTH_VERSION}" >&6; }
+
+ { echo "$as_me:$LINENO: checking whether FTH supports complex numbers" >&5
+echo $ECHO_N "checking whether FTH supports complex numbers... $ECHO_C" >&6; }
+if test "${ac_cv_lib_fth_fth_make_complex+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ fth_check_lib_save_LIBS=$LIBS
+ LIBS="-lfth ${FTH_LIBS} $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 fth_make_complex ();
+int
+main ()
+{
+return fth_make_complex ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_fth_fth_make_complex=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_fth_fth_make_complex=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$fth_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_fth_fth_make_complex" >&5
+echo "${ECHO_T}$ac_cv_lib_fth_fth_make_complex" >&6; }
+ if test $ac_cv_lib_fth_fth_make_complex = yes; then
+ FTH_HAVE_COMPLEX=yes
+fi
+
+
+ { echo "$as_me:$LINENO: checking whether FTH supports rational numbers" >&5
+echo $ECHO_N "checking whether FTH supports rational numbers... $ECHO_C" >&6; }
+if test "${ac_cv_lib_fth_fth_ratio_floor+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ fth_check_lib_save_LIBS=$LIBS
+ LIBS="-lfth ${FTH_LIBS} $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 fth_ratio_floor ();
+int
+main ()
+{
+return fth_ratio_floor ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_fth_fth_ratio_floor=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_fth_fth_ratio_floor=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LIBS=$fth_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_fth_fth_ratio_floor" >&5
+echo "${ECHO_T}$ac_cv_lib_fth_fth_ratio_floor" >&6; }
+ if test $ac_cv_lib_fth_fth_ratio_floor = yes; then
+ FTH_HAVE_RATIO=yes
+fi
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_FORTH 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 1
+_ACEOF
+
+ if test "$FTH_HAVE_COMPLEX" = yes ; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_COMPLEX_TRIG 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_MAKE_COMPLEX 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_C_MAKE_RECTANGULAR 1
+_ACEOF
+
+ fi
+ if test "$FTH_HAVE_RATIO" = yes ; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_MAKE_RATIO 1
+_ACEOF
+
+ fi
+ GUILE_CFLAGS=$FTH_CFLAGS
+
+ GUILE_LIBS=$FTH_LIBS
+
+ SNDLIB_LANGUAGE="Forth"
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+ fi
+
+
+
+
+
+
+ fi
+fi
+
+
+
+#--------------------------------------------------------------------------------
+# Guile
+#--------------------------------------------------------------------------------
+
+if test "$with_guile" != no && test "$with_gauche" != yes && test "$with_ruby" != yes && test "$with_forth" != yes ; then
+
+GUILE_LIBS=""
+GUILE_CFLAGS=""
+# GUILE_CONFIG_path=""
+# allow user to specify this in invocation line
+GUILE_LIB_path=""
+XM_LIBS=""
+SNDLIB_MODULES="no"
+
+if test "$with_guile" = no ; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_GUILE 0
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 0
+_ACEOF
+
+else
+
+ { echo "$as_me:$LINENO: checking for /usr/lib/snd/bin/guile-config" >&5
+echo $ECHO_N "checking for /usr/lib/snd/bin/guile-config... $ECHO_C" >&6; }
+if test "${ac_cv_file__usr_lib_snd_bin_guile_config+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+if test -r "/usr/lib/snd/bin/guile-config"; then
+ ac_cv_file__usr_lib_snd_bin_guile_config=yes
+else
+ ac_cv_file__usr_lib_snd_bin_guile_config=no
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_file__usr_lib_snd_bin_guile_config" >&5
+echo "${ECHO_T}$ac_cv_file__usr_lib_snd_bin_guile_config" >&6; }
+if test $ac_cv_file__usr_lib_snd_bin_guile_config = yes; then
+
+ GUILE_CONFIG_path=/usr/lib/snd/bin/
+ GUILE_LIB_path=/usr/lib/snd/lib
+
+fi
+
+
+ { echo "$as_me:$LINENO: checking for Guile" >&5
+echo $ECHO_N "checking for Guile... $ECHO_C" >&6; }
+ if test "$GUILE_CONFIG_path" != "" ; then
+ if ! test -x "${GUILE_CONFIG_path}guile-config" ; then
+ # try adding the "/" to the path
+ GUILE_CONFIG_path="${GUILE_CONFIG_path}/"
+ fi
+ fi
+ if (${GUILE_CONFIG_path}guile-config link > /dev/null) 2>&1; then
+ GUILE_CONFIG_works=yes
+ else
+ GUILE_CONFIG_works=no
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ fi
+
+if test $GUILE_CONFIG_works = yes; then
+ GUILE_CFLAGS="`${GUILE_CONFIG_path}guile-config compile`"
+ if test "$GUILE_LIB_path" != "" ; then
+ # MacOSX linker doesn't know the -rpath stuff, but user may have placed Guile in /usr/lib/snd/bin
+ case "$host" in
+ *-apple-*)
+ GUILE_LIBS="`${GUILE_CONFIG_path}guile-config link`"
+ ;;
+ *)
+ GUILE_LIBS="-Xlinker -rpath -Xlinker $GUILE_LIB_path `${GUILE_CONFIG_path}guile-config link`"
+ XM_LIBS="`${GUILE_CONFIG_path}guile-config link`"
+ ;;
+ esac
+ else
+ GUILE_LIBS="`${GUILE_CONFIG_path}guile-config link`"
+ fi
+
+ guile_version="`${GUILE_CONFIG_path}guile -c '(display (version))'`"
+ { echo "$as_me:$LINENO: result: $guile_version" >&5
+echo "${ECHO_T}$guile_version" >&6; }
+
+ if test "`${GUILE_CONFIG_path}guile -c '(display (string>=? (version) "1.3.4"))'`" != "#t"; then
+ { echo "$as_me:$LINENO: WARNING: sndlib needs Guile 1.3.4 or later" >&5
+echo "$as_me: WARNING: sndlib needs Guile 1.3.4 or later" >&2;}
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_GUILE 0
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 0
+_ACEOF
+
+ else
+
+ if test "$XM_LIBS" = ""; then
+ XM_LIBS="$GUILE_LIBS"
+ fi
+
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_GUILE 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCHEME 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 1
+_ACEOF
+
+ SNDLIB_LANGUAGE="Guile"
+
+ OLD_LIBS="$LIBS"
+ LIBS="$GUILE_LIBS"
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$GUILE_CFLAGS"
+ GNAME="guile"
+
+# special Mac OSX stuff -- need to protect against multiple -lguile's, add -all_load, and add -lguile-ltdl
+ case "$host" in
+ *-apple-*)
+ CFLAGS="$CFLAGS -all_load"
+ GNAME="m"
+ esac
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_set_smob_apply" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_set_smob_apply in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_set_smob_apply in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_set_smob_apply ();
+int
+main ()
+{
+return scm_set_smob_apply ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_APPLICABLE_SMOB 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_remember_upto_here" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_remember_upto_here in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_remember_upto_here in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_remember_upto_here ();
+int
+main ()
+{
+return scm_remember_upto_here ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_REMEMBER_UPTO_HERE 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_make_real" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_make_real in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_make_real in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_make_real ();
+int
+main ()
+{
+return scm_make_real ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_MAKE_REAL 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_object_to_string" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_object_to_string in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_object_to_string in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_object_to_string ();
+int
+main ()
+{
+return scm_object_to_string ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_OBJECT_TO_STRING 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_num2long_long" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_num2long_long in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_num2long_long in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_num2long_long ();
+int
+main ()
+{
+return scm_num2long_long ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_NUM2LONG_LONG 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_num2int" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_num2int in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_num2int in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_num2int ();
+int
+main ()
+{
+return scm_num2int ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_NUM2INT 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_c_make_vector" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_c_make_vector in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_c_make_vector in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_c_make_vector ();
+int
+main ()
+{
+return scm_c_make_vector ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_C_MAKE_VECTOR 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_c_define" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_c_define in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_c_define in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_c_define ();
+int
+main ()
+{
+return scm_c_define ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_C_DEFINE 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_c_define_gsubr" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_c_define_gsubr in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_c_define_gsubr in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_c_define_gsubr ();
+int
+main ()
+{
+return scm_c_define_gsubr ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_C_DEFINE_GSUBR 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_c_eval_string" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_c_eval_string in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_c_eval_string in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_c_eval_string ();
+int
+main ()
+{
+return scm_c_eval_string ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_C_EVAL_STRING 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_list_n" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_list_n in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_list_n in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_list_n ();
+int
+main ()
+{
+return scm_list_n ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_LIST_N 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_str2symbol" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_str2symbol in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_str2symbol in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_str2symbol ();
+int
+main ()
+{
+return scm_str2symbol ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_STR2SYMBOL 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_to_signed_integer" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_to_signed_integer in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_to_signed_integer in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_to_signed_integer ();
+int
+main ()
+{
+return scm_to_signed_integer ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_TO_SIGNED_INTEGER 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_c_make_rectangular" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_c_make_rectangular in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_c_make_rectangular in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_c_make_rectangular ();
+int
+main ()
+{
+return scm_c_make_rectangular ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_C_MAKE_RECTANGULAR 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_car" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_car in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_car in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_car ();
+int
+main ()
+{
+return scm_car ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_CAR 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_from_locale_keyword" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_from_locale_keyword in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_from_locale_keyword in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_from_locale_keyword ();
+int
+main ()
+{
+return scm_from_locale_keyword ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_FROM_LOCALE_KEYWORD 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_is_vector" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_is_vector in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_is_vector in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_is_vector ();
+int
+main ()
+{
+return scm_is_vector ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_IS_VECTOR 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_is_simple_vector" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_is_simple_vector in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_is_simple_vector in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_is_simple_vector ();
+int
+main ()
+{
+return scm_is_simple_vector ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_IS_SIMPLE_VECTOR 1
+_ACEOF
+
+fi
+
+ as_ac_Lib=`echo "ac_cv_lib_$GNAME''_scm_c_define_module" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for scm_c_define_module in -l$GNAME" >&5
+echo $ECHO_N "checking for scm_c_define_module in -l$GNAME... $ECHO_C" >&6; }
+if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$GNAME $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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 scm_c_define_module ();
+int
+main ()
+{
+return scm_c_define_module ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Lib=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Lib=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+ac_res=`eval echo '${'$as_ac_Lib'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Lib'}'` = yes; then
+ if test "$with_modules" = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define WITH_MODULES 1
+_ACEOF
+
+ SNDLIB_MODULES="yes"
+ fi
+fi
+
+ { echo "$as_me:$LINENO: checking for scm_t_catch_body" >&5
+echo $ECHO_N "checking for scm_t_catch_body... $ECHO_C" >&6; }
+if test "${ac_cv_type_scm_t_catch_body+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <guile/gh.h>
+
+typedef scm_t_catch_body ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_scm_t_catch_body=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_scm_t_catch_body=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_scm_t_catch_body" >&5
+echo "${ECHO_T}$ac_cv_type_scm_t_catch_body" >&6; }
+if test $ac_cv_type_scm_t_catch_body = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_SCM_T_CATCH_BODY 1
+_ACEOF
+
+fi
+
+ { echo "$as_me:$LINENO: checking for scm_t_guard" >&5
+echo $ECHO_N "checking for scm_t_guard... $ECHO_C" >&6; }
+if test "${ac_cv_type_scm_t_guard+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <guile/gh.h>
+
+typedef scm_t_guard ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_scm_t_guard=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_scm_t_guard=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_scm_t_guard" >&5
+echo "${ECHO_T}$ac_cv_type_scm_t_guard" >&6; }
+if test $ac_cv_type_scm_t_guard = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_DYNAMIC_WIND 1
+_ACEOF
+
+fi
+
+ LIBS="$OLD_LIBS"
+ CFLAGS="$OLD_CFLAGS"
+
+ if test "`${GUILE_CONFIG_path}guile -c '(display (string<=? (version) "1.3.4"))'`" = "#t"; then
+ echo found old out-of-date Guile library
+ fi
+ fi
+else
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_GUILE 0
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_EXTENSION_LANGUAGE 0
+_ACEOF
+
+fi
+fi
+fi
+
+
+#--------------------------------------------------------------------------------
+# Audio library
+#--------------------------------------------------------------------------------
+
+AUDIO_LIB=""
+LDSO_FLAGS=""
+SO_FLAGS=""
+SO_LD="ld"
+SO_INSTALL="install"
+A_INSTALL="install"
+# A_LD="ld"
+# A_LD_FLAGS=""
+A_LD="ar"
+A_LD_FLAGS="-rc"
+
+LD_FLAGS="-r"
+
+# we need the sndlib.h equivalents to try to find the native sound support (see config.guess)
+# this only matters for those cases where we've implemented the audio code in audio.c
+# test for ALSA courtesy of Paul Barton-Davis
+# test for ESD courtesy of Nick Bailey
+# test for BSD courtesy of Steven Schultz
+# test for Jack courtesy of Kjetil S. Matheussen
+
+if test "$with_esd" = yes ; then
+ { echo "$as_me:$LINENO: checking for main in -lesd" >&5
+echo $ECHO_N "checking for main in -lesd... $ECHO_C" >&6; }
+if test "${ac_cv_lib_esd_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lesd $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_esd_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_esd_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_esd_main" >&5
+echo "${ECHO_T}$ac_cv_lib_esd_main" >&6; }
+if test $ac_cv_lib_esd_main = yes; then
+
+ if test "${ac_cv_header_esd_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for esd.h" >&5
+echo $ECHO_N "checking for esd.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_esd_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_esd_h" >&5
+echo "${ECHO_T}$ac_cv_header_esd_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking esd.h usability" >&5
+echo $ECHO_N "checking esd.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <esd.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking esd.h presence" >&5
+echo $ECHO_N "checking esd.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <esd.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: esd.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: esd.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: esd.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: esd.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: esd.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: esd.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: esd.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: esd.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: esd.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: esd.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: esd.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: esd.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: esd.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: esd.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: esd.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: esd.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for esd.h" >&5
+echo $ECHO_N "checking for esd.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_esd_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_esd_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_esd_h" >&5
+echo "${ECHO_T}$ac_cv_header_esd_h" >&6; }
+
+fi
+if test $ac_cv_header_esd_h = yes; then
+
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_ESD 1
+_ACEOF
+
+ esd_version="`esd-config --version`"
+ cat >>confdefs.h <<_ACEOF
+#define MUS_ESD_VERSION "${esd_version}"
+_ACEOF
+
+ audiofile_version="`audiofile-config --version`"
+ cat >>confdefs.h <<_ACEOF
+#define MUS_AUDIOFILE_VERSION "${audiofile_version}"
+_ACEOF
+
+ AUDIO_LIB="`esd-config --libs`"
+# ESD_CFLAGS="`esd-config --cflags`"
+
+ audio_system=ESD
+
+else
+ { echo "$as_me:$LINENO: WARNING: can't find the ESD header files" >&5
+echo "$as_me: WARNING: can't find the ESD header files" >&2;}
+fi
+
+
+else
+ { echo "$as_me:$LINENO: WARNING: can't find the ESD library" >&5
+echo "$as_me: WARNING: can't find the ESD library" >&2;}
+fi
+
+fi
+
+if test "$audio_system" != unknown ; then
+ { echo "$as_me:$LINENO: result: Using the $audio_system audio system" >&5
+echo "${ECHO_T}Using the $audio_system audio system" >&6; }
+else
+
+case "$host" in
+ *-*-linux*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_LINUX 1
+_ACEOF
+
+ LDSO_FLAGS="-shared"
+ if test "$GCC" = yes ; then
+ SO_FLAGS="-fPIC $SO_FLAGS"
+ fi
+ SO_LD="gcc"
+# A_LD="ld"
+# This ^ used to be gcc, but that no longer seems to work
+ LIBS="-L/usr/lib -lm"
+# This ^ used to be "" but in redhat 7 the -lm needs to be explicit for make sndsine etc
+# it was "" to cancel -lXpm without the needed -L<dir> for the same case
+ audio_system=OSS
+
+ if test "$with_alsa" = yes || test "$with_static_alsa" = yes ; then
+ { echo "$as_me:$LINENO: checking for main in -lasound" >&5
+echo $ECHO_N "checking for main in -lasound... $ECHO_C" >&6; }
+if test "${ac_cv_lib_asound_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lasound $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_asound_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_asound_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_asound_main" >&5
+echo "${ECHO_T}$ac_cv_lib_asound_main" >&6; }
+if test $ac_cv_lib_asound_main = yes; then
+
+ if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for sys/asoundlib.h" >&5
+echo $ECHO_N "checking for sys/asoundlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_asoundlib_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking sys/asoundlib.h usability" >&5
+echo $ECHO_N "checking sys/asoundlib.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/asoundlib.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking sys/asoundlib.h presence" >&5
+echo $ECHO_N "checking sys/asoundlib.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/asoundlib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: sys/asoundlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/asoundlib.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for sys/asoundlib.h" >&5
+echo $ECHO_N "checking for sys/asoundlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_sys_asoundlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_sys_asoundlib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_asoundlib_h" >&6; }
+
+fi
+if test $ac_cv_header_sys_asoundlib_h = yes; then
+ audio_system=ALSA
+else
+ if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
+echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_alsa_asoundlib_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking alsa/asoundlib.h usability" >&5
+echo $ECHO_N "checking alsa/asoundlib.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <alsa/asoundlib.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking alsa/asoundlib.h presence" >&5
+echo $ECHO_N "checking alsa/asoundlib.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <alsa/asoundlib.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: alsa/asoundlib.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
+echo $ECHO_N "checking for alsa/asoundlib.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_alsa_asoundlib_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_alsa_asoundlib_h" >&6; }
+
+fi
+if test $ac_cv_header_alsa_asoundlib_h = yes; then
+ audio_system=ALSA
+else
+ { echo "$as_me:$LINENO: WARNING: can't find the ALSA header files" >&5
+echo "$as_me: WARNING: can't find the ALSA header files" >&2;}
+fi
+
+
+fi
+
+
+else
+ { echo "$as_me:$LINENO: WARNING: can't find the ALSA library" >&5
+echo "$as_me: WARNING: can't find the ALSA library" >&2;}
+fi
+
+ else
+ if test "$with_jack" = yes ; then
+ { echo "$as_me:$LINENO: checking for main in -ljack" >&5
+echo $ECHO_N "checking for main in -ljack... $ECHO_C" >&6; }
+if test "${ac_cv_lib_jack_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljack $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_jack_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_jack_main=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_jack_main" >&5
+echo "${ECHO_T}$ac_cv_lib_jack_main" >&6; }
+if test $ac_cv_lib_jack_main = yes; then
+
+ if test "${ac_cv_header_jack_jack_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for jack/jack.h" >&5
+echo $ECHO_N "checking for jack/jack.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_jack_jack_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_jack_jack_h" >&5
+echo "${ECHO_T}$ac_cv_header_jack_jack_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking jack/jack.h usability" >&5
+echo $ECHO_N "checking jack/jack.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <jack/jack.h>
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking jack/jack.h presence" >&5
+echo $ECHO_N "checking jack/jack.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <jack/jack.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: jack/jack.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: jack/jack.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: jack/jack.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: jack/jack.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: jack/jack.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: jack/jack.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: jack/jack.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: jack/jack.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: jack/jack.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: jack/jack.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: jack/jack.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: jack/jack.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: jack/jack.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: jack/jack.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: jack/jack.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: jack/jack.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ------------------------------------- ##
+## Report this to bil@ccrma.stanford.edu ##
+## ------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for jack/jack.h" >&5
+echo $ECHO_N "checking for jack/jack.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_jack_jack_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_jack_jack_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_jack_jack_h" >&5
+echo "${ECHO_T}$ac_cv_header_jack_jack_h" >&6; }
+
+fi
+if test $ac_cv_header_jack_jack_h = yes; then
+ audio_system=JACK
+else
+ with_jack=no
+ { echo "$as_me:$LINENO: WARNING: can't find the JACK header files" >&5
+echo "$as_me: WARNING: can't find the JACK header files" >&2;}
+fi
+
+
+else
+ with_jack=no
+ { echo "$as_me:$LINENO: WARNING: can't find the JACK library" >&5
+echo "$as_me: WARNING: can't find the JACK library" >&2;}
+fi
+
+ fi
+ fi
+
+ case $audio_system in
+ ALSA)
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALSA 1
+_ACEOF
+
+ if test "$with_static_alsa" = yes ; then
+ AUDIO_LIB="/usr/lib/libasound.a"
+ else
+ AUDIO_LIB="-lasound"
+ fi
+
+# snd_config_get_id argnum changed in Nov-01
+ snd_config_get_id_args=1
+ { echo "$as_me:$LINENO: checking snd_config_get_id args" >&5
+echo $ECHO_N "checking snd_config_get_id args... $ECHO_C" >&6; }
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <alsa/asoundlib.h>
+int
+main ()
+{
+snd_config_t *c;
+ const char *id;
+ snd_config_get_id(c, &id)
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ snd_config_get_id_args=2
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { echo "$as_me:$LINENO: result: $snd_config_get_id_args" >&5
+echo "${ECHO_T}$snd_config_get_id_args" >&6; }
+ cat >>confdefs.h <<_ACEOF
+#define SND_CONFIG_GET_ID_ARGS $snd_config_get_id_args
+_ACEOF
+
+ if test "$with_jack" = yes ; then
+ if test "$with_static_alsa" = yes ; then
+ AUDIO_LIB="/usr/lib/libasound.a -ljack -l samplerate"
+ else
+ AUDIO_LIB="-lasound -ljack -lsamplerate"
+ fi
+ A_INSTALL=":"
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_JACK 1
+_ACEOF
+
+ fi
+ ;;
+ JACK)
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_JACK 1
+_ACEOF
+
+ AUDIO_LIB="-ljack -lsamplerate"
+ A_LD=":"
+ A_INSTALL=":"
+ # no libjack.a so give up on sndlib.a
+ ;;
+ OSS)
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_OSS 1
+_ACEOF
+
+ ;;
+ esac
+ ;;
+ *-*-sunos4*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_SUN 1
+_ACEOF
+
+ LIBS="-lm"
+ audio_system=Sun
+ ;;
+ *-*-solaris*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_SUN 1
+_ACEOF
+
+# LIBS="-lm -ldl"
+ LIBS="-lm"
+ audio_system=Sun
+ LDSO_FLAGS="-G"
+ ;;
+ *-*-hpux*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_HPUX 1
+_ACEOF
+
+ audio_system=Hpux
+ if test "$GCC" = yes ; then
+ SO_FLAGS="-fPIC $SO_FLAGS"
+ fi
+ LDSO_FLAGS="+z -Ae +DA1.1"
+ ;;
+ *-sgi*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_SGI 1
+_ACEOF
+
+ audio_system=SGI
+ AUDIO_LIB="-laudio -lmd"
+
+ if test $GUILE_CONFIG_works = no; then
+ LIBS="-lm -lc"
+ else
+ LIBS="$LIBS -lm -lc"
+ fi
+ LDSO_FLAGS=""
+ SO_INSTALL=":"
+ SO_LD=":"
+ LD_FLAGS=""
+ if test $GCC = yes; then
+ LD_FLAGS=""
+ fi
+ ;;
+ alpha*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_ALPHA 1
+_ACEOF
+
+ ;;
+ *-*-bsdi*)
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_OSS 1
+_ACEOF
+
+ LIBS="-lm"
+ if test "$GCC" = yes ; then
+ SO_FLAGS="-fPIC $SO_FLAGS"
+ fi
+ audio_system=OSS
+ ;;
+ *-*-freebsd*)
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_OSS 1
+_ACEOF
+
+ LIBS="-lm"
+ audio_system=OSS
+ if test "$GCC" = yes ; then
+ SO_FLAGS="-fPIC $SO_FLAGS"
+ LDSO_FLAGS="-shared"
+ SO_LD="gcc"
+ fi
+ ;;
+ *-*-openbsd*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_OPENBSD 1
+_ACEOF
+
+ audio_system=Sun
+ if test "$GCC" = yes ; then
+ SO_FLAGS="-fPIC $SO_FLAGS"
+ fi
+ ;;
+ *-*-netbsd*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_NETBSD 1
+_ACEOF
+
+ audio_system=NetBSD
+ if test "$GCC" = yes ; then
+ SO_FLAGS="-fPIC $SO_FLAGS"
+ LDSO_FLAGS="-shared"
+ SO_LD="gcc"
+ fi
+ ;;
+ *-*-cygwin*)
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_WINDOZE 1
+_ACEOF
+
+ audio_system=Windoze
+ ;;
+ *-apple-*)
+ LDSO_FLAGS=""
+ SO_INSTALL=":"
+ SO_LD=":"
+ cat >>confdefs.h <<\_ACEOF
+#define MUS_MAC_OSX 1
+_ACEOF
+
+ audio_system=MacOSX
+ AUDIO_LIB="-framework CoreAudio -framework CoreFoundation -framework CoreMIDI"
+
+ { echo "$as_me:$LINENO: checking for kAudioDevicePropertyDeviceManufacturer" >&5
+echo $ECHO_N "checking for kAudioDevicePropertyDeviceManufacturer... $ECHO_C" >&6; }
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <CoreServices/CoreServices.h>
+ #include <CoreAudio/CoreAudio.h>
+int
+main ()
+{
+AudioDeviceID deviceID;
+ UInt32 trans_size = 0, trans;
+ trans_size = sizeof(UInt32);
+ AudioDeviceGetProperty(deviceID, 0, true, kAudioDevicePropertyTransportType, &trans_size, &trans)
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_KAUDIODEVICEPROPERTYTRANSPORTTYPE 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ { echo "$as_me:$LINENO: checking for kLinearPCMFormatFlagIsNonInterleaved" >&5
+echo $ECHO_N "checking for kLinearPCMFormatFlagIsNonInterleaved... $ECHO_C" >&6; }
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <CoreServices/CoreServices.h>
+ #include <CoreAudio/CoreAudio.h>
+int
+main ()
+{
+int i; i = kLinearPCMFormatFlagIsNonInterleaved
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_KLINEARPCMFORMATFLAGISNONINTERLEAVED 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for audio system" >&5
+echo $ECHO_N "checking for audio system... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $audio_system" >&5
+echo "${ECHO_T}$audio_system" >&6; }
+fi
+
+AUDIO_CHOICE="$audio_system"
+
+CFLAGS="-I. $CFLAGS"
+# needed since we're looking for <mus-config.h>, I think
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ *) $as_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
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+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=
+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=`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.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $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}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# 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
+
+
+# PATH needs CR
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+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.)
+as_nl='
+'
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+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
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+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
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. 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" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # 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
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+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
+fi
+echo >conf$$.file
+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 -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+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=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+# Find out whether ``test -x'' works. Don't use a zero-byte file, as
+# systems may use methods other than mode bits to determine executability.
+cat >conf$$.file <<_ASEOF
+#! /bin/sh
+exit 0
+_ASEOF
+chmod +x conf$$.file
+if test -x conf$$.file >/dev/null 2>&1; then
+ as_executable_p="test -x"
+else
+ as_executable_p=:
+fi
+rm -f conf$$.file
+
+# 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
+
+# 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 sndlib $as_me 20, which was
+generated by GNU Autoconf 2.60. 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
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -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
+ --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
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+sndlib config.status 20
+configured by $0, generated by GNU Autoconf 2.60,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 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'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+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=$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 )
+ echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ 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.
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$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
+if \$ac_cs_recheck; then
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
+ export CONFIG_SHELL
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "makefile") CONFIG_FILES="$CONFIG_FILES makefile" ;;
+ "sndlib-config") CONFIG_FILES="$CONFIG_FILES sndlib-config" ;;
+ "sndins/Makefile") CONFIG_FILES="$CONFIG_FILES sndins/Makefile" ;;
+ "mus-config.h") CONFIG_HEADERS="$CONFIG_HEADERS mus-config.h" ;;
+ "sndlib.h") CONFIG_HEADERS="$CONFIG_HEADERS sndlib.h" ;;
+
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ 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
+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=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+SNDLIB_BITS!$SNDLIB_BITS$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+GSL_CONFIG!$GSL_CONFIG$ac_delim
+GSL_LIBS!$GSL_LIBS$ac_delim
+GSL_CFLAGS!$GSL_CFLAGS$ac_delim
+GUILE_LIBS!$GUILE_LIBS$ac_delim
+GUILE_CFLAGS!$GUILE_CFLAGS$ac_delim
+GAUCHE_CONFIG!$GAUCHE_CONFIG$ac_delim
+FTH_VERSION!$FTH_VERSION$ac_delim
+FTH_CFLAGS!$FTH_CFLAGS$ac_delim
+FTH_LIBS!$FTH_LIBS$ac_delim
+FTH_HAVE_COMPLEX!$FTH_HAVE_COMPLEX$ac_delim
+FTH_HAVE_RATIO!$FTH_HAVE_RATIO$ac_delim
+FTH!$FTH$ac_delim
+XM_LIBS!$XM_LIBS$ac_delim
+AUDIO_LIB!$AUDIO_LIB$ac_delim
+LDSO_FLAGS!$LDSO_FLAGS$ac_delim
+SO_FLAGS!$SO_FLAGS$ac_delim
+SO_INSTALL!$SO_INSTALL$ac_delim
+A_INSTALL!$A_INSTALL$ac_delim
+SO_LD!$SO_LD$ac_delim
+A_LD!$A_LD$ac_delim
+A_LD_FLAGS!$A_LD_FLAGS$ac_delim
+LD_FLAGS!$LD_FLAGS$ac_delim
+SNDLIB_VERSION!$SNDLIB_VERSION$ac_delim
+SNDLIB_LANGUAGE!$SNDLIB_LANGUAGE$ac_delim
+SNDLIB_MODULES!$SNDLIB_MODULES$ac_delim
+AUDIO_CHOICE!$AUDIO_CHOICE$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 87; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ 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[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[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="$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 ||
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ ac_file_inputs="$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 "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ fi
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin";;
+ 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 ||
+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"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`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 ||
+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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`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
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# 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=
+
+case `sed -n '/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ 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
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;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
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+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 "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+ esac
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status. If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless. But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
+ac_dB='\\)[ (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+ sed -n '
+ t rset
+ :rset
+ s/^[ ]*#[ ]*define[ ][ ]*//
+ t ok
+ d
+ :ok
+ s/[\\&,]/\\&/g
+ s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+ s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+ ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then 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.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[ #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+ # Write a here document:
+ cat >>$CONFIG_STATUS <<_ACEOF
+ # First, check the format of the line:
+ cat >"\$tmp/defines.sed" <<\\CEOF
+/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
+/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
+b
+:def
+_ACEOF
+ sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+ ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+ sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+ grep . conftest.tail >/dev/null || break
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+ if test x"$ac_file" != x-; then
+ echo "/* $configure_input */" >"$tmp/config.h"
+ cat "$ac_result" >>"$tmp/config.h"
+ if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f $ac_file
+ mv "$tmp/config.h" $ac_file
+ fi
+ else
+ echo "/* $configure_input */"
+ cat "$ac_result"
+ fi
+ rm -f "$tmp/out12"
+ ;;
+
+
+ esac
+
+
+ case $ac_file$ac_mode in
+ "sndlib-config":F) chmod +x sndlib-config ;;
+
+ esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# 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 || { (exit 1); exit 1; }
+fi
+
+
diff --git a/third_party/resample/sndlib-20/headers.c b/third_party/resample/sndlib-20/headers.c
new file mode 100644
index 00000000..676066a4
--- /dev/null
+++ b/third_party/resample/sndlib-20/headers.c
@@ -0,0 +1,5797 @@
+/* readers/writers for various sound file headers
+ *
+ * --------------------------------
+ * int mus_header_read (const char *name)
+ * int mus_header_write (const char *name, int type, int in_srate, int in_chans, off_t loc, off_t size_in_samples, int format, const char *comment, int len)
+ * int mus_header_initialize (void)
+ *
+ * Once mus_header_read has been called, the data in it can be accessed through:
+ *
+ * off_t mus_header_samples (void) samples
+ * off_t mus_header_data_location (void) location of data (bytes)
+ * int mus_header_chans (void) channels
+ * int mus_header_srate (void) srate
+ * int mus_header_type (void) header type (i.e. aiff, wave, etc) (see sndlib.h)
+ * int mus_header_format (void) data format (see sndlib.h)
+ * off_t mus_header_comment_start (void) comment start location (if any) (bytes)
+ * off_t mus_header_comment_end (void) comment end location
+ * off_t mus_header_aux_comment_start (int n) if multiple comments, nth start location
+ * off_t mus_header_aux_comment_end (int n) if multiple comments, nth end location
+ * int mus_header_type_specifier (void) original (header-specific) type ID
+ * int mus_header_bits_per_sample (void) sample width in bits
+ * off_t mus_header_true_length (void) true (lseek) file length
+ * int mus_bytes_per_sample (int format) sample width in bytes
+ * bool mus_header_writable(int type, int format) can we write this header
+ * --------------------------------
+ *
+ * "Linear" below means 2's complement integer.
+ *
+ * Currently supported read/write (in standard data formats):
+ * NeXT/Sun/DEC/AFsp
+ * AIFF/AIFC
+ * RIFF (microsoft wave)
+ * IRCAM (old style)
+ * NIST-sphere
+ * no header
+ *
+ * Currently supported read-only (in selected data formats):
+ * 8SVX (IFF), EBICSF, INRS, ESPS, SPPACK, ADC (OGI), AVR, VOC, CSL, snack "SMP", PVF,
+ * Sound Tools, Turtle Beach SMP, SoundFont 2.0, Sound Designer I, PSION alaw, MAUD,
+ * Gravis Ultrasound, Comdisco SPW, Goldwave sample, OMF, NVF,
+ * Sonic Foundry, SBStudio II, Delusion digital, Digiplayer ST3, Farandole Composer WaveSample,
+ * Ultratracker WaveSample, Sample Dump exchange, Yamaha SY85 and SY99 (buggy), Yamaha TX16W,
+ * Covox v8, AVI, Kurzweil 2000, Paris Ensoniq, Impulse tracker, Korg, Akai type 4, Maui,
+ *
+ * for a few of these I'm still trying to get documentation -- best sources of info
+ * are ftp.cwi.nl:pub/audio (info files), the AFsp sources, and the SOX sources.
+ * sox and gsm are at ftp.cwi.nl, AFsp is from kabal@Polaris.EE.McGill.CA (Peter Kabal) as
+ * ftp.TSP.EE.McGill.CA:/pub/AFsp/AFsp-V3R2.tar.Z. The Sound Designer formats are described
+ * in the "Developer Documentation" from Digidesign. Other useful sources can be found at
+ * ftp.x.org:/contrib/audio/nas, svr-ftp.eng.cam.ac.uk:/comp.speech/tools, and
+ * at http://www.wotsit.org. I put many of my test cases in
+ * ccrma-ftp.stanford.edu:/pub/Lisp/sf.tar.gz. The RIFF format is described in the
+ * Microsoft Multimedia Programmer's Reference Manual at ftp.microsoft.com:/SoftLib/MSLFILES/MDRK.EXE.
+ * AVI format is described in http://www.rahul.net/jfm/avi.html.
+ *
+ * For a lot of info and examples see http://www.TSP.ECE.McGill.CA/MMSP/Documents/AudioFormats/index.html
+ *
+ * The main problem with compressed sound files is that you can't do reliable
+ * random access to the data, can't easily read backwards, and most of the compression
+ * schemes are proprietary (and appalling), but to translate Mus10/Sam, HCOM, IEEE text,
+ * MIDI sample dumps, various adpcm cases, NIST shortpack files, and AVI see snd-trans.c
+ * in the sound editor (snd-8.tar.gz).
+ *
+ * If anyone has information on any other header or data formats, I would be most interested in it,
+ * but only if it can be included in this file.
+ *
+ * ivc format appears to have 16 bytes of header (-1 5 0 0 0 0 -> mulaw) followed by mulaw or alaw data
+ */
+
+#include <mus-config.h>
+
+#if USE_SND
+ #include "snd.h"
+#else
+ #if HAVE_RUBY && (!CLM)
+ #include "xen.h"
+ #endif
+#endif
+
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#if HAVE_STRING_H
+ #include <string.h>
+#endif
+#if (defined(HAVE_LIBC_H) && (!defined(HAVE_UNISTD_H)))
+ #include <libc.h>
+#else
+ #if (!(defined(_MSC_VER)))
+ #include <unistd.h>
+ #endif
+#endif
+
+#include "_sndlib.h"
+#include "sndlib-strings.h"
+
+static bool hdrbuf_is_inited = false;
+
+#define HDRBUFSIZ 256
+static unsigned char *hdrbuf;
+#define INITIAL_READ_SIZE 32
+
+/* AIFF files can have any number of ANNO chunks, so we'll grab at least 4 of them */
+#define AUX_COMMENTS 4
+static off_t *aux_comment_start = NULL, *aux_comment_end = NULL;
+
+#define LOOPS 2
+static int *loop_modes = NULL, *loop_starts = NULL, *loop_ends = NULL;
+static int markers = 0;
+static int *marker_ids = NULL, *marker_positions = NULL;
+
+/* for CLM */
+void mus_reset_headers_c(void)
+{
+ hdrbuf_is_inited = false;
+ markers = 0;
+}
+
+int mus_header_initialize(void)
+{
+ if (!hdrbuf_is_inited)
+ {
+ hdrbuf_is_inited = true;
+ hdrbuf = (unsigned char *)CALLOC(HDRBUFSIZ, sizeof(unsigned char));
+ aux_comment_start = (off_t *)CALLOC(AUX_COMMENTS, sizeof(off_t));
+ aux_comment_end = (off_t *)CALLOC(AUX_COMMENTS, sizeof(off_t));
+ loop_modes = (int *)CALLOC(LOOPS, sizeof(int));
+ loop_starts = (int *)CALLOC(LOOPS, sizeof(int));
+ loop_ends = (int *)CALLOC(LOOPS, sizeof(int));
+ if ((hdrbuf == NULL) || (aux_comment_start == NULL) || (aux_comment_end == NULL) ||
+ (loop_modes == NULL) || (loop_starts == NULL) || (loop_ends == NULL))
+ return(mus_error(MUS_MEMORY_ALLOCATION_FAILED, "mus_header_initialize: buffer allocation failed"));
+ }
+ return(MUS_NO_ERROR);
+}
+
+
+static const unsigned char I_DSND[4] = {'.','s','n','d'}; /* NeXT/Sun/Dec/SGI/AFsp first word */
+static const unsigned char I_FORM[4] = {'F','O','R','M'}; /* AIFF first word */
+static const unsigned char I_AIFF[4] = {'A','I','F','F'}; /* AIFF second word */
+static const unsigned char I_AIFC[4] = {'A','I','F','C'}; /* ditto but might be compressed data */
+static const unsigned char I_COMM[4] = {'C','O','M','M'};
+static const unsigned char I_COMT[4] = {'C','O','M','T'};
+static const unsigned char I_INFO[4] = {'I','N','F','O'};
+static const unsigned char I_INST[4] = {'I','N','S','T'};
+static const unsigned char I_inst[4] = {'i','n','s','t'}; /* RIFF wants lower case, just to be different */
+static const unsigned char I_MARK[4] = {'M','A','R','K'};
+static const unsigned char I_SSND[4] = {'S','S','N','D'};
+static const unsigned char I_FVER[4] = {'F','V','E','R'};
+static const unsigned char I_NONE[4] = {'N','O','N','E'};
+static const unsigned char I_ULAW[4] = {'U','L','A','W'}; /* AIFC compression types that we can handle */
+static const unsigned char I_ulaw[4] = {'u','l','a','w'}; /* or maybe it's lowercase (Apple) ... */
+static const unsigned char I_ima4[4] = {'i','m','a','4'}; /* AIFC IMA adpcm apparently */
+static const unsigned char I_raw_[4] = {'r','a','w',' '}; /* AIFC offset binary OS 8.5 (others are 'MAC3' 'MAC6' 'cdx4' 'cdx2' 'str4') */
+static const unsigned char I_sowt[4] = {'s','o','w','t'}; /* AIFC 16-bit little endian -- used by Mac when extracting CD tracks */
+static const unsigned char I_in32[4] = {'i','n','3','2'}; /* AIFC */
+static const unsigned char I_in24[4] = {'i','n','2','4'}; /* AIFC */
+static const unsigned char I_ni23[4] = {'n','i','2','3'}; /* AIFC */
+static const unsigned char I_fl32[4] = {'f','l','3','2'}; /* AIFC 32-bit float */
+static const unsigned char I_FL32[4] = {'F','L','3','2'}; /* AIFC 32-bit float (apparently used by CSound and SoundHack) */
+static const unsigned char I_fl64[4] = {'f','l','6','4'}; /* AIFC 64-bit float */
+static const unsigned char I_twos[4] = {'t','w','o','s'}; /* AIFC big endian? */
+static const unsigned char I_ALAW[4] = {'A','L','A','W'};
+static const unsigned char I_alaw[4] = {'a','l','a','w'}; /* apple */
+static const unsigned char I_APPL[4] = {'A','P','P','L'};
+static const unsigned char I_MUS_[4] = {'C','L','M',' '}; /* I hereby claim this AIFF chunk name */
+static const unsigned char I_RIFF[4] = {'R','I','F','F'}; /* RIFF first word */
+static const unsigned char I_RIFX[4] = {'R','I','F','X'}; /* RIFX first word (big-endian RIFF file) */
+static const unsigned char I_WAVE[4] = {'W','A','V','E'};
+static const unsigned char I_fmt_[4] = {'f','m','t',' '};
+static const unsigned char I_data[4] = {'d','a','t','a'};
+static const unsigned char I_fact[4] = {'f','a','c','t'}; /* used by compressed RIFF files */
+static const unsigned char I_clm_[4] = {'c','l','m',' '};
+static const unsigned char I_NIST[4] = {'N','I','S','T'}; /* first word of NIST SPHERE files */
+static const unsigned char I_8SVX[4] = {'8','S','V','X'}; /* AIFF other choice */
+static const unsigned char I_16SV[4] = {'1','6','S','V'}; /* hmmm... 16-bit 8svx? */
+static const unsigned char I_VOC0[4] = {'C','r','e','a'}; /* Actual text is "Creative Voice File" */
+static const unsigned char I_VOC1[4] = {'t','i','v','e'};
+static const unsigned char I_SOUN[4] = {'S','O','U','N'}; /* Sound Tools first word="SOUND" -- not unique as SMP files start with "SOUND SAMPLE" */
+static const unsigned char I_D_SA[4] = {'D',' ','S','A'};
+static const unsigned char I_MPLE[4] = {'M','P','L','E'};
+static const unsigned char I_BODY[4] = {'B','O','D','Y'}; /* next 4 for 8svx chunk names */
+static const unsigned char I_VHDR[4] = {'V','H','D','R'};
+static const unsigned char I_CHAN[4] = {'C','H','A','N'};
+static const unsigned char I_ANNO[4] = {'A','N','N','O'};
+static const unsigned char I_NAME[4] = {'N','A','M','E'};
+static const unsigned char I_AVR_[4] = {'2','B','I','T'}; /* first word of AVR files */
+static const unsigned char I_HCOM[4] = {'H','C','O','M'};
+static const unsigned char I_FSSD[4] = {'F','S','S','D'};
+static const unsigned char I_SPIB[4] = {'%','/','/','\n'}; /* first word of IEEE spib text sound files */
+static const unsigned char I_S___[4] = {'%','-','-','-'}; /* first word of other IEEE spib text sound files */
+static const unsigned char I_ALaw[4] = {'A','L','a','w'}; /* first word of PSION alaw files */
+static const unsigned char I_Soun[4] = {'S','o','u','n'}; /* second */
+static const unsigned char I_MAUD[4] = {'M','A','U','D'}; /* MAUD specialization of AIFF */
+static const unsigned char I_MHDR[4] = {'M','H','D','R'};
+static const unsigned char I_MDAT[4] = {'M','D','A','T'};
+static const unsigned char I_mdat[4] = {'m','d','a','t'}; /* quicktime */
+static const unsigned char I_MThd[4] = {'M','T','h','d'}; /* sigh -- the M word */
+static const unsigned char I_DECN[4] = {'.','s','d','\0'}; /* first word of DEC files (?) */
+static const unsigned char I_sfbk[4] = {'s','f','b','k'}; /* SoundFont 2.0 */
+static const unsigned char I_sdta[4] = {'s','d','t','a'};
+static const unsigned char I_shdr[4] = {'s','h','d','r'};
+static const unsigned char I_pdta[4] = {'p','d','t','a'};
+static const unsigned char I_LIST[4] = {'L','I','S','T'};
+static const unsigned char I_GF1P[4] = {'G','F','1','P'}; /* first word of Gravis Ultrsound patch files */
+static const unsigned char I_ATCH[4] = {'A','T','C','H'}; /* second word */
+static const unsigned char I_DSIG[4] = {'$','S','I','G'}; /* first word of Comdisco SPW file */
+static const unsigned char I_NAL_[4] = {'N','A','L','_'}; /* second word */
+static const unsigned char I_GOLD[4] = {'G','O','L','D'}; /* first word Goldwave(?) sample file */
+static const unsigned char I__WAV[4] = {' ','S','A','M'}; /* second word */
+static const unsigned char I_SRFS[4] = {'S','R','F','S'}; /* first word Sonic Resource Foundry file(?) */
+static const unsigned char I_Diam[4] = {'D','i','a','m'}; /* first word DiamondWare file */
+static const unsigned char I_ondW[4] = {'o','n','d','W'}; /* second word */
+static const unsigned char I_CSRE[4] = {'C','S','R','E'}; /* adf first word -- second starts with "40" */
+static const unsigned char I_SND_[4] = {'S','N','D',' '}; /* SBStudio II */
+static const unsigned char I_SNIN[4] = {'S','N','I','N'};
+static const unsigned char I_SNNA[4] = {'S','N','N','A'};
+static const unsigned char I_SNDT[4] = {'S','N','D','T'};
+static const unsigned char I_DDSF[4] = {'D','D','S','F'}; /* Delusion Digital Sound File */
+static const unsigned char I_FSMt[4] = {'F','S','M',(unsigned char)'\376'}; /* Farandole Composer WaveSample */
+static const unsigned char I_SDXc[4] = {'S','D','X',':'}; /* Sample dump exchange format */
+static const unsigned char I_UWFD[4] = {'U','W','F','D'}; /* Ultratracker Wavesample */
+static const unsigned char I_LM89[4] = {'L','M','8','9'}; /* Yamaha TX-16 */
+static const unsigned char I_SY80[4] = {'S','Y','8','0'}; /* Yamaha SY-99 */
+static const unsigned char I_SY85[4] = {'S','Y','8','5'}; /* Yamaha SY-85 */
+static const unsigned char I_SCRS[4] = {'S','C','R','S'}; /* Digiplayer ST3 */
+static const unsigned char I_covox[4] = {(unsigned char)'\377','\125',(unsigned char)'\377',(unsigned char)'\252'};
+/* static const unsigned char I_DSPL[4] = {'D','S','P','L'}; */ /* Digitracker SPL (now obsolete) */
+static const unsigned char I_AVI_[4] = {'A','V','I',' '}; /* RIFF AVI */
+static const unsigned char I_strf[4] = {'s','t','r','f'};
+static const unsigned char I_movi[4] = {'m','o','v','i'};
+static const unsigned char I_PRAM[4] = {'P','R','A','M'}; /* Kurzweil 2000 */
+static const unsigned char I_ones[4] = {(unsigned char)'\377',(unsigned char)'\377',(unsigned char)'\377',(unsigned char)'\377'};
+static const unsigned char I_zeros[4] = {'\0','\0','\0','\0'};
+static const unsigned char I_asf0[4] = {(unsigned char)'\321','\051',(unsigned char)'\342',(unsigned char)'\326'};
+static const unsigned char I_asf1[4] = {(unsigned char)'\332','\065',(unsigned char)'\321','\021'};
+static const unsigned char I_asf2[4] = {(unsigned char)'\220','\064','\000',(unsigned char)'\240'};
+static const unsigned char I_asf3[4] = {(unsigned char)'\311','\003','\111',(unsigned char)'\276'};
+static const unsigned char I__PAF[4] = {' ','p','a','f'}; /* Paris Ensoniq */
+static const unsigned char I_FAP_[4] = {'f','a','p',' '}; /* Paris Ensoniq */
+static const unsigned char I_DS16[4] = {'D','S','1','6'}; /* CSL */
+static const unsigned char I_HEDR[4] = {'H','E','D','R'};
+static const unsigned char I_HDR8[4] = {'H','D','R','8'};
+static const unsigned char I_SDA_[4] = {'S','D','A','_'};
+static const unsigned char I_SDAB[4] = {'S','D','A','B'};
+static const unsigned char I_SD_B[4] = {'S','D','_','B'};
+static const unsigned char I_NOTE[4] = {'N','O','T','E'};
+static const unsigned char I_file[4] = {'f','i','l','e'}; /* snack "SMP" */
+static const unsigned char I__sam[4] = {'=','s','a','m'};
+static const unsigned char I_SU7M[4] = {'S','U','7','M'};
+static const unsigned char I_SU7R[4] = {'S','U','7','R'};
+static const unsigned char I_PVF1[4] = {'P','V','F','1'}; /* portable voice format (mgetty) */
+static const unsigned char I_PVF2[4] = {'P','V','F','2'};
+static const unsigned char I_AUTH[4] = {'A','U','T','H'};
+static const unsigned char I_riff[4] = {'r','i','f','f'}; /* SoundForge */
+static const unsigned char I_TWIN[4] = {'T','W','I','N'}; /* TwinVQ */
+static const unsigned char I_IMPS[4] = {'I','M','P','S'}; /* Impulse Tracker */
+static const unsigned char I_SMP1[4] = {'S','M','P','1'}; /* Korg */
+static const unsigned char I_Maui[4] = {'M','a','u','i'}; /* Turtle Beach */
+static const unsigned char I_SDIF[4] = {'S','D','I','F'}; /* IRCAM sdif */
+static const unsigned char I_NVF_[4] = {'N','V','F',' '}; /* Nomad II Creative NVF */
+static const unsigned char I_VFMT[4] = {'V','F','M','T'}; /* Nomad II Creative NVF */
+static const unsigned char I_OggS[4] = {'O','g','g','S'}; /* Ogg-related files, apparently -- ogg123 has "vorbis" instead of "Speex" */
+static const unsigned char I_fLaC[4] = {'f','L','a','C'}; /* FLAC */
+static const unsigned char I_ajkg[4] = {'a','j','k','g'}; /* shorten */
+static const unsigned char I_TTA1[4] = {'T','T','A','1'}; /* ttaenc */
+static const unsigned char I_wvpk[4] = {'w','v','p','k'}; /* wavpack */
+
+#define I_IRCAM_VAX 0x0001a364
+#define I_IRCAM_SUN 0x0002a364
+#define I_IRCAM_MIPS 0x0003a364
+#define I_IRCAM_NEXT 0x0004a364
+
+#define NINRS 7
+static const unsigned int I_INRS[NINRS] = {0xcb460020, 0xd0465555, 0xfa460000, 0x1c470040, 0x3b470080, 0x7a470000, 0x9c470040};
+
+static off_t data_location = 0;
+static int srate = 0, chans = 0, header_type = MUS_UNSUPPORTED, data_format = MUS_UNKNOWN, original_data_format = 0;
+static int type_specifier = 0, bits_per_sample = 0, block_align = 0, fact_samples = 0;
+static off_t comment_start = 0, comment_end = 0;
+static off_t true_file_length = 0, data_size = 0;
+static int base_detune = 0, base_note = 0;
+static bool little_endian = false;
+
+off_t mus_header_samples(void) {return(data_size);}
+off_t mus_header_data_location(void) {return(data_location);}
+int mus_header_chans(void) {return(chans);}
+int mus_header_srate(void) {return(srate);}
+int mus_header_type(void) {return(header_type);}
+int mus_header_format(void) {return(data_format);}
+off_t mus_header_comment_start(void) {return(comment_start);}
+off_t mus_header_comment_end(void) {return(comment_end);}
+off_t mus_header_aux_comment_start(int n) {if (aux_comment_start) return(aux_comment_start[n]); else return(-1);}
+off_t mus_header_aux_comment_end(int n) {if (aux_comment_end) return(aux_comment_end[n]); else return(-1);}
+int mus_header_type_specifier(void) {return(type_specifier);}
+int mus_header_bits_per_sample(void) {return(bits_per_sample);}
+int mus_header_fact_samples(void) {return(fact_samples);}
+int mus_header_block_align(void) {return(block_align);}
+off_t mus_header_true_length(void) {return(true_file_length);}
+int mus_header_original_format(void) {return(original_data_format);}
+int mus_header_loop_mode(int which) {if (loop_modes) return(loop_modes[which]); else return(-1);}
+int mus_header_loop_start(int which) {if (loop_starts) return(loop_starts[which]); else return(-1);}
+int mus_header_loop_end(int which) {if (loop_ends) return(loop_ends[which]); else return(-1);}
+int mus_header_mark_position(int id) {int i; for (i = 0; i < markers; i++) {if (marker_ids[i] == id) return(marker_positions[i]);} return(-1);}
+int mus_header_base_detune(void) {return(base_detune);}
+int mus_header_base_note(void) {return(base_note);}
+
+int mus_bytes_per_sample(int format)
+{
+ switch (format)
+ {
+ case MUS_BYTE: return(1); break;
+ case MUS_BSHORT: return(2); break;
+ case MUS_UBYTE: return(1); break;
+ case MUS_MULAW: return(1); break;
+ case MUS_ALAW: return(1); break;
+ case MUS_BINT: return(4); break;
+ case MUS_BFLOAT: return(4); break;
+ case MUS_BFLOAT_UNSCALED: return(4); break;
+ case MUS_B24INT: return(3); break;
+ case MUS_BDOUBLE: return(8); break;
+ case MUS_BDOUBLE_UNSCALED: return(8); break;
+ case MUS_LSHORT: return(2); break;
+ case MUS_LINT: return(4); break;
+ case MUS_LFLOAT: return(4); break;
+ case MUS_LDOUBLE: return(8); break;
+ case MUS_LFLOAT_UNSCALED: return(4); break;
+ case MUS_LDOUBLE_UNSCALED: return(8); break;
+ case MUS_L24INT: return(3); break;
+ case MUS_UBSHORT: return(2); break;
+ case MUS_ULSHORT: return(2); break;
+ case MUS_BINTN: return(4); break;
+ case MUS_LINTN: return(4); break;
+ default: return(1); break; /* we divide by this number, so 0 is not safe */
+ }
+}
+
+off_t mus_samples_to_bytes (int format, off_t size) {return(size * (mus_bytes_per_sample(format)));}
+off_t mus_bytes_to_samples (int format, off_t size) {return((off_t)(size / (mus_bytes_per_sample(format))));}
+
+
+static bool equal_big_or_little_endian(const unsigned char *n1, const unsigned int n2)
+{
+ return((mus_char_to_ubint(n1) == n2) || (mus_char_to_ulint(n1) == n2));
+}
+
+static short big_or_little_endian_short(const unsigned char *n, bool little)
+{
+ if (little) return(mus_char_to_lshort(n));
+ return(mus_char_to_bshort(n));
+}
+
+static int big_or_little_endian_int(const unsigned char *n, bool little)
+{
+ if (little) return(mus_char_to_lint(n));
+ return(mus_char_to_bint(n));
+}
+
+static unsigned int big_or_little_endian_uint(const unsigned char *n, bool little)
+{
+ if (little) return(mus_char_to_ulint(n));
+ return(mus_char_to_ubint(n));
+}
+
+static float big_or_little_endian_float(const unsigned char *n, bool little)
+{
+ if (little) return(mus_char_to_lfloat(n));
+ return(mus_char_to_bfloat(n));
+}
+
+static bool match_four_chars(const unsigned char *head, const unsigned char *match)
+{
+ return((head[0] == match[0]) &&
+ (head[1] == match[1]) &&
+ (head[2] == match[2]) &&
+ (head[3] == match[3]));
+}
+
+static void write_four_chars(unsigned char *head, const unsigned char *match)
+{
+ head[0] = match[0];
+ head[1] = match[1];
+ head[2] = match[2];
+ head[3] = match[3];
+}
+
+const char *mus_header_type_name(int type)
+{
+ switch (type)
+ {
+ case MUS_NEXT: return("Sun/Next"); break;
+ case MUS_AIFC: return("AIFC"); break;
+ case MUS_RIFF: return("RIFF"); break;
+ case MUS_BICSF: return("BICSF"); break;
+ case MUS_NIST: return("NIST"); break;
+ case MUS_INRS: return("INRS"); break;
+ case MUS_ESPS: return("ESPS"); break;
+ case MUS_SVX: return("SVX8"); break;
+ case MUS_VOC: return("VOC"); break;
+ case MUS_SNDT: return("SNDT"); break;
+ case MUS_RAW: return("raw (no header)"); break;
+ case MUS_SMP: return("SMP"); break;
+ case MUS_AVR: return("AVR"); break;
+ case MUS_IRCAM: return("IRCAM"); break;
+ case MUS_SD1: return("Sound Designer 1"); break;
+ case MUS_SPPACK: return("SPPACK"); break;
+ case MUS_MUS10: return("Mus10"); break;
+ case MUS_HCOM: return("HCOM"); break;
+ case MUS_PSION: return("PSION"); break;
+ case MUS_MAUD: return("MAUD"); break;
+ case MUS_IEEE: return("IEEE text"); break;
+ case MUS_MATLAB: return("Matlab"); break;
+ case MUS_ADC: return("ADC/OGI"); break;
+ case MUS_MIDI: return("MIDI"); break;
+ case MUS_SOUNDFONT: return("SoundFont"); break;
+ case MUS_GRAVIS: return("Gravis Ultrasound patch"); break;
+ case MUS_COMDISCO: return("Comdisco SPW signal"); break;
+ case MUS_GOLDWAVE: return("Goldwave sample"); break;
+ case MUS_SRFS: return("SRFS"); break;
+ case MUS_MIDI_SAMPLE_DUMP: return("MIDI sample dump"); break;
+ case MUS_DIAMONDWARE: return("DiamondWare"); break;
+ case MUS_ADF: return("CSRE adf"); break;
+ case MUS_SBSTUDIOII: return("SBStudioII"); break;
+ case MUS_DELUSION: return("Delusion"); break;
+ case MUS_FARANDOLE: return("Farandole"); break;
+ case MUS_SAMPLE_DUMP: return("Sample dump"); break;
+ case MUS_ULTRATRACKER: return("Ultratracker"); break;
+ case MUS_YAMAHA_TX16W: return("TX-16W"); break;
+ case MUS_YAMAHA_SY85: return("Sy-85"); break;
+ case MUS_YAMAHA_SY99: return("Sy-99"); break;
+ case MUS_KURZWEIL_2000: return("Kurzweil 2000"); break;
+ case MUS_KORG: return("Korg"); break;
+ case MUS_MAUI: return("Turtle Beach"); break;
+ case MUS_IMPULSETRACKER: return("Impulse Tracker"); break;
+ case MUS_AKAI4: return("AKAI 4"); break;
+ case MUS_DIGIPLAYER: return("Digiplayer ST3"); break;
+ case MUS_COVOX: return("Covox V8"); break;
+ case MUS_AVI: return("AVI"); break;
+ case MUS_OMF: return("OMF"); break;
+ case MUS_QUICKTIME: return("Quicktime"); break;
+ case MUS_ASF: return("asf"); break;
+ case MUS_AIFF: return("AIFF"); break;
+ case MUS_PAF: return("Ensoniq Paris"); break;
+ case MUS_CSL: return("CSL"); break;
+ case MUS_FILE_SAMP: return("snack SMP"); break;
+ case MUS_PVF: return("Portable Voice Format"); break;
+ case MUS_SOUNDFORGE: return("SoundForge"); break;
+ case MUS_TWINVQ: return("TwinVQ"); break;
+ case MUS_SDIF: return("IRCAM sdif"); break;
+ case MUS_NVF: return("Creative NVF"); break;
+ case MUS_OGG: return("Ogg Vorbis"); break;
+ case MUS_FLAC: return("Flac"); break;
+ case MUS_SPEEX: return("Speex"); break;
+ case MUS_MPEG: return("mpeg"); break;
+ case MUS_SHORTEN: return("shorten"); break;
+ case MUS_TTA: return("tta"); break;
+ case MUS_WAVPACK: return("wavpack"); break;
+ default: return("unsupported"); break;
+ }
+}
+
+const char *mus_data_format_name(int format)
+{
+ switch (format)
+ {
+ case MUS_BSHORT: return("big endian short (16 bits)"); break;
+ case MUS_MULAW: return("mulaw (8 bits)"); break;
+ case MUS_BYTE: return("signed byte (8 bits)"); break;
+ case MUS_BFLOAT: return("big endian float (32 bits)"); break;
+ case MUS_BFLOAT_UNSCALED: return("big endian float (32 bits, unscaled)"); break;
+ case MUS_BINT: return("big endian int (32 bits)"); break;
+ case MUS_ALAW: return("alaw (8 bits)"); break;
+ case MUS_UBYTE: return("unsigned byte (8 bits)"); break;
+ case MUS_B24INT: return("big endian int (24 bits)"); break;
+ case MUS_BDOUBLE: return("big endian double (64 bits)"); break;
+ case MUS_BDOUBLE_UNSCALED: return("big endian double (64 bits, unscaled)"); break;
+ case MUS_LSHORT: return("little endian short (16 bits)"); break;
+ case MUS_LINT: return("little endian int (32 bits)"); break;
+ case MUS_LFLOAT: return("little endian float (32 bits)"); break;
+ case MUS_LDOUBLE: return("little endian double (64 bits)"); break;
+ case MUS_LFLOAT_UNSCALED: return("little endian float (32 bits, unscaled)"); break;
+ case MUS_LDOUBLE_UNSCALED: return("little endian double (64 bits, unscaled)"); break;
+ case MUS_UBSHORT: return("unsigned big endian short (16 bits)"); break;
+ case MUS_ULSHORT: return("unsigned little endian short (16 bits)"); break;
+ case MUS_L24INT: return("little endian int (24 bits)"); break;
+ case MUS_BINTN: return("normalized big endian int (32 bits)"); break;
+ case MUS_LINTN: return("normalized little endian int (32 bits)"); break;
+ default: return("unknown"); break;
+ }
+}
+
+const char *mus_data_format_short_name(int format)
+{
+ switch (format)
+ {
+ case MUS_BSHORT: return("short int"); break;
+ case MUS_MULAW: return("mulaw"); break;
+ case MUS_BYTE: return("signed byte"); break;
+ case MUS_BFLOAT: return("float"); break;
+ case MUS_BFLOAT_UNSCALED: return("float unscaled)"); break;
+ case MUS_BINT: return("int"); break;
+ case MUS_ALAW: return("alaw"); break;
+ case MUS_UBYTE: return("unsigned byte"); break;
+ case MUS_B24INT: return("24-bit int"); break;
+ case MUS_BDOUBLE: return("double"); break;
+ case MUS_BDOUBLE_UNSCALED: return("double unscaled"); break;
+ case MUS_LSHORT: return("short int"); break;
+ case MUS_LINT: return("int"); break;
+ case MUS_LFLOAT: return("float"); break;
+ case MUS_LDOUBLE: return("double"); break;
+ case MUS_LFLOAT_UNSCALED: return("float unscaled"); break;
+ case MUS_LDOUBLE_UNSCALED: return("double unscaled"); break;
+ case MUS_UBSHORT: return("unsigned short"); break;
+ case MUS_ULSHORT: return("unsigned short"); break;
+ case MUS_L24INT: return("24-bit int"); break;
+ case MUS_BINTN: return("normalized int"); break;
+ case MUS_LINTN: return("normalized int"); break;
+ default: return("unknown"); break;
+ }
+}
+
+#if HAVE_RUBY
+ #define TO_LANG(Str) strdup(xen_scheme_constant_to_ruby(Str))
+#else
+ #define TO_LANG(Str) Str
+#endif
+
+char *mus_header_type_to_string(int type)
+{
+ switch (type)
+ {
+ case MUS_NEXT: return(TO_LANG(S_mus_next));
+ case MUS_AIFF: return(TO_LANG(S_mus_aiff));
+ case MUS_AIFC: return(TO_LANG(S_mus_aifc));
+ case MUS_RIFF: return(TO_LANG(S_mus_riff));
+ case MUS_NIST: return(TO_LANG(S_mus_nist));
+ case MUS_IRCAM: return(TO_LANG(S_mus_ircam));
+ case MUS_RAW: return(TO_LANG(S_mus_raw));
+ case MUS_BICSF: return(TO_LANG(S_mus_bicsf));
+ case MUS_VOC: return(TO_LANG(S_mus_voc));
+ case MUS_SVX: return(TO_LANG(S_mus_svx));
+ case MUS_SOUNDFONT: return(TO_LANG(S_mus_soundfont));
+ }
+ return(NULL);
+}
+
+char *mus_data_format_to_string(int format)
+{
+ switch (format)
+ {
+ case MUS_BSHORT: return(TO_LANG(S_mus_bshort));
+ case MUS_LSHORT: return(TO_LANG(S_mus_lshort));
+ case MUS_MULAW: return(TO_LANG(S_mus_mulaw));
+ case MUS_ALAW: return(TO_LANG(S_mus_alaw));
+ case MUS_BYTE: return(TO_LANG(S_mus_byte));
+ case MUS_UBYTE: return(TO_LANG(S_mus_ubyte));
+ case MUS_BFLOAT: return(TO_LANG(S_mus_bfloat));
+ case MUS_LFLOAT: return(TO_LANG(S_mus_lfloat));
+ case MUS_BINT: return(TO_LANG(S_mus_bint));
+ case MUS_LINT: return(TO_LANG(S_mus_lint));
+ case MUS_BINTN: return(TO_LANG(S_mus_bintn));
+ case MUS_LINTN: return(TO_LANG(S_mus_lintn));
+ case MUS_B24INT: return(TO_LANG(S_mus_b24int));
+ case MUS_L24INT: return(TO_LANG(S_mus_l24int));
+ case MUS_BDOUBLE: return(TO_LANG(S_mus_bdouble));
+ case MUS_LDOUBLE: return(TO_LANG(S_mus_ldouble));
+ case MUS_UBSHORT: return(TO_LANG(S_mus_ubshort));
+ case MUS_ULSHORT: return(TO_LANG(S_mus_ulshort));
+ case MUS_BDOUBLE_UNSCALED: return(TO_LANG(S_mus_bdouble_unscaled));
+ case MUS_LDOUBLE_UNSCALED: return(TO_LANG(S_mus_ldouble_unscaled));
+ case MUS_BFLOAT_UNSCALED: return(TO_LANG(S_mus_bfloat_unscaled));
+ case MUS_LFLOAT_UNSCALED: return(TO_LANG(S_mus_lfloat_unscaled));
+ }
+ return(NULL);
+}
+
+static const char *any_data_format_name(int sndlib_format)
+{
+ if (MUS_DATA_FORMAT_OK(sndlib_format))
+ return(mus_data_format_name(sndlib_format));
+ else return(mus_header_original_format_name(mus_header_original_format(),
+ mus_header_type()));
+}
+
+#define SEEK_FILE_LENGTH(File) lseek(File, 0L, SEEK_END)
+static int read_bicsf_header(const char *filename, int chan);
+
+
+/* ------------------------------------ NeXT (or Sun) --------------------------------
+ *
+ * 0: ".snd"
+ * 4: data_location (bytes) (not necessarily word aligned on Sun)
+ * 8: data_size (bytes) -- sometimes incorrect ("advisory")
+ * 12: data format indicator -- see below
+ * 16: srate (int)
+ * 20: chans
+ * 24: comment start
+ *
+ * in an AFsp file, the first 4 bytes of the comment are "AFsp",
+ * for bicsf, the integer at 28 is 107364 or 107415
+ *
+ * on NeXTStep, always big-endian. ".snd"==0x2e736e64 on big-endian machines.
+ *
+ * formats are:
+ * 0 unspecified, 1 mulaw_8, 2 linear_8, 3 linear_16, 4 linear_24, 5 linear_32, 6 float,
+ * 7 double, 8 indirect, 9 nested, 10 dsp_core, 11 dsp_data_8, 12 dsp_data_16, 13 dsp_data_24,
+ * 14 dsp_data_32, 16 display, 17 mulaw_squelch, 18 emphasized, 19 compressed, 20 compressed_emphasized
+ * 21 dsp_commands, 22 dsp_commands_samples, 23 adpcm_g721, 24 adpcm_g722, 25 adpcm_g723,
+ * 26 adpcm_g723_5, 27 alaw_8, 28 aes, 29 delat_mulaw_8
+ * internal Snd(lib)-only formats:
+ * 30: mus_lint, 31: mus_lfloat,
+ * 32: mus_bintn, 33: mus_lintn,
+ * 34: mus_ldouble and others... (added by me for Snd internal use)
+ */
+
+/* according to the file /usr/share/magic, the DECN versions were little endian */
+
+static int read_next_header(const char *filename, int chan)
+{
+ int maybe_bicsf, err = MUS_NO_ERROR, i;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)hdrbuf);
+ data_location = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ if (data_location < 24) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data location: " OFF_TD "?", filename, data_location));
+ data_size = mus_char_to_bint((unsigned char *)(hdrbuf + 8));
+ /* can be bogus -- fixup if possible */
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if ((data_size <= 24) || (data_size > true_file_length))
+ data_size = (true_file_length - data_location);
+ else
+ {
+ if (true_file_length > (off_t)(1 << 31))
+ data_size = true_file_length - data_location; /* assume size field overflowed 32 bits */
+ }
+ original_data_format = mus_char_to_bint((unsigned char *)(hdrbuf + 12));
+ switch (original_data_format)
+ {
+ case 1: data_format = MUS_MULAW; break;
+ case 2: data_format = MUS_BYTE; break; /* some sound files assume MUS_UBYTE here! (NAS from 1994 X11R6 contrib) */
+ case 3: data_format = MUS_BSHORT; break;
+ case 4: data_format = MUS_B24INT; break;
+ case 5: data_format = MUS_BINT; break;
+ case 6: data_format = MUS_BFLOAT; break;
+ case 7: data_format = MUS_BDOUBLE; break;
+ case 18: data_format = MUS_BSHORT; break; /* "emphasized": Xavier Serra's de-emphasis filter: y(n) = x(n) + .9 y(n-1) */
+ case 27: data_format = MUS_ALAW; break;
+ case 30: data_format = MUS_LINT; break; /* from here on, for Snd's internal benefit -- these are probably not used elsewhere */
+ case 31: data_format = MUS_LFLOAT; break;
+ case 32: data_format = MUS_BINTN; break;
+ case 33: data_format = MUS_LINTN; break;
+ case 34: data_format = MUS_LDOUBLE; break;
+ case 35: data_format = MUS_ULSHORT; break;
+ case 36: data_format = MUS_UBSHORT; break;
+ case 37: data_format = MUS_LFLOAT_UNSCALED; break;
+ case 38: data_format = MUS_BFLOAT_UNSCALED; break;
+ case 39: data_format = MUS_LDOUBLE_UNSCALED; break;
+ case 40: data_format = MUS_BDOUBLE_UNSCALED; break;
+ case 41: data_format = MUS_LSHORT; break;
+ case 42: data_format = MUS_L24INT; break;
+ case 43: data_format = MUS_UBYTE; break;
+ default: data_format = MUS_UNKNOWN; break;
+ }
+ srate = mus_char_to_bint((unsigned char *)(hdrbuf + 16));
+ chans = mus_char_to_bint((unsigned char *)(hdrbuf + 20));
+ comment_start = 0;
+ comment_end = 0;
+ for (i = 24; i < data_location - 1; i++)
+ if (hdrbuf[i] == '\0')
+ break;
+ else
+ {
+ if (hdrbuf[i] != ' ')
+ {
+ comment_start = i;
+ comment_end = data_location - 1;
+ break;
+ }
+ }
+ if (comment_end < comment_start) comment_end = comment_start;
+ maybe_bicsf = mus_char_to_bint((unsigned char *)(hdrbuf + 28));
+ if (maybe_bicsf == 107364) err = read_bicsf_header(filename, chan);
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(err);
+}
+
+static int sndlib_format_to_next(int format)
+{
+ switch (format)
+ {
+ case MUS_MULAW: return(1); break;
+ case MUS_BYTE: return(2); break;
+ case MUS_BSHORT: return(3); break;
+ case MUS_B24INT: return(4); break;
+ case MUS_BINT: return(5); break;
+ case MUS_BFLOAT: return(6); break;
+ case MUS_BDOUBLE: return(7); break;
+ case MUS_ALAW: return(27); break;
+ case MUS_LINT: return(30); break; /* see above */
+ case MUS_LFLOAT: return(31); break;
+ case MUS_BINTN: return(32); break;
+ case MUS_LINTN: return(33); break;
+ case MUS_LDOUBLE: return(34); break;
+ case MUS_ULSHORT: return(35); break;
+ case MUS_UBSHORT: return(36); break;
+ case MUS_LFLOAT_UNSCALED: return(37); break;
+ case MUS_BFLOAT_UNSCALED: return(38); break;
+ case MUS_LDOUBLE_UNSCALED: return(39); break;
+ case MUS_BDOUBLE_UNSCALED: return(40); break;
+ case MUS_LSHORT: return(41); break;
+ case MUS_L24INT: return(42); break;
+ case MUS_UBYTE: return(43); break;
+ default:
+ return(mus_error(MUS_UNSUPPORTED_DATA_FORMAT, "Next header: can't write data format: %d (%s)",
+ format,
+ any_data_format_name(format)));
+ break;
+ }
+}
+
+#if MUS_DEBUGGING
+ #define CHK_WRITE(Fd, Buf, Len) \
+ do { size_t bytes = 0; \
+ if (((Len) > 0) && ((bytes = write(Fd, Buf, Len)) == 0)) \
+ fprintf(stderr, "%s[%d]: header write error (wrote: %d != requested: %d)", c__FUNCTION__, __LINE__, (int)bytes, (int)(Len)); \
+ } while (0)
+ #define CHK_READ(Fd, Buf, Len) \
+ do { size_t bytes = 0; \
+ if (((Len) > 0) && ((bytes = read(Fd, Buf, (Len))) == 0)) \
+ fprintf(stderr, "%s[%d]: header read error (read %d != requested %d)", c__FUNCTION__, __LINE__, (int)bytes, (int)(Len)); \
+ } while (0)
+#else
+ #define CHK_WRITE(Fd, Buf, Len) do {if (((Len) > 0) && (write(Fd, Buf, Len) == 0)) fprintf(stderr, "header write error");} while (0)
+ #define CHK_READ(Fd, Buf, Len) do {if (((Len) > 0) && (read(Fd, Buf, Len) == 0)) fprintf(stderr, "header read error");} while (0)
+#endif
+
+static void write_next_comment(int fd, const char *comment, int len, int loc)
+{
+ if (len > 0)
+ CHK_WRITE(fd, (unsigned char *)comment, len);
+ len = loc - (len + 24);
+ if (len > 0)
+ {
+ unsigned char *combuf;
+ combuf = (unsigned char *)CALLOC(len, sizeof(char));
+ CHK_WRITE(fd, combuf, len);
+ FREE(combuf);
+ }
+}
+
+int mus_header_write_next_header(int chan, int wsrate, int wchans, int loc, int siz, int format, const char *comment, int len)
+{
+ int i, j;
+ write_four_chars((unsigned char *)hdrbuf, I_DSND); /* ".snd" */
+ i = len / 4;
+ j = 24 + (4 * (i + 1));
+ if (loc < j) loc = j;
+ mus_bint_to_char((unsigned char *)(hdrbuf + 4), loc);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 8), siz);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 12), sndlib_format_to_next(format));
+ mus_bint_to_char((unsigned char *)(hdrbuf + 16), wsrate);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 20), wchans);
+ CHK_WRITE(chan, hdrbuf, 24);
+ write_next_comment(chan, comment, len, loc);
+ data_location = loc;
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ AIFF ------------------------------------
+ *
+ * 0: "FORM"
+ * 4: size (bytes)
+ * 8: "AIFF" or "AIFC" -- the latter includes compressed formats (list extended for 8.5 Sound.h)
+ *
+ * Thereafter the file is organized into "chunks", each chunk being
+ * a 4-byte identifer followed by an int (4-bytes) giving the chunk size
+ * not including the 8-byte header. AIFF data is signed. If the chunk
+ * size is odd, an extra (unaccounted-for) null byte is added at the end.
+ *
+ * The chunks we want are "COMM", "SSND", and "APPL".
+ *
+ * COMM: 0: chans
+ * 2: frames
+ * 6: bits per sample
+ * 8: srate as 80-bit IEEE float
+ * then if AIFC (not AIFF), 4 bytes giving compression id ("NONE"=not compressed)
+ * followed by Pascal string giving long name of compression type
+ *
+ * SSND: 0: data location (offset within SSND chunk)
+ *
+ * Other chunks include: ANNO: a comment, INST: loop control, MARK: marker, MIDI: midi,
+ * COMT: comment (max 65536 chars), NAME: sound name, AUTH: author's name
+ * (c), AESD: recording data, APPL: application specific stuff
+ * "MARK" size short-#marks {marks} -- latter are short-ID long-position pstring-name.
+ * "INST" size chars[baseNote detune lowNote highNote lowVelocity HighVelocity] short-gain loops[sustain release]
+ * loop: short-playMode marker-begin marker-end (signed?) shorts)
+ * playMode: 0 no loop, 1 forward loop, 2 forward/backward loop
+ * chars are MIDI data (detune is in cents)
+ * "MIDI" size MIDI-data...
+ * "AESD" size AES Channel Status Data (24 bytes as specified by AES)
+ * see "AES: Guidelines for the use of the AES3 interface"
+ * byte 0: bit 0: 0 = consumer, 1 = pro
+ * bit 1: 0 = audio, 1 = non-audio
+ * bits 2:4: emphasis: 0:none, 4:none, 6:CD, 7:CCITT J17
+ * bits 6:7: srate: 00 = 48KHz, 01 = 48, 10 = 44.1, 11 = 32
+ * byte 1: bits 0:3: chans: 2:mono, else stereo
+ * byte 2 for word size stuff (always ends up 16-bit): bits 3-5 = sample length where 4 = 16-bit
+ * byte 3: multi-channels modes, 4: AES sync ref, 5:unused, 6-9:ASCII source ID, 10-13:ASCII destination ID
+ * byte 14-17:local sample addr, 18-21:time of day addr, then CRC checks
+ * "APPL" size signature data
+ * "COMT" size short-#comments {comments} -- the latter are long-time marker short-text-length char-text
+ * time is in seconds since 1-Jan-1904
+ * "NAME"/"AUTH"/"(c) "/"ANNO" size char-name
+ * "FVER" size(4) AIFC-format-version -- currently always 0xA2805140
+ * "SAXL" -- a desperate kludge to get around Apple's own compression schemes!
+ *
+ * always big-endian
+ * There was also (briefly) an AIFS file, now deprecated.
+ */
+
+/* ieee-80 conversions -- design by committee! */
+/* this code taken from CSound sources -- apparently originally written by Malcolm Slaney at Apple */
+
+#define ULPOW2TO31 ((unsigned int)0x80000000)
+#define DPOW2TO31 ((double)2147483648.0) /* 2^31 */
+
+static double myUlongToDouble(unsigned int ul)
+{
+ double val;
+ if(ul & ULPOW2TO31) val = DPOW2TO31 + (ul & (~ULPOW2TO31));
+ else val = ul;
+ return val;
+}
+
+static unsigned int myDoubleToUlong(double val)
+{
+ unsigned int ul;
+ if(val < DPOW2TO31) ul = (unsigned int)val;
+ else ul = ULPOW2TO31 | (unsigned int)(val-DPOW2TO31);
+ return ul;
+}
+
+static double ieee_80_to_double(unsigned char *p)
+{
+ unsigned char sign;
+ short lexp = 0;
+ unsigned int mant1 = 0;
+ unsigned int mant0 = 0;
+ lexp = *p++; lexp <<= 8; lexp |= *p++; sign = (lexp & 0x8000) ? 1 : 0; lexp &= 0x7FFF;
+ mant1 = *p++; mant1 <<= 8; mant1 |= *p++; mant1 <<= 8; mant1 |= *p++; mant1 <<= 8; mant1 |= *p++;
+ mant0 = *p++; mant0 <<= 8; mant0 |= *p++; mant0 <<= 8; mant0 |= *p++; mant0 <<= 8; mant0 |= *p++;
+ if(mant1 == 0 && mant0 == 0 && lexp == 0 && sign == 0)
+ return 0.0;
+ else
+ {
+ double val;
+ val = myUlongToDouble(mant0) * pow(2.0, -63.0);
+ val += myUlongToDouble(mant1) * pow(2.0, -31.0);
+ val *= pow(2.0, ((double) lexp) - 16383.0);
+ return sign ? -val : val;
+ }
+}
+
+static void double_to_ieee_80(double val, unsigned char *p)
+{
+ short lexp = 0;
+ unsigned char sign = 0;
+ unsigned int mant1 = 0;
+ unsigned int mant0 = 0;
+ if(val < 0.0) { sign = 1; val = -val; }
+ if(val != 0.0) /* val identically zero -> all elements zero */
+ {
+ lexp = (short)(log(val) / log(2.0) + 16383.0);
+ val *= pow(2.0, 31.0 + 16383.0 - (double)lexp);
+ mant1 = myDoubleToUlong(val);
+ val -= myUlongToDouble(mant1);
+ val *= pow(2.0, 32.0);
+ mant0 = myDoubleToUlong(val);
+ }
+ *p++ = ((sign << 7) | (lexp >> 8)); *p++ = 0xFF & lexp;
+ *p++ = 0xFF & (mant1 >> 24); *p++ = 0xFF & (mant1 >> 16); *p++ = 0xFF & (mant1 >> 8); *p++ = 0xFF & (mant1);
+ *p++ = 0xFF & (mant0 >> 24); *p++ = 0xFF & (mant0 >> 16); *p++ = 0xFF & (mant0 >> 8); *p++ = 0xFF & (mant0);
+}
+
+
+static off_t update_form_size, update_frames_location, update_ssnd_location;
+
+static int seek_and_read(int chan, unsigned char *buf, off_t offset, int nbytes)
+{
+ if (offset < 0) return(-1);
+ lseek(chan, offset, SEEK_SET);
+ return(read(chan, buf, nbytes));
+}
+
+static int read_aiff_marker(int m, unsigned char *buf)
+{
+ int psize;
+ marker_ids[m] = mus_char_to_bshort((unsigned char *)buf);
+ marker_positions[m] = mus_char_to_bint((unsigned char *)(buf + 2));
+ psize = (int)buf[6] + 1;
+ if (psize & 1) psize++;
+ return(psize+6);
+}
+
+static int read_aiff_header(const char *filename, int chan, int overall_offset)
+{
+ /* we know we have checked for FORM xxxx AIFF|AIFC when we arrive here */
+ /* as far as I can tell, the COMM block has the header data we seek, and the SSND block has the sound data */
+ int chunksize, chunkloc, i, j, ssnd_bytes = 0;
+ bool happy, got_comm = false;
+ off_t offset;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)(hdrbuf + 8 + overall_offset));
+ update_ssnd_location = 0;
+ chunkloc = 12 + overall_offset;
+ offset = 0;
+ for (i = 0; i < AUX_COMMENTS; i++) aux_comment_start[i] = 0;
+ data_format = MUS_BSHORT;
+ srate = 0;
+ chans = 0;
+ happy = true;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ update_form_size = mus_char_to_bint((unsigned char *)(hdrbuf + 4 + overall_offset)); /* should be file-size-8 unless there are multiple forms */
+ while (happy)
+ {
+ offset += chunkloc;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 32) <= 0)
+ {
+ if ((got_comm) && (data_location > 0))
+ {
+ mus_print("%s, aiff header: chunks confused at " OFF_TD "; will try to continue", filename, offset);
+ break;
+ }
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s, aiff header: chunks confused at " OFF_TD , filename, offset));
+ }
+ chunksize = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ if ((chunksize == 0) && /* can be empty data chunk */
+ (hdrbuf[0] == 0) && (hdrbuf[1] == 0) && (hdrbuf[2] == 0) && (hdrbuf[3] == 0))
+ break;
+ /* fprintf(stderr,"chunk: %c%c%c%c for %d\n", hdrbuf[0], hdrbuf[1], hdrbuf[2], hdrbuf[3], chunksize); */
+ if (match_four_chars((unsigned char *)hdrbuf, I_COMM))
+ {
+ int frames;
+ got_comm = true;
+ chans = mus_char_to_bshort((unsigned char *)(hdrbuf + 8));
+ frames = mus_char_to_ubint((unsigned char *)(hdrbuf + 10)); /* was bint 27-Jul-01 */
+ update_frames_location = 10 + offset;
+ original_data_format = mus_char_to_bshort((unsigned char *)(hdrbuf + 14));
+ if ((original_data_format % 8) != 0)
+ {
+ /* weird sizes are legal --
+ * these samples are left-justified (and zero padded on the right), so
+ * we can handle any bit size by rounding up to the nearest byte.
+ */
+ original_data_format = 8 * (1 + (original_data_format >> 3));
+ }
+ if (original_data_format == 8) data_format = MUS_BYTE;
+ else if (original_data_format == 16) data_format = MUS_BSHORT;
+ else if (original_data_format == 24) data_format = MUS_B24INT;
+ else if (original_data_format == 32) data_format = MUS_BINT;
+ else if (original_data_format == 64) data_format = MUS_BDOUBLE;
+ else return(mus_error(MUS_HEADER_READ_FAILED, "%s: bits per sample: %d?", filename, mus_char_to_bshort((unsigned char *)(hdrbuf + 14))));
+ srate = (int)ieee_80_to_double((unsigned char *)(hdrbuf + 16));
+ /* if AIFC, compression type over-rides (possibly bogus) original_data_format */
+ if (type_specifier == mus_char_to_uninterpreted_int((unsigned const char *)I_AIFC))
+ {
+ /* some aifc files assume the compression field is a new and very weird chunk!! -- surely a bug? */
+ /* AIFF spec says COMM size is always 18, but this is amended in the newer AIFC spec */
+ if (chunksize == 18) chunksize += (5 + ((int)hdrbuf[30])); /* 5 = chunk header length in this case */
+ if ((!(match_four_chars((unsigned char *)(hdrbuf + 26), I_NONE))) &&
+ (!(match_four_chars((unsigned char *)(hdrbuf + 26), I_twos))))
+ {
+ original_data_format = mus_char_to_uninterpreted_int((unsigned char *)(hdrbuf + 26));
+ if ((match_four_chars((unsigned char *)(hdrbuf + 26), I_ALAW)) ||
+ (match_four_chars((unsigned char *)(hdrbuf + 26), I_alaw)))
+ data_format = MUS_ALAW;
+ else
+ {
+ if ((match_four_chars((unsigned char *)(hdrbuf + 26), I_ULAW)) ||
+ (match_four_chars((unsigned char *)(hdrbuf + 26), I_ulaw)))
+ data_format = MUS_MULAW;
+ else
+ {
+ if ((match_four_chars((unsigned char *)(hdrbuf + 26), I_sowt)) ||
+ (match_four_chars((unsigned char *)(hdrbuf + 26), I_ni23)))
+ {
+ /* Sound.h sez sowt is just 16-bit format */
+ if (data_format == MUS_BSHORT) data_format = MUS_LSHORT;
+ else if (data_format == MUS_B24INT) data_format = MUS_L24INT;
+ else if (data_format == MUS_BINT) data_format = MUS_LINT;
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)(hdrbuf + 26), I_raw_))
+ {
+ if (data_format == MUS_BYTE) data_format = MUS_UBYTE;
+ else if (data_format == MUS_BSHORT) data_format = MUS_UBSHORT;
+ }
+ else
+ {
+ if ((match_four_chars((unsigned char *)(hdrbuf + 26), I_fl32)) ||
+ (match_four_chars((unsigned char *)(hdrbuf + 26), I_FL32)))
+ data_format = MUS_BFLOAT;
+ else
+ {
+ if (match_four_chars((unsigned char *)(hdrbuf + 26), I_fl64))
+ data_format = MUS_BDOUBLE;
+ else
+ {
+ if (match_four_chars((unsigned char *)(hdrbuf + 26), I_ima4))
+ {
+ block_align = 34;
+ original_data_format = MUS_AIFF_IMA_ADPCM;
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)(hdrbuf + 26), I_in32))
+ data_format = MUS_BINT;
+ else
+ {
+ if (match_four_chars((unsigned char *)(hdrbuf + 26), I_in24))
+ data_format = MUS_B24INT;
+ else
+ {
+ /* others from Sound.h:
+ 0x6D730002, -- Microsoft ADPCM - ACM code 2
+ 0x6D730011, -- DVI/Intel IMA ADPCM - ACM code 17
+ 'MAC3' -- MACE 3:1
+ 'MAC6' -- MACE 6:1
+ 'cdx4' -- CD/XA 4:1
+ 'cdx2' -- CD/XA 2:1
+ 'dvca' -- DV Audio
+ 'QDMC' -- QDesign music
+ 'QDM2' -- QDesign2 music
+ 'Qclp' -- QUALCOMM PureVoice
+ 0x6D730055 -- MPEG Layer 3, CBR only (pre QT4.1)
+ '.mp3' -- MPEG Layer 3, CBR & VBR (QT4.1 and later)
+ */
+ data_format = MUS_UNKNOWN;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ data_size = (frames * mus_bytes_per_sample(data_format) * chans);
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_SSND))
+ {
+ if (data_location != 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: two SSND chunks found", filename));
+ update_ssnd_location = offset + 4;
+ data_location = mus_char_to_bint((unsigned char *)(hdrbuf + 8)) + offset + 16; /* Baroque! */
+ /* offset is where the hdrbuf is positioned in the file, the sound data offset itself is at loc+8 and the */
+ /* 0-based location of the sound data is at the end of the chunk = 16 (8 = header+4 = offset+4 = blocksize) */
+ /* the next int can be the block size if the data is block-aligned */
+ /* only one SSND per AIFF is allowed */
+ if (chunksize == 0) break; /* this may happen while pre-reading an in-progress output file for updating */
+ ssnd_bytes = offset + chunksize - data_location + 8;
+ }
+ else
+ {
+ if ((match_four_chars((unsigned char *)hdrbuf, I_ANNO)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_COMT)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_NAME)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_AUTH)))
+ {
+ j = 0;
+ for (i = 0; i < AUX_COMMENTS; i++)
+ if (aux_comment_start[i] == 0)
+ {
+ j = i;
+ break;
+ }
+ if (j >= AUX_COMMENTS)
+ {
+ mus_print("read_aiff_header: ran out of auxiliary comment space");
+ j = 0;
+ }
+ aux_comment_start[j] = offset + 8;
+ if (match_four_chars((unsigned char *)hdrbuf, I_COMT))
+ aux_comment_start[j] += 8; /* skip time stamp and markerId (not ID, I assume!) */
+ aux_comment_end[j] = offset + 7 + chunksize;
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_APPL))
+ {
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_MUS_))
+ {
+ /* my own chunk has the arbitrary length comment I use (actually the ASCII */
+ /* representation of a lisp program evaluated in the CLM package) to handle mix et al. */
+ /* It is nothing more than the actual string -- remember to pad to even length here. */
+ comment_start = offset + 12;
+ comment_end = comment_start + chunksize - 5;
+ }
+ else
+ {
+ if ((match_four_chars((unsigned char *)(hdrbuf + 8), I_SU7M)) ||
+ (match_four_chars((unsigned char *)(hdrbuf + 8), I_SU7R)))
+ {
+ mus_print("this is an SU700 ssp file?");
+ data_location = 512;
+ chans = 1;
+ /* actually SU7M and SU7R point to 2 chan data as separate chunks */
+ }
+ }
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_INST))
+ {
+ base_note = hdrbuf[8];
+ base_detune = hdrbuf[9];
+ loop_modes[0] = mus_char_to_bshort((unsigned char *)(hdrbuf + 16));
+ loop_starts[0] = mus_char_to_bshort((unsigned char *)(hdrbuf + 18));
+ loop_ends[0] = mus_char_to_bshort((unsigned char *)(hdrbuf + 20));
+ loop_modes[1] = mus_char_to_bshort((unsigned char *)(hdrbuf + 22));
+ loop_starts[1] = mus_char_to_bshort((unsigned char *)(hdrbuf + 24));
+ loop_ends[1] = mus_char_to_bshort((unsigned char *)(hdrbuf + 26));
+ /* these are mark numbers */
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_MARK))
+ {
+ int num_marks, m, moff, msize;
+ /* unsigned short #marks, each mark: id pos name (pstring damn it) */
+ num_marks = mus_char_to_ubshort((unsigned char *)(hdrbuf + 8));
+ if (num_marks > markers)
+ {
+ if (markers > 0)
+ {
+ if (marker_ids) FREE(marker_ids);
+ if (marker_positions) FREE(marker_positions);
+ }
+ markers = num_marks;
+ marker_ids = (int *)CALLOC(markers, sizeof(int));
+ marker_positions = (int *)CALLOC(markers, sizeof(int));
+ }
+ moff = 10;
+ for (m = 0; m < num_marks; m++)
+ {
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset + moff, 8) > 0)
+ {
+ msize = read_aiff_marker(m, (unsigned char *)hdrbuf);
+ moff += msize;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ chunkloc = (8 + chunksize);
+ if (chunksize & 1) chunkloc++; /* extra null appended to odd-length chunks */
+ if ((offset + chunkloc) >= update_form_size) happy = false;
+ }
+ if (!got_comm)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no COMM chunk", filename));
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no SSND (data) chunk", filename));
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ if ((data_size > ssnd_bytes) && (data_format != MUS_UNKNOWN))
+ data_size = ssnd_bytes;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+static int sndlib_format_to_aiff_bits(int format)
+{
+ switch (format)
+ {
+ case MUS_BSHORT: case MUS_LSHORT: case MUS_UBSHORT: case MUS_ULSHORT: return(16); break;
+ case MUS_B24INT: case MUS_L24INT: return(24); break;
+ case MUS_BINT: case MUS_LINT: case MUS_BFLOAT: case MUS_LFLOAT: return(32); break;
+ case MUS_BDOUBLE: case MUS_LDOUBLE: return(64); break;
+ case MUS_BYTE: case MUS_UBYTE: case MUS_MULAW: case MUS_ALAW: return(8); break;
+ default:
+ return(mus_error(MUS_UNSUPPORTED_DATA_FORMAT, "aiff header: can't write data format: %d (%s)",
+ format,
+ any_data_format_name(format)));
+ break;
+ }
+}
+
+static const char *sndlib_format_to_aifc_name(int format)
+{
+ switch (format)
+ {
+ case MUS_BSHORT: case MUS_B24INT: case MUS_BINT: case MUS_BYTE: return((const char *)I_NONE); break; /* use in24 and in32? */
+ case MUS_LSHORT: case MUS_L24INT: case MUS_LINT: return((const char *)I_sowt); break; /* should this use ni23? */
+ case MUS_BFLOAT: return((const char *)I_fl32); break;
+ case MUS_BDOUBLE: return((const char *)I_fl64); break;
+ case MUS_UBYTE: case MUS_UBSHORT: return((const char *)I_raw_); break;
+ case MUS_MULAW: return((const char *)I_ulaw); break;
+ case MUS_ALAW: return((const char *)I_alaw); break;
+ default: return((const char *)I_NONE); break;
+ }
+}
+
+static int write_aif_header(int chan, int wsrate, int wchans, int siz, int format, const char *comment, int len, bool aifc_header)
+{
+ /* we write the simplest possible AIFC header: AIFC | COMM | APPL-MUS_ if needed | SSND eof. */
+ /* the assumption being that we're going to be appending sound data once the header is out */
+ /* INST and MARK chunks added Jul-95 for various programs that expect them (MixView). */
+ int i, j, lenhdr, lenloop, curend, extra; /* set aifc to 0 to get old-style AIFF header */
+ char *str;
+ lenhdr = 0;
+ extra = 0;
+ curend = 0;
+ lenloop = 38;
+ if ((loop_modes[0] != 0) || (loop_modes[1] != 0)) lenloop = 42 + 28;
+ if (len != 0)
+ {
+ lenhdr = 12;
+ if ((len % 4) != 0)
+ extra = (4 - (len % 4));
+ }
+ write_four_chars((unsigned char *)hdrbuf, I_FORM);
+ if (aifc_header)
+ mus_bint_to_char((unsigned char *)(hdrbuf + 4), len + 30 + 16 + lenloop + siz + lenhdr + extra + 12 + 10);
+ else mus_bint_to_char((unsigned char *)(hdrbuf + 4), len + 30 + 16 + lenloop + siz + lenhdr + extra);
+ /*
+ * comment length + 4 for AIFF 18+8 for I_COMM info + 16 for I_SSND info + 38 for INST and MARK +
+ * siz for data + 12 for comment header if any + padding == total size - 8 (i.e. FORM header).
+ * INST+MARK (38) added 3-Jul-95 for Notam software compatibility
+ */
+ if (aifc_header)
+ {
+ write_four_chars((unsigned char *)(hdrbuf + 8), I_AIFC);
+ CHK_WRITE(chan, hdrbuf, 12);
+ curend = 12;
+ write_four_chars((unsigned char *)hdrbuf, I_FVER);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 4), 4);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 8), 0xA2805140);
+ }
+ else write_four_chars((unsigned char *)(hdrbuf + 8), I_AIFF);
+ write_four_chars((unsigned char *)(hdrbuf + 12), I_COMM);
+ if (aifc_header)
+ mus_bint_to_char((unsigned char *)(hdrbuf + 16), 18 + 10);
+ else mus_bint_to_char((unsigned char *)(hdrbuf + 16), 18);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 20), (short)wchans);
+ if (wchans > 0)
+ mus_bint_to_char((unsigned char *)(hdrbuf + 22), siz / (wchans * mus_bytes_per_sample(format)));
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 26), sndlib_format_to_aiff_bits(format));
+ double_to_ieee_80((double)wsrate, (unsigned char *)(hdrbuf + 28));
+ if (aifc_header)
+ {
+ str = (char *)sndlib_format_to_aifc_name(format);
+ write_four_chars((unsigned char *)(hdrbuf + 38), (const unsigned char *)str);
+ (*(unsigned char *)(hdrbuf + 42)) = 4; /* final pad null not accounted-for */
+ write_four_chars((unsigned char *)(hdrbuf + 43), (const unsigned char *)str);
+ (*(unsigned char *)(hdrbuf + 47)) = 0;
+ i = 48;
+ }
+ else i = 38;
+ if (len != 0)
+ {
+ if (aifc_header)
+ {
+ write_four_chars((unsigned char *)(hdrbuf + 48), I_APPL);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 52), len + 4 + extra);
+ write_four_chars((unsigned char *)(hdrbuf + 56), I_MUS_);
+ i = 60;
+ }
+ else
+ {
+ write_four_chars((unsigned char *)(hdrbuf + 38), I_APPL);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 42), len + 4 + extra);
+ write_four_chars((unsigned char *)(hdrbuf + 46), I_MUS_);
+ i = 50;
+ }
+ for (j = 0; j < len; j++)
+ {
+ if (i == HDRBUFSIZ)
+ {
+ curend += HDRBUFSIZ;
+ CHK_WRITE(chan, hdrbuf, HDRBUFSIZ);
+ i = 0;
+ }
+ hdrbuf[i] = comment[j];
+ i++;
+ }
+ if (extra != 0)
+ {
+ if ((i + extra) > HDRBUFSIZ)
+ {
+ curend += i;
+ CHK_WRITE(chan, hdrbuf, i);
+ i = 0;
+ }
+ for (j = 0; j < extra; j++)
+ {
+ hdrbuf[i] = 0;
+ i++;
+ }
+ }
+ }
+ curend += i;
+ CHK_WRITE(chan, hdrbuf, i);
+ if ((loop_modes[0] == 0) && (loop_modes[1] == 0))
+ {
+ write_four_chars((unsigned char *)hdrbuf, I_MARK); /* SoundHack includes a blank MARK chunk for some reason */
+ mus_bint_to_char((unsigned char *)(hdrbuf + 4), 2);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 8), 0);
+ write_four_chars((unsigned char *)(hdrbuf + 10), I_INST);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 14), 20);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 18), 0x3c00007f); /* base-note = middle C, detune = 0, lownote = 0, highnote = 0x7f */
+ mus_bint_to_char((unsigned char *)(hdrbuf + 22), 0x017f0000); /* lowvelocity = 1, highvelocity = 0x7f, gain = 0 */
+ mus_bint_to_char((unsigned char *)(hdrbuf + 26), 0); /* no loops */
+ mus_bint_to_char((unsigned char *)(hdrbuf + 30), 0);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 34), 0);
+ CHK_WRITE(chan, hdrbuf, 38);
+ curend += 38;
+ }
+ else
+ {
+ write_four_chars((unsigned char *)hdrbuf, I_MARK);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 4), 8 * 4 + 2); /* 2 for mark#, then 2:id + 4:pos + 2:pstr */
+ /* loop_info: 0..3 are markers positions (ids 1..4) */
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 8), 4);
+ for (j = 0; j < 4; j++)
+ {
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 10 + 8 * j), j + 1);
+ switch (j)
+ {
+ case 0: mus_bint_to_char((unsigned char *)(hdrbuf + 10 + 8 * j + 2), loop_starts[0]); break;
+ case 1: mus_bint_to_char((unsigned char *)(hdrbuf + 10 + 8 * j + 2), loop_ends[0]); break;
+ case 2: mus_bint_to_char((unsigned char *)(hdrbuf + 10 + 8 * j + 2), loop_starts[1]); break;
+ case 3: mus_bint_to_char((unsigned char *)(hdrbuf + 10 + 8 * j + 2), loop_ends[1]); break;
+ }
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 10 + 8 * j + 6), 0);
+ }
+ CHK_WRITE(chan, hdrbuf, 42);
+ curend += 42;
+ write_four_chars((unsigned char *)hdrbuf, I_INST);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 4), 20);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 8), 0x3c00007f);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 12), 0x017f0000);
+ hdrbuf[8] = (unsigned char)(base_note);
+ hdrbuf[9] = (unsigned char)(base_detune);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 16), loop_modes[0]);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 18), 1);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 20), 2);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 22), loop_modes[1]);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 24), 3);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 26), 4);
+ CHK_WRITE(chan, hdrbuf, 28);
+ curend += 28;
+ }
+ write_four_chars((unsigned char *)(hdrbuf), I_SSND);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 4), siz + 8);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 8), 0); /* "offset" */
+ mus_bint_to_char((unsigned char *)(hdrbuf + 12), 0); /* "blocksize " */
+ CHK_WRITE(chan, hdrbuf, 16);
+ data_location = 16 + curend;
+ return(MUS_NO_ERROR);
+}
+
+char *mus_header_aiff_aux_comment(const char *name, off_t *starts, off_t *ends)
+{
+ /* AIFC: look for aux comments (ANNO chunks) */
+ char *sc = NULL;
+ if ((starts) && (starts[0] != 0))
+ {
+ off_t full_len;
+ int fd, i;
+ fd = mus_file_open_read(name);
+ if (fd == -1) return(NULL);
+ full_len = 0;
+ for (i = 0; i < AUX_COMMENTS; i++)
+ if ((starts[i] > 0) &&
+ (starts[i] < ends[i]))
+ full_len += (ends[i] - starts[i] + 3);
+ if (full_len > 0)
+ {
+ off_t sc_len;
+ sc = (char *)CALLOC(full_len, sizeof(char));
+ sc_len = 0;
+ for (i = 0; i < AUX_COMMENTS; i++)
+ {
+ off_t start, end, len;
+ start = starts[i];
+ end = ends[i];
+ if ((start > 0) && (start < end))
+ {
+ int j;
+ len = end - start + 1;
+ lseek(fd, start, SEEK_SET);
+ CHK_READ(fd, (char *)(sc + sc_len), len);
+ for (j = 0; j < len; j++)
+ if (sc[j + sc_len] == 0)
+ sc[j + sc_len] = ' ';
+ sc_len += len;
+ sc[sc_len++] = '\n';
+ }
+ }
+ }
+ CLOSE(fd, name);
+ }
+ return(sc);
+}
+
+/* ------------------------------------ RIFF (wave) ------------------------------------
+ *
+ * see ftp.microsoft.com:/SoftLib/MSLFILES/MDRK.EXE (also MMSYSTEM.H and MMREG.H)
+ * ftp://ftp.isi.edu/in-notes/rfc2361.txt
+ *
+ * 0: "RIFF" (little-endian) or "RIFX" (big-endian)
+ * 4: size
+ * 8: "WAVE" ("RMID" = midi data, others are AVI, CPPO, ACON, DLS? etc)
+ * AVI chunk can include audio data
+ *
+ * rest very similar to AIFF (odd-sized chunks are padded)
+ *
+ * fmt 0: format code (see below)
+ * 2: chans
+ * 4: srate (long)
+ * 8: average rate "for buffer estimation"
+ * 12: alignment "block size"
+ * 14: data size (bits per sample) (PCM only)
+ * 16: count (bytes) of extra info in the header (i.e. trailing info added to this basic header)
+ * 20: samples per block (short) in dvi_adpcm
+ *
+ * formats are: 0: unknown, 1: PCM, 2: ADPCM, 3: IEEE float, 4: VSELP, 5: IBM_CVSD, 6: alaw, 7: mulaw
+ * 0x10: OKI_ADPCM, 0x11: DVI_ADPCM, 0x12: MediaSpace_ADPCM,
+ * 0x13: Sierra_ADPCM, 0x14: G723_ADPCM, 0x15: DIGISTD, 0x16: DIGIFIX, 0x17: Dialogic ADPCM,
+ * 0x18: Mediavision ADPCM, 0x19: HP cu codec,
+ * 0x20: Yamaha_ADPCM, 0x21: SONARC, 0x22: DSPGroup_TrueSpeech
+ * 0x23: EchoSC1, 0x24: AudioFile_AF36, 0x25: APTX, 0x26: AudioFile_AF10
+ * 0x27: prosody 1612, 0x28: lrc,
+ * 0x30: Dolby_Ac2, 0x31: GSM610, 0x32: MSN audio codec, 0x33: Antext_ADPCM, 0x34: Control_res_vqlpc,
+ * 0x35: DIGIREAL, 0x36: DIGIADPCM, 0x37: Control_res_cr10, 0x38: NMS_VBXADPCM, 0x39:Roland rdac,
+ * 0x3a: echo sc3, 0x3b: Rockwell adpcm, 0x3c: Rockwell digitalk codec, 0x3d: Xebec,
+ * 0x40: G721_ADPCM, 0x41: G728 CELP, 0x42: MS G723, 0x50: MPEG,
+ * 0x52: RT24, 0x53: PAC, 0x55: Mpeg layer 3, 0x59: Lucent G723, 0x60: Cirrus,
+ * 0x61: ESS Tech pcm, 0x62: voxware (obsolete), 0x63: canopus atrac,
+ * 0x64: G726, 0x65: G722, 0x66: DSAT, 0x67: DSAT display,
+ * 0x69: voxware (obsolete), 0x70: voxware ac8 (obsolete), 0x71: voxware ac10 (obsolete),
+ * 0x72: voxware ac16 (obsolete), 0x73: voxware ac20 (obsolete), 0x74: voxware rt24,
+ * 0x75: voxware rt29, 0x76: voxware rt29hw (obsolete), 0x77: voxware vr12 (obsolete),
+ * 0x78: voxware vr18 (obsolete), 0x79: voxware tq40 (obsolete),
+ * 0x80: softsound, 0x81: voxware tq60 (obsolete), 0x82: MS RT24, 0x83: G729A,
+ * 0x84: MVI_MVI2, 0x85: DF G726, 0x86: DF GSM610, 0x88: isaudio, 0x89: onlive,
+ * 0x91: sbc24, 0x92: dolby ac3 spdif, 0x97: zyxel adpcm, 0x98: philips lpcbb,
+ * 0x99: packed, 0x100: rhetorex adpcm,
+ * 0x101: Irat, 0x102: IBM_alaw?, 0x103: IBM_ADPCM?,
+ * 0x111: vivo G723, 0x112: vivo siren, 0x123: digital g273
+ * 0x200: Creative_ADPCM, 0x202: Creative fastspeech 8, 0x203: Creative fastspeech 10,
+ * 0x220: quarterdeck, 0x300: FM_TOWNS_SND, 0x400: BTV digital, 0x680: VME vmpcm,
+ * 0x1000: OLIGSM, 0x1001: OLIADPCM, 0x1002: OLICELP, 0x1003: OLISBC, 0x1004: OLIOPR
+ * 0x1100: LH codec, 0x1400: Norris, 0x1401: isaudio, 0x1500: Soundspace musicompression, 0x2000: DVM
+ * (see http://www.microsoft.com/asf/resources/draft-ietf-fleischman-codec-subtree-00.txt)
+ * and new: 0xFFFE: wave_format_extensible: bits/sample, mapping, 16 byte guid, 1st 2 bytes are code as above
+ *
+ * RIFF and LIST chunks have nested chunks. Registered chunk names include:
+ * LIST with subchunks, one of which can be:
+ * INFO itself containing:
+ * IARL: archival location, IART: artist, ICMS: commissioned, ICMT: comment, ICOP: copyright, ICRD: creation date,
+ * ICRP: uh...cropped, IDIM: dimensions, IDPI: dpi, IENG: engineer, IGNR: genre, IKEY: keywords, ILGT: lightness,
+ * IMED: medium, INAM: name, IPLT: palette, IPRD: product, ISBJ: subject, ISFT: software, ISHP: sharpness,
+ * ISRC: source, ISRF: source form, ITCH: technician, ISMP: SMPTE time code, IDIT: digitization time
+ *
+ * data chunk has the samples
+ * other (currently ignored) chunks are wavl = waveform data, fact, cues of some sort, slnt = silence,
+ * plst = playlist, adtl = associated data list, labl = cue label, note = cue comments,
+ * ltxt = text associated with data segment (cue), file, DISP = displayable object,
+ * JUNK = outdated info, PAD = padding, etc
+ * fact chunk generally has number of samples (used in compressed files)
+ */
+
+static int wave_to_sndlib_format(int osf, int bps, bool little)
+{
+ switch (osf)
+ {
+ case 1:
+ switch (bps)
+ {
+ case 8: return(MUS_UBYTE); break;
+ case 16: if (little) return(MUS_LSHORT); else return(MUS_BSHORT); break;
+ case 32: if (little) return(MUS_LINT); else return(MUS_BINT); break;
+ case 24: if (little) return(MUS_L24INT); else return(MUS_B24INT); break;
+ default: return(MUS_UBYTE); break;
+ }
+ break;
+ case 3:
+ if (little)
+ {
+ if (bps == 64)
+ return(MUS_LDOUBLE);
+ else return(MUS_LFLOAT);
+ }
+ else
+ {
+ if (bps == 64)
+ return(MUS_BDOUBLE);
+ else return(MUS_BFLOAT);
+ }
+ break;
+ case 6: if (bps == 8) return(MUS_ALAW); break;
+ case 7: if (bps == 8) return(MUS_MULAW); break;
+ /* IBM mulaw follows G711 specs like other versions (this info direct from IBM) */
+ case 0x101: return(MUS_MULAW); break;
+ case 0x102: return(MUS_ALAW); break;
+ }
+ return(MUS_UNKNOWN);
+}
+
+static int read_riff_header(const char *filename, int chan)
+{
+ /* we know we have checked for RIFF xxxx WAVE when we arrive here */
+ int chunksize, chunkloc, i;
+ bool little, got_fmt = false;
+ off_t offset;
+ little = true;
+ if (match_four_chars((unsigned char *)hdrbuf, I_RIFX)) little = false; /* big-endian data in this case, but I've never seen one */
+ little_endian = little;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)(hdrbuf + 8));
+ chunkloc = 12;
+ offset = 0;
+ data_format = MUS_UNKNOWN;
+ srate = 0;
+ chans = 0;
+ fact_samples = 0;
+ bits_per_sample = 0;
+ for (i = 0; i < AUX_COMMENTS; i++) aux_comment_start[i] = 0;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ update_form_size = big_or_little_endian_int((unsigned char *)(hdrbuf + 4), little);
+ while (true)
+ {
+ offset += chunkloc;
+ if (offset >= true_file_length) break;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 64) <= 0) break;
+ chunksize = big_or_little_endian_int((unsigned char *)(hdrbuf + 4), little);
+ if ((chunksize == 0) && /* can be empty data chunk */
+ (hdrbuf[0] == 0) && (hdrbuf[1] == 0) && (hdrbuf[2] == 0) && (hdrbuf[3] == 0))
+ break;
+ if (match_four_chars((unsigned char *)hdrbuf, I_fmt_))
+ {
+ /*
+ * 8: short format code --1 = PCM for example
+ * 10: short chans --1
+ * 12: long rate --48000 (0xbb80)
+ * 16: long ave rate --65655 (0x10077)
+ * 20: short align --2
+ * 22: short data size (bits) --16
+ * 24: bytes of extra
+ * ... some extra data dependent on format
+ *
+ * R I F F # # # # W A V E f m t sp
+ * 5249 4646 f851 0500 5741 5645 666d 7420
+ * e40f 0000 0100 0100 80bb 0000 0077 0100
+ * 0200 1000 0000 0000 0000 0000 0000 0000
+ *
+ * #x000551f8 = 348664 = size in bytes - 8
+ * #x00000fe4 = 4068 [fmt_ chunk size?]
+ */
+ got_fmt = true;
+ original_data_format = big_or_little_endian_short((unsigned char *)(hdrbuf + 8), little);
+ chans = big_or_little_endian_short((unsigned char *)(hdrbuf + 10), little);
+ srate = big_or_little_endian_int((unsigned char *)(hdrbuf + 12), little);
+ update_frames_location = 12 + offset;
+ block_align = big_or_little_endian_short((unsigned char *)(hdrbuf + 20), little);
+ bits_per_sample = big_or_little_endian_short((unsigned char *)(hdrbuf + 22), little);
+ if (original_data_format == -2) /* 0xFFFE = "extensible" : short size=22, short bits, long chanmap, short format */
+ original_data_format = big_or_little_endian_short((unsigned char *)(hdrbuf + 24 + 8), little);
+ data_format = wave_to_sndlib_format(original_data_format, bits_per_sample, little);
+ }
+ else
+ {
+ if ((match_four_chars((unsigned char *)hdrbuf, I_data)) && (data_location == 0))
+ {
+ update_ssnd_location = offset + 4;
+ data_location = offset + 8;
+ data_size = big_or_little_endian_uint((unsigned char *)(hdrbuf + 4), little); /* was int 27-Jul-01 */
+ if (chunksize == 0) break; /* see aiff comment */
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_fact))
+ {
+ fact_samples = big_or_little_endian_int((unsigned char *)(hdrbuf + 8), little);
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_inst))
+ {
+ base_note = hdrbuf[8];
+ base_detune = hdrbuf[9];
+ /* rest is gain low-note high-note low-velocity high-velocity */
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_clm_))
+ {
+ comment_start = offset + 8;
+ comment_end = comment_start + chunksize - 1; /* end of comment not start of next chunk */
+ }
+ else
+ {
+ if ((match_four_chars((unsigned char *)hdrbuf, I_LIST)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 8), I_INFO)))
+ {
+ aux_comment_start[0] = offset + 8;
+ aux_comment_end[0] = offset + 8 + chunksize - 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ chunkloc = (8 + chunksize);
+ if (chunksize & 1) chunkloc++; /* extra null appended to odd-length chunks */
+ }
+ if (!got_fmt)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no fmt chunk?", filename));
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no data chunk?", filename));
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+static int write_riff_header(int chan, int wsrate, int wchans, int siz, int format, const char *comment, int len)
+{
+ int i, j, lenhdr, extra;
+ off_t offset, curend;
+ lenhdr = 0;
+ extra = 0;
+ if (len != 0)
+ {
+ lenhdr = 12;
+ if ((len % 4) != 0)
+ extra = (4 - (len % 4));
+ }
+ write_four_chars((unsigned char *)hdrbuf, I_RIFF);
+ mus_lint_to_char((unsigned char *)(hdrbuf + 4), len + 36 + siz + lenhdr + extra);
+ write_four_chars((unsigned char *)(hdrbuf + 8), I_WAVE);
+ write_four_chars((unsigned char *)(hdrbuf + 12), I_fmt_);
+ mus_lint_to_char((unsigned char *)(hdrbuf + 16), 24 - 8);
+ switch (format)
+ {
+ case MUS_MULAW:
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 20), 7);
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 34), 8);
+ break;
+ case MUS_ALAW:
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 20), 6);
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 34), 8);
+ break;
+ case MUS_UBYTE:
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 20), 1);
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 34), 8);
+ break;
+ case MUS_LSHORT:
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 20), 1);
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 34), 16);
+ break;
+ case MUS_L24INT:
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 20), 1);
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 34), 24);
+ break;
+ case MUS_LINT:
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 20), 1);
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 34), 32);
+ break;
+ case MUS_LFLOAT:
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 20), 3);
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 34), 32);
+ break;
+ case MUS_LDOUBLE:
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 20), 3);
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 34), 64);
+ break;
+ default:
+ return(mus_error(MUS_UNSUPPORTED_DATA_FORMAT, "riff header: can't write data format: %d (%s)",
+ format,
+ any_data_format_name(format)));
+ break;
+ }
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 22), (short)wchans);
+ mus_lint_to_char((unsigned char *)(hdrbuf + 24), wsrate);
+ mus_lint_to_char((unsigned char *)(hdrbuf + 28), wsrate * wchans * mus_bytes_per_sample(format)); /* added chans 10-Mar-99 */
+ mus_lshort_to_char((unsigned char *)(hdrbuf + 32), (short)(wchans * mus_bytes_per_sample(format)));
+
+ offset = 36;
+ i = 36;
+ curend = 0;
+ if (len != 0)
+ {
+ offset += len + 12;
+ write_four_chars((unsigned char *)(hdrbuf + 36), I_clm_);
+ mus_lint_to_char((unsigned char *)(hdrbuf + 40), len + extra);
+ i = 44;
+ for (j = 0; j < len; j++)
+ {
+ if (i == HDRBUFSIZ)
+ {
+ curend += HDRBUFSIZ;
+ CHK_WRITE(chan, hdrbuf, HDRBUFSIZ);
+ i = 0;
+ }
+ hdrbuf[i] = comment[j];
+ i++;
+ }
+ if (extra != 0)
+ {
+ if ((i + extra) > HDRBUFSIZ)
+ {
+ curend += i;
+ CHK_WRITE(chan, hdrbuf, i);
+ i = 0;
+ }
+ for (j = 0; j < extra; j++)
+ {
+ hdrbuf[i] = 0;
+ i++;
+ }
+ }
+ }
+ curend += i;
+ CHK_WRITE(chan, hdrbuf, i);
+ write_four_chars((unsigned char *)hdrbuf, I_data);
+ mus_lint_to_char((unsigned char *)(hdrbuf + 4), siz);
+ data_location = 8 + curend;
+ CHK_WRITE(chan, hdrbuf, 8);
+ return(MUS_NO_ERROR);
+}
+
+char *mus_header_riff_aux_comment(const char *name, off_t *starts, off_t *ends)
+{
+ char *sc = NULL, *auxcom;
+ if ((starts) && (starts[0] != 0))
+ {
+ int len, j, fd, k, m;
+ off_t i, end;
+ /* found a LIST+INFO chunk (and no other comment) */
+ fd = mus_file_open_read(name);
+ if (fd == -1) return(NULL);
+ i = starts[0];
+ end = ends[0];
+ sc = (char *)CALLOC(end - i + 2, sizeof(char));
+ j = 0;
+ k = 4;
+ lseek(fd, i, SEEK_SET);
+ auxcom = (char *)CALLOC(end - i + 2, sizeof(char));
+ CHK_READ(fd, auxcom, end - i + 1);
+ CLOSE(fd, name);
+ i += 4;
+ while (i < end)
+ {
+ for (m = 0; m < 4; m++) sc[j++] = auxcom[k++];
+ len = mus_char_to_lint((unsigned char *)(auxcom + k));
+ if ((len <= 0) || (len > end)) break;
+ sc[j++] = ':';
+ sc[j++] = ' ';
+ k += 4;
+ for (m = 0; m < len; m++)
+ if (auxcom[k] != 0)
+ sc[j++] = auxcom[k++];
+ else k++;
+ sc[j++] ='\n';
+ if (len & 1)
+ {
+ len++;
+ k++;
+ }
+ i += (len + 8);
+ }
+ FREE(auxcom);
+ }
+ return(sc);
+}
+
+
+/* soundforge -- just a quick hack until I get better documentation */
+static long little_long_long(unsigned char *buf)
+{
+ return(mus_char_to_lint((unsigned char *)(buf)));
+}
+
+static int read_soundforge_header(const char *filename, int chan)
+{
+ /* like RIFF but lowercase and 64-bit vals */
+ int chunksize, chunkloc, i, off;
+ off_t offset;
+ chunkloc = 12 * 2 + 16;
+ offset = 0;
+ data_format = MUS_UNKNOWN;
+ srate = 0;
+ chans = 0;
+ fact_samples = 0;
+ bits_per_sample = 0;
+ for (i = 0; i < AUX_COMMENTS; i++) aux_comment_start[i] = 0;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ update_form_size = little_long_long((unsigned char *)(hdrbuf + 4 * 2));
+ while (true)
+ {
+ offset += chunkloc;
+ if (offset >= true_file_length) break;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 64) <= 0) break;
+ chunksize = little_long_long((unsigned char *)(hdrbuf + 16));
+ if ((chunksize == 0) && /* can be empty data chunk? */
+ (hdrbuf[0] == 0) && (hdrbuf[1] == 0) && (hdrbuf[2] == 0) && (hdrbuf[3] == 0))
+ break;
+ if (match_four_chars((unsigned char *)hdrbuf, I_fmt_))
+ {
+ off = 16;
+ original_data_format = mus_char_to_lshort((unsigned char *)(hdrbuf + 8 + off));
+ chans = mus_char_to_lshort((unsigned char *)(hdrbuf + 10 + off));
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 12 + off));
+ block_align = mus_char_to_lshort((unsigned char *)(hdrbuf + 20 + off));
+ bits_per_sample = mus_char_to_lshort((unsigned char *)(hdrbuf + 22 + off));
+ data_format = wave_to_sndlib_format(original_data_format, bits_per_sample, true);
+ }
+ else
+ {
+ if ((match_four_chars((unsigned char *)hdrbuf, I_data)) && (data_location == 0))
+ {
+ data_location = offset + 16 + 8;
+ data_size = mus_char_to_ulint((unsigned char *)(hdrbuf + 16));
+ if (chunksize == 0) break; /* see aiff comment */
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_fact))
+ {
+ fact_samples = mus_char_to_lint((unsigned char *)(hdrbuf + 8));
+ }
+ }
+ }
+ chunkloc = (8 + chunksize);
+ chunkloc -= 8;
+ if (chunksize & 1) chunkloc++; /* extra null appended to odd-length chunks */
+ }
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no data chunk?", filename));
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ AVI ------------------------------------
+ * actually a video format, but it sometimes contains embedded 'wave' data
+ *
+ * RIFF xxx AVI
+ * <various LISTs>
+ * LIST xxxx hdr1 LIST strl(?) strh | strf | strn etc
+ * strf is the WAVE header starting with the sound format
+ * LIST xxxx movi ##db|##wb -- wb subblocks have the audio data (these need to be collected as a single stream)
+ * there are many complications that we make no effort to handle here
+ *
+ * described in http://www.rahul.net/jfm/avi.html
+ */
+
+static int read_avi_header(const char *filename, int chan)
+{
+ /* we know we have checked for RIFF xxxx AVI when we arrive here */
+ int chunksize, chunkloc, cksize, bits;
+ bool happy;
+ off_t ckoff, cktotal, offset;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)(hdrbuf + 8));
+ chunkloc = 12;
+ offset = 0;
+ data_format = MUS_UNKNOWN;
+ srate = 0;
+ chans = 1;
+ happy = true;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ while (happy)
+ {
+ offset += chunkloc;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 32) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s avi header: chunks confused at " OFF_TD, filename, offset));
+ chunksize = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ if ((chunksize == 0) && /* can be empty data chunk? */
+ (hdrbuf[0] == 0) && (hdrbuf[1] == 0) && (hdrbuf[2] == 0) && (hdrbuf[3] == 0))
+ break;
+ if (match_four_chars((unsigned char *)hdrbuf, I_LIST))
+ {
+ ckoff = offset + 12;
+ cktotal = 12;
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_movi))
+ {
+ while (cktotal < chunksize)
+ {
+ lseek(chan, ckoff, SEEK_SET);
+ CHK_READ(chan, hdrbuf, 8);
+ cksize = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ if ((hdrbuf[2] == 'w') && (hdrbuf[3] == 'b'))
+ {
+ data_location = ckoff;
+ if (srate != 0) happy = false;
+ break;
+ }
+ ckoff += (8 + cksize);
+ cktotal += (8 + cksize);
+ }
+ }
+ else
+ {
+ while (cktotal < chunksize)
+ {
+ lseek(chan, ckoff, SEEK_SET);
+ CHK_READ(chan, hdrbuf, 8);
+ cksize = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ ckoff += (8 + cksize);
+ cktotal += (8 + cksize);
+ if (match_four_chars((unsigned char *)hdrbuf, I_LIST))
+ {
+ off_t cksizer, ckoffr, cktotalr, rdsize;
+ ckoffr = ckoff + 12;
+ cktotalr = 12;
+ while (cktotalr < cksize)
+ {
+ lseek(chan, ckoffr, SEEK_SET);
+ CHK_READ(chan, hdrbuf, 8);
+ cksizer = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ ckoffr += (8 + cksizer);
+ cktotalr += (8 + cksizer);
+ if (match_four_chars((unsigned char *)hdrbuf, I_strf))
+ {
+ if (cksizer < HDRBUFSIZ)
+ rdsize = cksizer;
+ else rdsize = HDRBUFSIZ;
+ CHK_READ(chan, hdrbuf, rdsize);
+ original_data_format = mus_char_to_lshort((unsigned char *)hdrbuf);
+ chans = mus_char_to_lshort((unsigned char *)(hdrbuf + 2));
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ /* block_align = mus_char_to_lshort((unsigned char *)(hdrbuf + 12)); */
+ bits = mus_char_to_lshort((unsigned char *)(hdrbuf + 14));
+ /* only 16 bit linear little endian for now */
+ if ((bits == 16) && (original_data_format == 1))
+ data_format = MUS_LSHORT;
+ if (data_location != 0) happy = false;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ chunkloc = (8 + chunksize);
+ if (chunksize & 1) chunkloc++; /* extra null appended to odd-length chunks */
+ }
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no movi chunk?", filename));
+ if (data_location > true_file_length)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ data_size = mus_bytes_to_samples(data_format, true_file_length - data_location);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ SoundFont 2.0 ------------------------------------
+ *
+ * Emu's SoundFont(tm) format uses RIFF -- at ftp.creaf.com:/pub/emu/sf2_00a.ps)
+ *
+ * RIFF xxxx sfbk followed by
+ * LIST xxxx INFO chunk (nothing of interest -- icmt subchunk might have comments)
+ * LIST xxxx sdta chunk = data
+ * smpl chunk (16 bit linear little-endian)
+ * LIST xxxx pdta list chunk
+ * shdr subchunk has srate at 40 (int), samples at 28
+ *
+ * http://smurf.sourceforge.net/sfont_intro.php
+ * http://www.hammersound.net/
+ */
+
+static int soundfont_entries = 0;
+static int *soundfont_starts = NULL, *soundfont_ends = NULL, *soundfont_loop_starts = NULL, *soundfont_loop_ends = NULL;
+static int soundfont_size = 0;
+static char **soundfont_names = NULL;
+
+static void soundfont_entry(const char *name, int start, int end, int loop_start, int loop_end)
+{
+ if (soundfont_entries == soundfont_size)
+ {
+ int i;
+ if (soundfont_size == 0)
+ {
+ soundfont_size = 8;
+ soundfont_starts = (int *)CALLOC(soundfont_size, sizeof(int));
+ soundfont_ends = (int *)CALLOC(soundfont_size, sizeof(int));
+ soundfont_loop_starts = (int *)CALLOC(soundfont_size, sizeof(int));
+ soundfont_loop_ends = (int *)CALLOC(soundfont_size, sizeof(int));
+ soundfont_names = (char **)CALLOC(soundfont_size, sizeof(char *));
+ }
+ else
+ {
+ soundfont_size += 8;
+ soundfont_starts = (int *)REALLOC(soundfont_starts, soundfont_size * sizeof(int));
+ soundfont_ends = (int *)REALLOC(soundfont_ends, soundfont_size * sizeof(int));
+ soundfont_loop_starts = (int *)REALLOC(soundfont_loop_starts, soundfont_size * sizeof(int));
+ soundfont_loop_ends = (int *)REALLOC(soundfont_loop_ends, soundfont_size * sizeof(int));
+ soundfont_names = (char **)REALLOC(soundfont_names, soundfont_size * sizeof(char *));
+ }
+ for (i = soundfont_entries; i < soundfont_size; i++) soundfont_names[i] = NULL;
+ }
+ if (soundfont_names[soundfont_entries] == NULL) soundfont_names[soundfont_entries] = (char *)CALLOC(20, sizeof(char));
+ strcpy(soundfont_names[soundfont_entries], name);
+ soundfont_starts[soundfont_entries] = start;
+ soundfont_ends[soundfont_entries] = end;
+ soundfont_loop_starts[soundfont_entries] = loop_start;
+ soundfont_loop_ends[soundfont_entries] = loop_end;
+ soundfont_entries++;
+}
+
+int mus_header_sf2_entries(void) {return(soundfont_entries);}
+char *mus_header_sf2_name(int n) {return(soundfont_names[n]);}
+int mus_header_sf2_start(int n) {return(soundfont_starts[n]);}
+int mus_header_sf2_end(int n) {return(soundfont_ends[n]);}
+int mus_header_sf2_loop_start(int n) {return(soundfont_loop_starts[n]);}
+int mus_header_sf2_loop_end(int n) {return(soundfont_loop_ends[n]);}
+
+static int read_soundfont_header(const char *filename, int chan)
+{
+ /* we know we have checked for RIFF xxxx sfbk when we arrive here */
+ int chunksize, chunkloc, type, cksize, i, this_end, last_end;
+ off_t ckoff, offset;
+ bool happy;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)(hdrbuf + 8));
+ chunkloc = 12;
+ offset = 0;
+ soundfont_entries = 0;
+ data_format = MUS_LSHORT;
+ srate = 0;
+ chans = 1;
+ happy = true;
+ last_end = 0;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ while (happy)
+ {
+ offset += chunkloc;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 32) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s soundfont header: chunks confused at " OFF_TD, filename, offset));
+ chunksize = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ if ((chunksize == 0) && /* can be empty data chunk? */
+ (hdrbuf[0] == 0) && (hdrbuf[1] == 0) && (hdrbuf[2] == 0) && (hdrbuf[3] == 0))
+ break;
+ if (match_four_chars((unsigned char *)hdrbuf, I_LIST))
+ {
+ /* everything is squirreled away in LIST chunks in this format */
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_pdta))
+ {
+ /* go searching for I_shdr -- headers this complicated should be illegal. */
+ ckoff = offset + 12;
+ lseek(chan, ckoff, SEEK_SET);
+ while (srate == 0)
+ {
+ size_t bytes;
+ bytes = read(chan, hdrbuf, 8);
+ if (bytes == 0)
+ {
+ happy = false;
+ break;
+ }
+ i = 0;
+ cksize = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ ckoff += (8 + cksize);
+ /* here we need to jump over subchunks! -- 4-Aug-97 */
+ if (match_four_chars((unsigned char *)hdrbuf, I_shdr))
+ {
+ /* each sound:
+ * 0: name
+ * 20: start (in samples from start of bank)
+ * 24: end
+ * 28: loop start (also relative to start of bank)
+ * 32: loop end
+ * 36: sample rate
+ * 40: pitch (60 = middle C)
+ * 41: detune (cents)
+ * 42: link (to other channel if any?)
+ * 44: type (1 = mono, 2 = mono right, 4 = mono left, others (0x8000) apparently for ROM presets?)
+ */
+ while (i < cksize)
+ {
+ CHK_READ(chan, hdrbuf, 46);
+ i += 46;
+ type = mus_char_to_lshort((unsigned char *)(hdrbuf + 44));
+ if ((type == 1) &&
+ (mus_char_to_lint((unsigned char *)(hdrbuf + 24)) > 0))
+ {
+ if (srate == 0)
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 36));
+ soundfont_entry((char *)(hdrbuf),
+ mus_char_to_lint((unsigned char *)(hdrbuf + 20)),
+ this_end = mus_char_to_lint((unsigned char *)(hdrbuf + 24)),
+ mus_char_to_lint((unsigned char *)(hdrbuf + 28)),
+ mus_char_to_lint((unsigned char *)(hdrbuf + 32)));
+ if (this_end > last_end) last_end = this_end;
+ }
+ }
+ happy = (data_location == 0);
+ }
+ else
+ {
+ if (ckoff >= offset + 8 + chunksize)
+ break;
+ lseek(chan, ckoff, SEEK_SET);
+ }
+ }
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_sdta))
+ {
+ /* assume smpl follows + subchunk size */
+ /* Convert 1.4 appears to create a separate smpl chunk */
+ data_location = offset + 20; /* LIST xxxx sdta smpl xxxx ... */
+ happy = (srate == 0);
+ }
+ }
+ }
+ chunkloc = (8 + chunksize);
+ if (chunksize & 1) chunkloc++; /* extra null appended to odd-length chunks */
+ }
+ if (srate == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: srate == 0", filename));
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no sdta chunk?", filename));
+ if (last_end > 0)
+ data_size = last_end; /* samples already */
+ else data_size = (true_file_length - data_location) / 2;
+ return(MUS_NO_ERROR);
+}
+
+
+
+
+/* ------------------------------------ NIST ------------------------------------
+ *
+ * code available in ogitools-v1.0.tar.gz at svr-ftp.eng.cam.ac.uk:comp.speech/sources
+ *
+ * 0: "NIST_1A"
+ * 8: data_location as ASCII representation of integer (apparently always " 1024")
+ * 16: start of complicated header -- see below for details
+ *
+ * The most recent version of the SPHERE package is available
+ * via anonymous ftp from jaguar.ncsl.nist.gov [129.6.48.157] in the pub directory
+ * in compressed tar form as "sphere-v.tar.Z" (where "v" is the version
+ * code 2.6a last I looked). shortpack is also at this site.
+ *
+ * here's an example:
+ *
+ * NIST_1A
+ * 1024
+ * database_id -s5 TIMIT
+ * database_version -s3 1.0
+ * utterance_id -s8 aks0_sa1
+ * channel_count -i 1
+ * sample_count -i 63488
+ * sample_rate -i 16000
+ * sample_min -i -6967
+ * sample_max -i 7710
+ * sample_n_bytes -i 2
+ * sample_byte_format -s2 01
+ * sample_sig_bits -i 16
+ * end_head
+ *
+ * the sample_byte_format can be "10"=big-endian or "01"=little-endian, or "shortpack-v0"=compressed via shortpack
+ * other formats are wavpack and shorten.
+ *
+ * another field is 'sample_coding' which can be pcm (i.e. linear), 'pcm, embedded-shorten-v1.09', mu-law, alaw, ulaw, pculaw etc --
+ * so unpredictable as to be totally useless. This means we sometimes try to decode shorten-encoded files because
+ * we ignore this field. And worse, there's a 'channels_interleaved' field that (apparently) can be false. Tough.
+ */
+
+#define MAX_FIELD_LENGTH 80
+
+static int decode_nist_value(char *str, int base, int end)
+{
+ /* can be -i -r or -snnn where nnn = ascii rep of integer = len of string (!) */
+ /* we'll deal only with integer fields (and well-behaved string fields) */
+ int i, j;
+ char value[MAX_FIELD_LENGTH];
+ memset((void *)value, 0, MAX_FIELD_LENGTH);
+ i = base;
+ while ((i < end) && (i < MAX_FIELD_LENGTH) && (str[i] != '-')) i++; /* look for -i or whatever */
+ while ((i < end) && (i < MAX_FIELD_LENGTH) && (str[i] != ' ')) i++; /* look for space after it */
+ i++;
+ if (i >= MAX_FIELD_LENGTH) return(0);
+ for (j = 0; i < end; j++, i++)
+ value[j] = str[i];
+ value[j] = 0;
+ if (value[0] =='s') return(MUS_NIST_SHORTPACK);
+ sscanf(value, "%d", &i);
+ return(i);
+}
+
+static int read_nist_header(const char *filename, int chan)
+{
+ char str[MAX_FIELD_LENGTH], name[MAX_FIELD_LENGTH];
+ bool happy = true;
+ off_t curbase;
+ int k, hend, j, n, nm, samples, bytes, byte_format, idata_location = 0;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)hdrbuf); /* the actual id is "NIST_1A" */
+ memset((void *)str, 0, MAX_FIELD_LENGTH);
+ memset((void *)name, 0, MAX_FIELD_LENGTH);
+ for (k = 8; k < 16; k++)
+ str[k - 8] = hdrbuf[k];
+ sscanf(str, "%d", &idata_location); /* always "1024" */
+ if (idata_location != 1024)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s NIST data location: %d?", filename, idata_location));
+ data_location = 1024;
+ n = 16;
+ hend = INITIAL_READ_SIZE;
+ k = 0;
+ curbase = 0;
+ samples = 0;
+ bytes = 0;
+ srate = 0;
+ chans = 0;
+ comment_start = 16;
+ comment_end = 16;
+ byte_format = 10;
+ for (j = 0; j < MAX_FIELD_LENGTH; j++)
+ str[j] =' ';
+ while (happy)
+ {
+ /* much as in xIFF files, march through the file looking for the data we're after */
+ /* in this case we munch a character at a time... */
+ str[k] = hdrbuf[n];
+ if ((((str[k] == '\0') || (str[k] == '\n')) || ((curbase + n + 1) >= data_location)) || (k == 79))
+ {
+ /* got a complete record (assuming no embedded newlines, of course) */
+ /* now look for a record we care about and decode it */
+ nm = 0;
+ while ((nm < MAX_FIELD_LENGTH) && (str[nm] != ' ') && (str[nm] != '\0') && (str[nm] != '\n'))
+ {
+ name[nm] = str[nm];
+ nm++;
+ }
+ if (nm >= MAX_FIELD_LENGTH)
+ {
+ header_type = MUS_RAW;
+ data_format = MUS_UNKNOWN;
+ return(mus_error(MUS_UNSUPPORTED_HEADER_TYPE, "%s nist header: unreadable field (length = %d)?", filename, nm));
+ }
+ name[nm] = 0;
+ if (strcmp(name, "sample_rate") == 0) srate = decode_nist_value(str, nm, k); else
+ if (strcmp(name, "channel_count") == 0) chans = decode_nist_value(str, nm, k); else
+ if (strcmp(name, "end_head") == 0) {happy = false; comment_end = curbase + n - 9;} else
+ if (strcmp(name, "sample_count") == 0) samples = decode_nist_value(str, nm, k); else
+ if ((bytes == 0) && (strcmp(name, "sample_n_bytes") == 0)) bytes = decode_nist_value(str, nm, k); else
+ if ((bytes == 0) && (strcmp(name, "sample_sig_bits") == 0)) {bytes = decode_nist_value(str, nm, k); bytes = (bytes >> 3);} else
+ if (strcmp(name, "sample_byte_format") == 0) byte_format = decode_nist_value(str, nm, k);
+ for (j = 0; j <= k; j++) str[j] =' ';
+ k = 0;
+ if ((curbase + n + 1) > 1024) happy = false;
+ }
+ else
+ k++;
+ n++;
+ if (n >= hend)
+ {
+ int read_bytes;
+ curbase += hend;
+ n = 0;
+ read_bytes = read(chan, hdrbuf, HDRBUFSIZ);
+ if (read_bytes < HDRBUFSIZ)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s NIST header truncated?", filename));
+ hend = HDRBUFSIZ;
+ }
+ }
+ data_size = samples * bytes;
+ if (byte_format == MUS_NIST_SHORTPACK)
+ {
+ data_format = MUS_UNKNOWN;
+ original_data_format = MUS_NIST_SHORTPACK;
+ }
+ else
+ {
+ switch (bytes)
+ {
+ case 1: data_format = MUS_MULAW; break;
+ case 2:
+ if (byte_format == 10)
+ data_format = MUS_BSHORT;
+ else data_format = MUS_LSHORT;
+ break;
+ case 3:
+ if (byte_format == 10)
+ data_format = MUS_B24INT;
+ else data_format = MUS_L24INT;
+ break;
+ case 4:
+ if (byte_format == 10)
+ data_format = MUS_BINT;
+ else data_format = MUS_LINT;
+ break;
+ default: data_format = MUS_BYTE; break;
+ }
+ }
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if ((data_size > true_file_length) && (original_data_format != MUS_NIST_SHORTPACK))
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+static int write_nist_header(int chan, int wsrate, int wchans, int siz, int format)
+{
+ char *header;
+ int datum;
+ datum = mus_bytes_per_sample(format);
+ header = (char *)CALLOC(1024, sizeof(char));
+ sprintf(header, "NIST_1A\n 1024\nchannel_count -i %d\nsample_rate -i %d\nsample_n_bytes -i %d\nsample_byte_format -s2 %s\nsample_sig_bits -i %d\nsample_count -i %d\nend_head\n",
+ wchans, wsrate, datum,
+ ((format == MUS_BSHORT) || (format == MUS_B24INT) || (format == MUS_BINT)) ? "10" : "01",
+ datum * 8, siz / datum);
+ CHK_WRITE(chan, (unsigned char *)header, 1024);
+ data_location = 1024;
+ FREE(header);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ BICSF ------------------------------------
+ * (actually, this is EBICSF and the old BICSF is called IRCAM below)
+ *
+ * 0-28: NeXT-compatible header, read by read_next_header above.
+ * 28: bicsf magic number (107364 or trouble)
+ * 32: srate as a 32-bit float
+ * 36: chans
+ * 40: data format indicator (2 = 16-bit linear, 4 = 32-bit float)
+ * 44: begin chunks, if any
+ *
+ * followed by AIFF-style chunked header info with chunks like:
+ *
+ * COMM size comment
+ * MAXA size {max amps (up to 4)} (frame offsets) time-tag unix msec counter
+ * CUE, PRNT, ENV etc
+ *
+ * except in Paul Lansky's "hybrid" headers, according to MixViews.
+ */
+
+static int read_bicsf_header(const char *filename, int chan)
+{
+ int chunksize, chunkname, offset, chunkloc;
+ bool happy;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)(hdrbuf + 28));
+ header_type = MUS_BICSF;
+ data_location = 1024;
+ if (data_size == 0) data_size = (true_file_length - data_location);
+ lseek(chan, 40, SEEK_SET);
+ CHK_READ(chan, hdrbuf, HDRBUFSIZ);
+ original_data_format = mus_char_to_bint((unsigned char *)hdrbuf);
+ switch (original_data_format)
+ {
+ case 2: data_format = MUS_BSHORT; break;
+ case 4: data_format = MUS_BFLOAT; break;
+ case 8: data_format = MUS_BDOUBLE; break;
+ default: break;
+ }
+
+ /* now check for a COMM chunk, setting the comment pointers */
+ chunkloc = 4; /* next header + magic number, srate, chans, packing, then chunks, I think */
+ offset = 40;
+ happy = true;
+ while (happy)
+ {
+ if (((offset + chunkloc) >= data_location) ||
+ ((offset + chunkloc) < 40))
+ happy = false;
+ else
+ {
+ offset += chunkloc;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 32) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s bicsf header: chunks confused at %d", filename, offset));
+ chunkname = mus_char_to_uninterpreted_int((unsigned char *)hdrbuf);
+ chunksize = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ if (match_four_chars((unsigned char *)hdrbuf, I_COMM))
+ {
+ comment_start = 8 + offset;
+ comment_end = comment_start + chunksize -1;
+ happy = false;
+ }
+ else
+ {
+ if ((chunkname == 0) || (chunksize <= 0))
+ happy = false;
+ }
+ chunkloc = (8 + chunksize);
+ }
+ }
+ return(MUS_NO_ERROR);
+ /* from here we fall back into read_next_header */
+}
+
+
+
+/* ------------------------------------ IRCAM ------------------------------------
+ * read/write CLM (old-style BICSF) -- added write option for Sun port 12-Dec-94
+ *
+ * 0: 0x1a364 or variations thereof -- byte order gives big/little_endian decision,
+ * ^ digit gives machine info, according to AFsp sources -- see IRCAM ints above
+ * 4: srate as a 32-bit float
+ * 8: chans
+ * 12: data format indicator (2 = 16-bit linear, 4 = 32-bit float)
+ * according to new Sox (version 11), these packing modes are now bytes/sample in low short, code in high
+ * so 1 = char, 0x10001 = alaw, 0x20001 = mulaw, 2 = short, 3 = 24bit?, 0x40004 = long, 4 = float (AFsp sez 4 can also be double)
+ * 16: comment start -- how to tell if it's a real comment?
+ * apparently these are separated as short code, short blocksize, then data
+ * codes: 0 = end, 1 = maxamp, 2 = comment, 3 = pvdata, 4 = audioencode and codemax??
+ * 1024: data start
+ *
+ * apparently the byte order depends on the machine.
+ * and yet... convert 1.4 makes a .sf file with little endian header, the VAX id, and big endian data?
+ * Csound also uses the VAX magic number with little-endian unscaled floats! Argh.
+ * even worse, Paul Lansky plops some version of this at the end of a NeXT header! Complete chaos...
+ */
+
+static int read_ircam_header(const char *filename, int chan)
+{
+ short bcode, bloc, bsize;
+ int offset;
+ bool little, happy;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)hdrbuf);
+ if ((mus_char_to_lint((unsigned char *)hdrbuf) == I_IRCAM_VAX) ||
+ (mus_char_to_lint((unsigned char *)hdrbuf) == I_IRCAM_MIPS))
+ little = true;
+ else little = false;
+ little_endian = little;
+ data_location = 1024;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - 1024);
+ original_data_format = big_or_little_endian_int((unsigned char *)(hdrbuf + 12), little);
+ data_format = MUS_UNKNOWN;
+ if (original_data_format == 2)
+ {
+ if (little)
+ data_format = MUS_LSHORT;
+ else data_format = MUS_BSHORT;
+ }
+ else if (original_data_format == 4)
+ {
+ if (little)
+ {
+ if (mus_char_to_lint((unsigned char *)hdrbuf) == I_IRCAM_VAX)
+ data_format = MUS_LFLOAT_UNSCALED; /* Csound and MixViews */
+ else data_format = MUS_LFLOAT;
+ }
+ else data_format = MUS_BFLOAT;
+ }
+ else if (original_data_format == 0x40004)
+ {
+ if (little) data_format = MUS_LINT;
+ else data_format = MUS_BINT;
+ }
+ else if (original_data_format == 0x10001) data_format = MUS_ALAW;
+ else if (original_data_format == 0x20001) data_format = MUS_MULAW;
+ else if (original_data_format == 1) data_format = MUS_BYTE;
+ else if (original_data_format == 3)
+ {
+ if (little) data_format = MUS_L24INT;
+ else data_format = MUS_B24INT;
+ }
+ else if (original_data_format == 8)
+ {
+ if (little) data_format = MUS_LDOUBLE;
+ else data_format = MUS_BDOUBLE;
+ }
+ srate = (int)big_or_little_endian_float((unsigned char *)(hdrbuf + 4), little);
+ chans = big_or_little_endian_int((unsigned char *)(hdrbuf + 8), little);
+ bloc = 16;
+ happy = true;
+ offset = 0;
+ while (happy)
+ {
+ offset += bloc;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 32) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s ircam header: chunks confused at %d", filename, offset));
+ bcode = big_or_little_endian_short((unsigned char *)hdrbuf, little);
+ bsize = big_or_little_endian_short((unsigned char *)(hdrbuf + 2), little);
+ if (bcode == 2)
+ {
+ happy = false;
+ comment_start = 4 + offset;
+ comment_end = comment_start + bsize - 1; /* was -5? */
+ }
+ bloc = bsize;
+ if ((bsize <= 0) || (bcode <= 0) || ((offset + bloc) > 1023)) happy = false;
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+static int sndlib_format_to_ircam(int format)
+{
+ switch (format)
+ {
+ case MUS_MULAW: return(0x20001); break;
+ case MUS_ALAW: return(0x10001); break;
+ case MUS_BSHORT: return(2); break;
+ case MUS_BINT: return(0x40004); break;
+ case MUS_BFLOAT: return(4); break;
+ default:
+ return(mus_error(MUS_UNSUPPORTED_DATA_FORMAT, "IRCAM header unsupported data format: %d (%s)", format, any_data_format_name(format)));
+ break;
+ }
+}
+
+static void write_ircam_comment(int fd, const char *comment, int len)
+{
+ if (len > 0)
+ {
+ mus_bshort_to_char((unsigned char *)hdrbuf, 2);
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 2), (short)len);
+ CHK_WRITE(fd, hdrbuf, 4);
+ CHK_WRITE(fd, (unsigned char *)comment, len);
+ }
+ else
+ {
+ mus_bint_to_char((unsigned char *)hdrbuf, 0);
+ CHK_WRITE(fd, hdrbuf, 4);
+ }
+ len = 1024 - (len + 20);
+ if (len > 0)
+ {
+ unsigned char *combuf;
+ combuf = (unsigned char *)CALLOC(len, sizeof(char));
+ CHK_WRITE(fd, combuf, len);
+ FREE(combuf);
+ }
+}
+
+static int write_ircam_header(int chan, int wsrate, int wchans, int format, const char *comment, int len)
+{
+ mus_bint_to_char((unsigned char *)hdrbuf, 0x2a364); /* SUN id */
+ mus_bfloat_to_char((unsigned char *)(hdrbuf + 4), (float)wsrate);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 8), wchans);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 12), sndlib_format_to_ircam(format));
+ CHK_WRITE(chan, hdrbuf, 16);
+ data_location = 1024;
+ write_ircam_comment(chan, comment, len);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ 8SVX -------------------------------------
+ * (also known as IFF)
+ *
+ * very similar to AIFF:
+ * "BODY" => [4] samples [n] data
+ * "VHDR" => srate (short)
+ * "CHAN" => chans
+ * "ANNO" and "NAME"
+ *
+ * big_endian throughout
+ */
+
+static int read_8svx_header(const char *filename, int chan, bool bytewise)
+{
+ int chunksize, offset, chunkloc;
+ bool happy;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)hdrbuf);
+ chunkloc = 12;
+ offset = 0;
+ if (bytewise) data_format = MUS_BYTE; else data_format = MUS_BSHORT;
+ srate = 0;
+ chans = 1;
+ happy = true;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ update_form_size = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ while (happy)
+ {
+ offset += chunkloc;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 32) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s 8svx header: chunks confused at %d", filename, offset));
+ chunksize = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ if ((chunksize == 0) && /* can be empty data chunk? */
+ (hdrbuf[0] == 0) && (hdrbuf[1] == 0) && (hdrbuf[2] == 0) && (hdrbuf[3] == 0))
+ break;
+ if (match_four_chars((unsigned char *)hdrbuf, I_CHAN))
+ {
+ chans = mus_char_to_bint((unsigned char *)(hdrbuf + 8));
+ chans = (chans & 0x01) +
+ ((chans & 0x02) >> 1) +
+ ((chans & 0x04) >> 2) +
+ ((chans & 0x08) >> 3);
+ /* what in heaven's name is this? Each bit corresponds to a channel? */
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_VHDR))
+ {
+ /* num_samples (int) at hdrbuf + 8 */
+ srate = mus_char_to_ubshort((unsigned char *)(hdrbuf + 20));
+ original_data_format = hdrbuf[23];
+ if (original_data_format != 0)
+ data_format = MUS_UNKNOWN;
+ }
+ else
+ {
+ if ((match_four_chars((unsigned char *)hdrbuf, I_ANNO)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_NAME)))
+ {
+ comment_start = offset + 8;
+ comment_end = comment_start + chunksize - 1;
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_BODY))
+ {
+ data_size = chunksize;
+ data_location = offset + 12;
+ happy = false;
+ }
+ }
+ }
+ }
+ chunkloc = (8 + chunksize);
+ if (chunksize & 1) chunkloc++; /* extra null appended to odd-length chunks */
+ }
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no BODY chunk?", filename));
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ VOC --------------------------------------
+ *
+ * 0: "Creative Voice File" followed by a couple ctrl-Z ('32) (swapped data)
+ * 20: header end (short) {8svx, 26 = data_offset, 0x10a = version, ((~version + 0x1234) & 0xffff) = 0x1129}
+ * [20]: first block:
+ * block code, 1 = data, 0 = end, 9 = data_16 (2 = continue, 3 = silence, 4 = marker, 5 = text, 6 = loop, 7 = loop-end, 8 = extended)
+ * block len as 24 bit int(?)
+ * if data, then rate code (byte), then data (assuming 8-bit unsigned, mono)
+ * if data_16, long srate, byte: data size (8 or 16), byte chans
+ * if text, ascii text (a comment)
+ * if extended (8) precedes 1 (data): 8 4 then time constant (short), byte: packing code (0), byte chans (0 = mono)
+ *
+ * apparently always little_endian
+ * updated extensively 29-Aug-95 from sox10 voc.c
+ */
+
+static int read_voc_header(const char *filename, int chan)
+{
+ off_t curbase;
+ int type, len, voc_extended, bits, code;
+ bool happy;
+ data_format = MUS_UBYTE;
+ chans = 1;
+ happy = true;
+ voc_extended = 0;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ curbase = mus_char_to_lshort((unsigned char *)(hdrbuf + 20));
+ if (true_file_length < curbase)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: block location " OFF_TD " > file length: " OFF_TD, filename, curbase, true_file_length));
+ lseek(chan, curbase, SEEK_SET);
+ CHK_READ(chan, hdrbuf, HDRBUFSIZ);
+ while (happy)
+ {
+ type = (int)(hdrbuf[0]);
+ len = (((int)hdrbuf[3]) << 16) + (((int)hdrbuf[2]) << 8) + (((int)hdrbuf[1]));
+ if (type == 1) /* voc_data */
+ {
+ data_size = len - 1; /* was -3 */
+ data_location = curbase + 6;
+ if (voc_extended == 0)
+ {
+ srate = (int)(1000000.0 / (256 - ((int)(hdrbuf[4] & 0xff))));
+ original_data_format = hdrbuf[5];
+ if (hdrbuf[5] == 0)
+ data_format = MUS_UBYTE;
+ else data_format = MUS_UNKNOWN;
+ }
+ happy = false;
+ }
+ else
+ {
+ if (type == 9) /* voc_data_16 */
+ {
+ data_size = len - 1; /* was -3 */
+ data_location = curbase + 6;
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ bits = ((int)hdrbuf[8]);
+ if (bits == 8)
+ {
+ code = mus_char_to_lshort((unsigned char *)(hdrbuf + 10));
+ if (code == 6)
+ data_format = MUS_ALAW;
+ else
+ if (code == 7)
+ data_format = MUS_MULAW;
+ else data_format = MUS_UBYTE;
+ }
+ else
+ if (bits == 16)
+ data_format = MUS_LSHORT;
+ else data_format = MUS_UNKNOWN;
+ chans = (int)hdrbuf[9];
+ if (chans == 0) chans = 1;
+ happy = false;
+ }
+ else
+ {
+ if (((len + curbase) < true_file_length) && (type != 0))
+ {
+ if (type == 5) /* voc_text */
+ {
+ comment_start = curbase + 4;
+ comment_end = comment_start + len - 1;
+ }
+ else
+ {
+ if (type == 8) /* voc_extended */
+ {
+ srate = (256000000 / (65536 - mus_char_to_lshort((unsigned char *)(hdrbuf + 4))));
+ if ((int)(hdrbuf[7]) == 0) chans = 1; else chans = 2;
+ if ((int)(hdrbuf[6]) != 0) data_format = MUS_UNKNOWN;
+ }
+ /* I'd add loop support here if I had any example sound files to test with */
+ }
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, curbase + len + 4, HDRBUFSIZ) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s voc header: ran off end of file", filename));
+ curbase += len;
+ }
+ else happy = false;
+ }
+ }
+ }
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no data(type 1 or 9) chunk?", filename));
+ if ((data_size > true_file_length) || (data_size < (off_t)(true_file_length / 10))) /* some VOC files seem to have completely bogus lengths */
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ TwinVQ ------------------------------------
+ *
+ * from Audio Tools Library (atl.zip) at http://jfaul.de/atl.
+ * a chunked header for proprietary (and apparently obsolete?) compressed data
+ *
+ * 0: "TWIN"
+ * 4: version id (string)
+ * 12: header size ["cardinal" -> bint]
+ * common chunk header (4 of ID, bint size)
+ * 24: channels (bint: 0=mono 1=stereo)
+ * bitrate (bint)
+ * 32: srate (bint khz 11, 22, 44 else *1000)
+ * security (bint 0)
+ * filesize (bint bytes)
+ * possible chunks: NAME COMT AUTH (c) FILE ALBM DATA
+ */
+
+/* Monkey files start with "MAC ", but this is yet another compression-oriented format, I think (APE?) */
+
+static int read_twinvq_header(const char *filename, int chan)
+{
+ data_format = MUS_UNKNOWN;
+ data_location = mus_char_to_bint((unsigned char *)(hdrbuf + 12)) + 16 + 8;
+ chans = 1 + mus_char_to_bint((unsigned char *)(hdrbuf + 24));
+ srate = mus_char_to_bint((unsigned char *)(hdrbuf + 32));
+ if (srate == 11) srate = 11025; else
+ if (srate == 22) srate = 22050; else
+ if (srate == 44) srate = 44100; else
+ srate *= 1000;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ return(MUS_NO_ERROR);
+}
+
+
+static int read_sdif_header(const char *filename, int chan)
+{
+ /* yeah, right! */
+ return(MUS_UNSUPPORTED);
+}
+
+static int read_nvf_header(const char *filename, int chan)
+{
+ /* info from nvftools by Tom Mander: */
+ /*
+ Numbers stored little-endian.
+
+ bytes 0-3: "NVF " magic number
+ bytes 4-7: 0x00000001 NVF version number?
+ bytes 8-11: 0x00000020 size of rest of header
+ bytes 12-15: "VFMT" VFMT chunk h
+ bytes 16-19: 0x00000001 VFMT version number?
+ bytes 20-23: 0x00000014 size of reset of VFMT header
+ bytes 24-27: 0x00007D00 32000 bit/s bitrate
+ bytes 28-29: 0x0001 channels
+ bytes 30-31: 0x0000 unknown
+ bytes 32-35: 0x00001F40 8000kHz sample rate
+ bytes 36-39: 0x00003E80 16000
+ bytes 40-41: 0x0002 width in bytes of uncompressed data?
+ bytes 42-43: 0x0010 width in bits of compressed data?
+
+ The rest of the data is G.721 data nibble packing big-endian, 4bits per
+ sample (nibble) single channel at 32kbit. When the Nomad records an NVF
+ file it does it in 92 sample (46 byte) frames or 0.0115sec.
+ */
+ if (mus_char_to_lint((unsigned char *)(hdrbuf + 4)) != 1) return(mus_error(MUS_HEADER_READ_FAILED, "%s: NVF[4] != 1", filename));
+ if (!(match_four_chars((unsigned char *)(hdrbuf + 12), I_VFMT))) return(mus_error(MUS_HEADER_READ_FAILED, "%s: no VFMT chunk", filename));
+ data_format = MUS_UNKNOWN; /* g721 --translate elsewhere */
+ chans = 1;
+ srate = 8000;
+ data_location = 44;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location) * 2; /* 4 bit samps? */
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ ADC ------------------------------------
+ * also known as OGI format
+ * TIMIT format is identical except it omits the data format field (header size claims to be bytes)
+ *
+ * from ad.h and other files, ogitools-v1.0.tar.gz
+ * we'll look for the big/little endian sequence (short) 8 1 1-or-2 given big/little decision
+ *
+ * 0: header size in shorts (8 = 16 bytes) (OGI says this is in bytes)
+ * 2: version (1)
+ * 4: chans
+ * 6: rate (srate = 4000000/rate)
+ * 8: samples (int) -- seems to be off by 2 -- are they counting ints here?
+ * 12: data format (0 = big-endian)
+ * 16: data start
+*/
+
+static int read_adc_header(const char *filename, int chan)
+{
+ bool little;
+ little = (mus_char_to_uninterpreted_int((unsigned char *)(hdrbuf + 12)) != 0); /* 0 = big endian */
+ data_location = 16;
+ if (little) data_format = MUS_LSHORT; else data_format = MUS_BSHORT;
+ chans = big_or_little_endian_short((unsigned char *)(hdrbuf + 4), little);
+ srate = 4000000 / big_or_little_endian_short((unsigned char *)(hdrbuf + 6), little);
+ data_size = 2 * big_or_little_endian_int((unsigned char *)(hdrbuf + 8), little);
+ comment_start = 0;
+ comment_end = 0;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ AVR --------------------------------------
+ *
+ * 0: "2BIT"
+ * 4: sample name (null padded ASCII)
+ * 12: chans (short) (0 = mono, -1 = stereo)
+ * 14: sample size (8 or 16 bit) (short) (value is 8, 12, or 16)
+ * 16: sample format (signed or unsigned) (short) (0 = unsigned, -1 = signed)
+ * 18: loop (on/off), 20: midi (-1 = no MIDI)
+ * 22: srate
+ * avr.txt has:
+ * 22: Replay speed 0 = 5.485 Khz, 1 = 8.084 Khz, 2 = 10.971 Khz, 3 = 16.168 Khz, 4 = 21.942 Khz, 5 = 32.336 Khz, 6 = 43.885 Khz, 7 = 47.261 Khz
+ * 23: sample rate in Hertz (as a 3 byte quantity??)
+ * 26: length in samples
+ * 30: loop beg, 34: loop end, 38: midi (keyboard split), 40: compression, 42: nada ("reserved"), 44: name
+ * 64: comment (limited to 64 bytes)
+ * 128: data start
+ *
+ * the Atari .avr files appear to be 8000 Hz, mono, 8-bit linear unsigned data with an unknown header of 128 words
+ * apparently there was a change in format sometime in the 90's.
+ *
+ * The actual avr files I've found on the net are either garbled, or
+ * something is wrong with this definition (taken from CMJ and www.wotsit.org's avr.txt).
+ * SGI dmconvert assumes big-endian here -- this is an Atari format, so it's probably safe to assume big-endian.
+ */
+
+static int read_avr_header(const char *filename, int chan)
+{
+ int dsize, dsigned, i;
+ chans = mus_char_to_bshort((unsigned char *)(hdrbuf + 12));
+ if (chans == 0) chans = 1; else if (chans == -1) chans = 2; else return(mus_error(MUS_HEADER_READ_FAILED, "%s chans: %d", filename, chans));
+ data_location = 128;
+ data_size = mus_char_to_bint((unsigned char *)(hdrbuf + 26));
+ srate = mus_char_to_ubshort((unsigned char *)(hdrbuf + 24));
+ dsize = mus_char_to_bshort((unsigned char *)(hdrbuf + 14));
+ dsigned = mus_char_to_bshort((unsigned char *)(hdrbuf + 16));
+ if (dsize == 16)
+ {
+ if (dsigned == 0)
+ data_format = MUS_UBSHORT;
+ else data_format = MUS_BSHORT;
+ }
+ else
+ {
+ if (dsize == 8)
+ {
+ if (dsigned == 0)
+ data_format = MUS_UBYTE;
+ else data_format = MUS_BYTE;
+ }
+ else return(mus_error(MUS_HEADER_READ_FAILED, "%s: unknown data format", filename));
+ }
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, 64, 64) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s avr header: ran off end of file", filename));
+ comment_start = 64;
+ i = 0;
+ while ((i < 64) && (hdrbuf[i] != 0)) i++;
+ comment_end = 64 + (i - 1);
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+
+/* ------------------------------------ SNDT -------------------------------------
+ *
+ * this taken from sndrtool.c (sox-10): (modified 6-Feb-98)
+ * 0: "SOUND" (or off by two throughout if not "0x1a"?)
+ * 5: 0x1a
+ * 6-7: 0
+ * 8-11: nsamps (at 12)
+ * 12-15: 0
+ * 16-19: nsamps
+ * 20-21: srate (little endian short) (at 22)
+ * 22-23: 0
+ * 24-25: 10
+ * 26-27: 4
+ * 28-> : <filename> "- File created by Sound Exchange"
+ * .->95: 0 ?
+ */
+
+/* similar is Sounder format:
+ * 0: 0
+ * 2: short srate (little endian)
+ * 4: 10
+ * 6: 4
+ * then data
+ * but this format can't be distinguished from a raw sound file
+ */
+
+static int read_sndt_header(const char *filename, int chan)
+{
+ if (hdrbuf[4] != 'D') return(mus_error(MUS_HEADER_READ_FAILED, "%s: SNDT[4] != 'D'", filename));
+ data_format = MUS_UBYTE;
+ chans = 1;
+ srate = mus_char_to_ulshort((unsigned char *)(hdrbuf + 20));
+ data_location = 126;
+ data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 8));
+ if (data_size < 0) data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 10));
+ if (srate <= 1) srate = mus_char_to_ulshort((unsigned char *)(hdrbuf + 22));
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Covox v8 -------------------------------------
+ *
+ * 0: 377 125 377 252 377 125 377 252 x x 0's to 16
+ * then 8-bit unsigned data
+ */
+
+static int read_covox_header(const char *filename, int chan)
+{
+ data_format = MUS_UBYTE;
+ chans = 1;
+ data_location = 16;
+ srate = 8000;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ SMP -------------------------------------
+ *
+ * 0: "SOUND SAMPLE DATA "
+ * 18: "2.1 "
+ * 22-81: comment
+ * 82-111: sample name
+ * header 112 bytes
+ * long samples (bytes = samples*2)
+ * then data start
+ * data
+ * always little endian
+ */
+
+static int read_smp_header(const char *filename, int chan)
+{
+ data_format = MUS_LSHORT;
+ chans = 1;
+ comment_start = 22;
+ comment_end = 81;
+ data_location = 116;
+ lseek(chan, 112, SEEK_SET);
+ if (read(chan, hdrbuf, 4) != 4) return(mus_error(MUS_HEADER_READ_FAILED, "%s: SMP header truncated?", filename));
+ data_size = (mus_char_to_lint((unsigned char *)hdrbuf));
+ data_format = MUS_LSHORT; /* just a guess */
+ srate = 8000; /* docs mention an srate floating around at the end of the file, but I can't find it in any example */
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if ((data_size * 2) > true_file_length)
+ {
+ data_size = (true_file_length - data_location) / 2;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ SPPACK -------------------------------------
+ *
+ * from AF docs:
+ * Bytes Type Contents
+ * 0 160 char Text strings (2 * 80)
+ * 160 80 char Command line
+ * 240 2 int Domain (1-time, 2-freq, 3-qfreq)
+ * 242 2 int Frame size
+ * 244 4 float Sampling frequency
+ * 252 2 int File identifier (i.e. #o100 #o303)
+ * 254 2 int Data type (0xfc0e = sampled data file)
+ * 256 2 int Resolution (in bits 8, 16)
+ * 258 2 int Companding flag
+ * 272 240 char Text strings (3 * 80)
+ * 512 ... -- Audio data
+ *
+ * at least one program is writing these headers using little endian data...
+ */
+
+static int read_sppack_header(const char *filename, int chan)
+{
+ int typ, bits;
+ data_location = 512;
+ chans = 1;
+ lseek(chan, 240, SEEK_SET);
+ if (read(chan, hdrbuf, 22) != 22) return(mus_error(MUS_HEADER_READ_FAILED, "%s SPPACK header truncated?", filename));
+ typ = mus_char_to_bshort((unsigned char *)hdrbuf);
+ data_format = MUS_UNKNOWN;
+ if (typ == 1)
+ {
+ if (((hdrbuf[254]) == 252) && ((hdrbuf[255]) == 14)) /* #xfc and #x0e */
+ {
+ float sr;
+ typ = mus_char_to_bshort((unsigned char *)(hdrbuf + 18));
+ bits = mus_char_to_bshort((unsigned char *)(hdrbuf + 16));
+ sr = mus_char_to_bfloat((unsigned char *)(hdrbuf + 4));
+ srate = (int)sr;
+ switch (typ)
+ {
+ case 1: if (bits == 16) data_format = MUS_BSHORT; else data_format = MUS_BYTE; break;
+ case 2: data_format = MUS_ALAW; break;
+ case 3: data_format = MUS_MULAW; break;
+ default: data_format = MUS_UNKNOWN; break;
+ }
+ data_size = SEEK_FILE_LENGTH(chan);
+ data_size = mus_bytes_to_samples(data_format, data_size - 512);
+ comment_start = 0;
+ comment_end = 0;
+ }
+ }
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ if (data_size > mus_bytes_to_samples(data_format, true_file_length))
+ data_size = mus_bytes_to_samples(data_format, true_file_length - data_location);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ ESPS (Entropic Signal Processing System) -------------------------------------
+ *
+ * specs at ftp.entropic.com (also known as "SD" format)
+ * from AFgetInfoES.c:
+ *
+ * Bytes Type Contents
+ * 8 -> 11 -- Header size (bytes)
+ * 12 -> 15 int Sampled data record size
+ * 16 -> 19 int File identifier: 0x00006a1a or 0x1a6a0000
+ * 40 -> 65 char File creation date
+ * 124 -> 127 int Number of samples
+ * 132 -> 135 int Number of doubles in a data record
+ * 136 -> 139 int Number of floats in a data record
+ * 140 -> 143 int Number of longs in a data record
+ * 144 -> 147 int Number of shorts in a data record
+ * 148 -> 151 int Number of chars in a data record
+ * 160 -> 167 char User name
+ * 333 -> H-1 -- "Generic" header items, including "record_freq" {followed by a "double8"=64-bit ?}
+ * H -> ... -- Audio data
+ */
+
+static int read_esps_header(const char *filename, int chan)
+{
+ char str[80];
+ bool happy = true;
+ off_t curbase, hend;
+ int k, j, n, chars, floats, shorts, doubles, bytes;
+ bool little;
+ little = (hdrbuf[18] == 0);
+ if (little)
+ data_location = mus_char_to_lint((unsigned char *)(hdrbuf + 8));
+ else data_location = mus_char_to_bint((unsigned char *)(hdrbuf + 8));
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = 8000;
+ chans = 1;
+ lseek(chan, 132, SEEK_SET);
+ CHK_READ(chan, hdrbuf, HDRBUFSIZ);
+ if (little)
+ {
+ doubles = mus_char_to_lint((unsigned char *)hdrbuf);
+ floats = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ shorts = mus_char_to_lint((unsigned char *)(hdrbuf + 12));
+ chars = mus_char_to_lint((unsigned char *)(hdrbuf + 16));
+ }
+ else
+ {
+ doubles = mus_char_to_bint((unsigned char *)hdrbuf);
+ floats = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ shorts = mus_char_to_bint((unsigned char *)(hdrbuf + 12));
+ chars = mus_char_to_bint((unsigned char *)(hdrbuf + 16));
+ }
+ if (shorts != 0)
+ {
+ data_format = ((little) ? MUS_LSHORT : MUS_BSHORT);
+ chans = shorts;
+ }
+ else
+ {
+ if (doubles != 0)
+ {
+ data_format = ((little) ? MUS_LDOUBLE_UNSCALED : MUS_BDOUBLE_UNSCALED);
+ chans = doubles;
+ }
+ else
+ {
+ if (floats != 0)
+ {
+ data_format = ((little) ? MUS_LFLOAT_UNSCALED : MUS_BFLOAT_UNSCALED);
+ chans = floats;
+ }
+ else
+ {
+ if (chars != 0)
+ {
+ data_format = MUS_BYTE; /* ?? */
+ chans = chars;
+ }
+ }
+ }
+ }
+ /* search for "record_freq" to get srate */
+ lseek(chan, 333, SEEK_SET);
+ CHK_READ(chan, hdrbuf, HDRBUFSIZ);
+ curbase = 333;
+ hend = curbase + HDRBUFSIZ;
+ k = 0;
+ n = 0;
+ for (j = 0; j < 80; j++) str[j] =' ';
+ while (happy)
+ {
+ str[k] = hdrbuf[n];
+ if ((str[k] == 'q') || (str[k] == 3) || ((curbase + n + 1) >= data_location) || (k == 78))
+ { /* 3 = C-C marks end of record (?) */
+ str[k + 1] = 0;
+ if (strcmp(str, "record_freq") == 0)
+ {
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, curbase + n, 32) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s esps header: ran off end of file", filename));
+ n = 0;
+ if (little)
+ srate = (int)mus_char_to_ldouble((unsigned char *)(hdrbuf + 8));
+ else srate = (int)mus_char_to_bdouble((unsigned char *)(hdrbuf + 8));
+ happy = false;
+ }
+ if ((curbase + n + 1) >= data_location) happy = false;
+ k = 0;
+ }
+ else
+ k++;
+ n++;
+ if (n >= hend)
+ {
+ curbase += hend;
+ n = 0;
+ bytes = read(chan, hdrbuf, HDRBUFSIZ);
+ if (bytes != HDRBUFSIZ) break;
+ hend = HDRBUFSIZ;
+ }
+ }
+ if (srate == 0) srate = 8000;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ INRS -------------------------------------
+ *
+ * from AFgetInfoIN.c:
+ *
+ * INRS-Telecommunications audio file:
+ * Bytes Type Contents
+ * 0 -> 3 float Sampling Frequency (VAX float format)
+ * 6 -> 25 char Creation time (e.g. Jun 12 16:52:50 1990)
+ * 26 -> 29 int Number of speech samples in the file (? -- old INRS files omit this)
+ * The data in an INRS-Telecommunications audio file is in 16-bit integer (little-endian)
+ * format. Header is always 512 bytes. Always mono.
+ *
+ */
+
+static int inrs_srates[NINRS] = {6500, 6667, 8000, 10000, 12000, 16000, 20000};
+
+static int read_inrs_header(const char *filename, int chan, int loc)
+{
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ comment_start = 6;
+ comment_end = 25;
+ data_format = MUS_LSHORT;
+ srate = loc;
+ chans = 1;
+ data_location = 512;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ data_size = mus_bytes_to_samples(data_format, true_file_length - data_location);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ MAUD -------------------------------------
+ *
+ * very similar to AIFF:
+ * "MHDR" => 4: chunksize (32)
+ * 8: samples
+ * 12: bits
+ * 14: ditto
+ * 16: clock freq
+ * 20: clock div (srate = freq/div)
+ * 22: chan info (0 = mono, 1 = stereo)
+ * 24: ditto(?!)
+ * 26: format (0 = unsigned 8 or signed 16 (see bits), 2 = alaw, 3 = mulaw)
+ * 28-40: unused
+ * "MDAT" => data
+ * "ANNO" => comment
+ */
+
+static int read_maud_header(const char *filename, int chan)
+{
+ int chunksize, offset, chunkloc;
+ bool happy;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)hdrbuf);
+ chunkloc = 12;
+ offset = 0;
+ data_format = MUS_BYTE;
+ srate = 0;
+ chans = 1;
+ happy = true;
+ update_form_size = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ while (happy)
+ {
+ offset += chunkloc;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 32) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s maud header: chunks confused at %d", filename, offset));
+ chunksize = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ if ((chunksize == 0) && /* can be empty data chunk? */
+ (hdrbuf[0] == 0) && (hdrbuf[1] == 0) && (hdrbuf[2] == 0) && (hdrbuf[3] == 0))
+ break;
+ if (match_four_chars((unsigned char *)hdrbuf, I_MHDR))
+ {
+ int num, den;
+ data_size = mus_char_to_bint((unsigned char *)(hdrbuf + 8));
+ num = mus_char_to_bint((unsigned char *)(hdrbuf + 16));
+ den = mus_char_to_bshort((unsigned char *)(hdrbuf + 20));
+ if (den == 0) den = 1;
+ srate = (int)(num / den);
+ num = mus_char_to_bshort((unsigned char *)(hdrbuf + 12));
+ den = mus_char_to_bshort((unsigned char *)(hdrbuf + 26));
+ if (num == 8)
+ {
+ switch (den)
+ {
+ case 0: data_format = MUS_UBYTE; break;
+ case 2: data_format = MUS_ALAW; break;
+ case 3: data_format = MUS_MULAW; break;
+ default: data_format = MUS_UNKNOWN; break;
+ }
+ }
+ else data_format = MUS_BSHORT;
+ num = mus_char_to_bshort((unsigned char *)(hdrbuf + 22));
+ if (num == 0) chans = 1; else chans = 2;
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_ANNO))
+ {
+ comment_start = offset + 8;
+ comment_end = comment_start + chunksize - 1;
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_MDAT))
+ {
+ data_location = offset + 12;
+ happy = false;
+ }
+ }
+ }
+ chunkloc = (8 + chunksize);
+ if (chunksize & 1) chunkloc++; /* extra null appended to odd-length chunks */
+ }
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no MDAT chunk?", filename));
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ CSL -------------------------------------
+ *
+ * "Computerized Speech Labs -- this info taken from wavesurfer/snack
+ *
+ * very similar to AIFF:
+ * 0: FORM
+ * 4: DS16 (kinda weird)
+ * 8: size (int le)
+ * 12: chunks
+ * HEDR or HDR8
+ * 4: size (int)
+ * samp: short, chans: 1 at 36 if not (int) -1, chans: 2?
+ * srate at 28 (le int?)
+ * other chunks: SD_B, SDA_ SDAB with data bytes as data followed by data
+ */
+
+static int read_csl_header(const char *filename, int chan)
+{
+ int chunksize, offset, chunkloc;
+ bool happy;
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)hdrbuf);
+ chunkloc = 12;
+ offset = 0;
+ data_format = MUS_LSHORT;
+ srate = 0;
+ chans = 1;
+ happy = true;
+ update_form_size = mus_char_to_lint((unsigned char *)(hdrbuf + 8));
+ while (happy)
+ {
+ offset += chunkloc;
+ if (seek_and_read(chan, (unsigned char *)hdrbuf, offset, 64) <= 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s csl header: chunks confused at %d", filename, offset));
+ chunksize = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ if ((chunksize == 0) && /* can be empty data chunk? */
+ (hdrbuf[0] == 0) && (hdrbuf[1] == 0) && (hdrbuf[2] == 0) && (hdrbuf[3] == 0))
+ break;
+ if ((match_four_chars((unsigned char *)hdrbuf, I_HEDR)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_HDR8)))
+ {
+ /* 8..20: date as ascii */
+ /* 32: data length (int) in bytes */
+ if ((mus_char_to_lshort((unsigned char *)(hdrbuf + 36)) != -1) && /* these are maxamps, -1=none */
+ (mus_char_to_lshort((unsigned char *)(hdrbuf + 38)) != -1))
+ chans = 2;
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 28));
+ }
+ else
+ {
+ if (match_four_chars((unsigned char *)hdrbuf, I_NOTE))
+ {
+ comment_start = offset + 8;
+ comment_end = comment_start + chunksize - 1;
+ }
+ else
+ {
+ if ((match_four_chars((unsigned char *)hdrbuf, I_SDA_)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SDAB)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SD_B)))
+ {
+ data_location = offset + 8;
+ data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 4));
+ happy = false;
+ }
+ }
+ }
+ chunkloc = (8 + chunksize);
+ if (chunksize & 1) chunkloc++;
+ }
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no SDxx chunk?", filename));
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ snack SMP -------------------------------------
+ *
+ * there's apparently yet another "smp" format (from nist??)
+ * file = samp
+ * sftot = 22050
+ * msb = last
+ * nchans = 1
+ * preemph = none
+ * born = snack
+ * msb = last here -> little endian?
+ * data at 1024
+ */
+
+static int read_file_samp_header(const char *filename, int chan)
+{
+ int i = 0;
+ char *locbuf;
+ data_location = 1024;
+ chans = 1;
+ srate = 8000;
+ data_format = MUS_LSHORT;
+ lseek(chan, 10, SEEK_SET);
+ locbuf = (char *)CALLOC(1024, sizeof(char));
+ CHK_READ(chan, locbuf, 1024);
+ while (i < 1024)
+ {
+ if (strncmp((char *)(locbuf + i), "sftot", 5) == 0)
+ sscanf((const char *)(&locbuf[i + 6]), "%d", &srate);
+ if (strncmp((char *)(locbuf + i), "nchans", 6) == 0)
+ sscanf((const char *)(&locbuf[i + 7]), "%d", &chans);
+ if (strncmp((char *)(locbuf + i), "msb", 3) == 0)
+ if (strncmp((char *)(locbuf + i + 4), "first", 5) == 0)
+ data_format = MUS_BSHORT;
+ while ((i < 1024) && (locbuf[i] != 10) && (locbuf[i] != 0)) i++;
+ i++;
+ }
+ FREE(locbuf);
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ data_size = mus_bytes_to_samples(data_format, true_file_length - data_location);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Sound Designer I -------------------------------------
+ *
+ * complicated and defined in terms of Pascal records, so the following is a stab in the dark:
+ *
+ * 0: 1336 (i.e. header size)
+ * 764: comment (str255)
+ * 1020: sample rate (long)
+ * 1028: data size (short)
+ * 1030: a code string describing the data type (i.e. "linear") (str32)
+ * 1064: user comment (str255)
+ *
+ * file type: 'SFIL'
+ *
+ * always big_endian
+ */
+
+static int read_sd1_header(const char *filename, int chan)
+{
+ int n;
+ chans = 1;
+ data_location = 1336;
+ lseek(chan, 1020, SEEK_SET);
+ if (read(chan, hdrbuf, 64) != 64) return(mus_error(MUS_HEADER_READ_FAILED, "%s Sound Designer I header truncated?", filename));
+ srate = mus_char_to_bint((unsigned char *)hdrbuf);
+ n = mus_char_to_bshort((unsigned char *)(hdrbuf + 8));
+ if (n == 16)
+ data_format = MUS_BSHORT;
+ else data_format = MUS_BYTE;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ data_size = mus_bytes_to_samples(data_format, true_file_length - data_location);
+ n = ((unsigned char)hdrbuf[44]);
+ if (n != 0)
+ {
+ comment_start = 1064;
+ comment_end = comment_start + n - 1;
+ }
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ PSION alaw -------------------------------------
+ *
+ * 0: "ALawSoundFile**"
+ * 16: version
+ * 18: length (bytes)
+ * 22: padding
+ * 24: repeats
+ * 26-32: nada
+ * 32: data
+ *
+ * always mono 8-bit alaw 8000 Hz. All the examples on the psion net site appear to be little endian.
+ */
+
+static int read_psion_header(const char *filename, int chan)
+{
+ if ((hdrbuf[13] != '*') || (hdrbuf[14] != '*')) return(mus_error(MUS_HEADER_READ_FAILED, "%s: PSION[13, 14] != '*'", filename));
+ chans = 1;
+ data_location = 32;
+ srate = 8000;
+ data_format = MUS_ALAW;
+ data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 18)); /* always little-endian? */
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ Gravis Ultrasound Patch -------------------------------------
+ *
+ * http://www.gravis.com/Public/sdk/PATCHKIT.ZIP
+ *
+ * header [128], instruments [62], layers [49], waveheaders (nested)
+ * always little endian, actual files don't match exactly with any documentation
+ *
+ * Header block:
+ * 0: "GF1PATCH100" or "GF1PATCH110"
+ * 12: "ID#000002"
+ * 22: comment (copyright notice) (60 bytes ASCIZ)
+ * 82: number of instruments
+ * 83: number of voices
+ * 84: wave channels
+ * 85: number of waves
+ * 87: vol
+ * 89: size?
+ * 93: reserved (36? bytes)
+ *
+ * Instrument block:
+ * 0: id
+ * 2: name (16 bytes)
+ * 18: size
+ * 22: number of layers
+ * 23: reserved (40? bytes)
+ *
+ * Layer block:
+ * 0: "previous"
+ * 1: id
+ * 2: size
+ * 6: number of wave samples
+ * 10: reserved (40? bytes)
+ *
+ * Wave block:
+ * 0: name (7 bytes ASCIZ)
+ * 7: "fractions"
+ * 8: data size of wave sample
+ * 12: loop start
+ * 16: loop end
+ * 20: sample rate
+ * 22: low freq
+ * 26: high freq
+ * 30: root freq
+ * 34: tune
+ * 36: balance
+ * 37: envelope data (6+6 bytes I think)
+ * 49: tremolo and vibrato data (6 bytes)
+ * 55: mode bit 0: 8/16, 1: signed/unsigned
+ * 56: scale freq
+ * 58: scale factor
+ * 60: reserved (36 bytes)
+ * followed by data presumably
+ */
+
+static int read_gravis_header(const char *filename, int chan)
+{
+ int mode;
+ lseek(chan, 0, SEEK_SET);
+ if (read(chan, hdrbuf, 128) != 128) return(mus_error(MUS_HEADER_READ_FAILED, "%s PAT header truncated?", filename));
+ chans = hdrbuf[84];
+ if (chans == 0) chans = 1;
+ comment_start = 22;
+ comment_end = 81;
+ lseek(chan, 239, SEEK_SET); /* try to jump to wave sample block (128+62+49) */
+ CHK_READ(chan, hdrbuf, 128);
+ srate = mus_char_to_ulshort((unsigned char *)(hdrbuf + 20));
+ data_size = mus_char_to_ulshort((unsigned char *)(hdrbuf + 8));
+ mode = hdrbuf[55];
+ if (mode & 1)
+ {
+ if (mode & 2)
+ data_format = MUS_ULSHORT;
+ else data_format = MUS_LSHORT;
+ }
+ else
+ {
+ if (mode & 2)
+ data_format = MUS_UBYTE;
+ else data_format = MUS_BYTE;
+ }
+ data_location = 337;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ Goldwave -------------------------------------
+ *
+ * http://web.cs.mun.ca/~chris3/goldwave/goldwave.html
+ */
+
+static int read_goldwave_header(const char *filename, int chan)
+{
+ chans = 1;
+ data_location = 28;
+ data_format = MUS_LSHORT;
+ data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 22));
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ if ((data_size <= 24) || (data_size > true_file_length))
+ data_size = (true_file_length - data_location) / 2;
+ else data_size /= 2;
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 18));
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Sonic Resource Foundry -------------------------------------
+ *
+ * more reverse engineering...
+ * http://www.sfoundry.com/
+ */
+
+static int read_srfs_header(const char *filename, int chan)
+{
+ chans = 1; /* might be short at header[4] */
+ data_location = 32;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ data_size = (true_file_length - data_location) / 2;
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 6));
+ data_format = MUS_LSHORT;
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Quicktime -------------------------------------
+ *
+ * infinitely complicated -- see Quicktime File Format doc from Apple.
+ * there's no relation between this document and actual files -- a bizarre joke?
+ */
+
+static int read_qt_header(const char *filename, int chan)
+{
+ chans = 1;
+ data_location = 12;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = 11025; /* ?? */
+ data_format = MUS_UBYTE;
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ SBStudioII -------------------------------------
+ *
+ * from a file created by Convert 1.4
+ * 0: SND <space>
+ * 8: file size - 8
+ * SNNA SNIN SNDT blocks:
+ *
+ * built in blocks, other names are SNIN, SNDT
+ * need to scan for SNDT, block length, data
+ * SNNA len name
+ * supposedly ends with END (but my examples don't)
+ * SNIN:
+ * num (2), reserved (2), tuning (1), vol (2), type (2) bit 0: 1 = PCM, bit 1: 1 = 16, 0 = 8 (then loop data)
+ * info from Pac.txt (pac.zip) at http://www.wotsit.org/music.htm
+ */
+
+static int read_sbstudio_header(const char *filename, int chan)
+{
+ int i, tmp;
+ bool happy;
+ unsigned char *bp;
+ lseek(chan, 0, SEEK_SET);
+ CHK_READ(chan, hdrbuf, HDRBUFSIZ);
+ chans = 1;
+ srate = 8000; /* no sampling rate field in this header */
+ data_format = MUS_UNKNOWN;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ happy = true;
+ i = 8;
+ bp = (unsigned char *)(hdrbuf + 8);
+ while (happy)
+ {
+ if (match_four_chars(bp, I_SNDT))
+ {
+ data_size = mus_char_to_lint((unsigned char *)(bp + 4));
+ data_location = i + 8;
+ happy = false;
+ }
+ else
+ {
+ if (match_four_chars(bp, I_SNIN))
+ {
+ tmp = mus_char_to_lshort((unsigned char *)(bp + 15));
+ if ((tmp & 1) == 0)
+ data_format = MUS_UNKNOWN;
+ else
+ {
+ if ((tmp & 2) == 0)
+ data_format = MUS_BYTE;
+ else data_format = MUS_LSHORT;
+ }
+ i += 26;
+ bp += 26;
+ }
+ else
+ {
+ if (match_four_chars(bp, I_SNNA))
+ {
+ tmp = mus_char_to_lint((unsigned char *)(bp + 4));
+ i += tmp;
+ bp += tmp;
+ }
+ else
+ {
+ i++;
+ bp++;
+ }
+ }
+ }
+ if (i >= HDRBUFSIZ)
+ {
+ data_format = MUS_UNKNOWN;
+ happy = false;
+ }
+ }
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no SNDT chunk?", filename));
+ if ((data_size == 0) || (data_format == MUS_UNKNOWN))
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data size or format bogus", filename));
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Delusion Sound -------------------------------------
+ *
+ * more reverse engineering...
+ * from a file created by Convert 1.4
+ * 0: DDSF
+ * 5: name (text)
+ * 55: data
+ * probaby similar to DMF format described in Dmf-form.txt but I don't see any other block names in the data
+ */
+
+static int read_delusion_header(const char *filename, int chan)
+{
+ if ((hdrbuf[4] != 1) || (hdrbuf[5] > 128) || (hdrbuf[6] > 128) || (hdrbuf[7] > 128))
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s DDSF name bogus", filename));
+ chans = 1;
+ data_location = 55;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = 8000;
+ data_format = MUS_LSHORT;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ Farandole Composer WaveSample -------------------------------------
+ *
+ * 0: FSM 254
+ * libmodplug load_far.cpp uses: #define FARFILEMAGIC 0xFE524146 ("FAR="?)
+ * 4: name (text) (32 bytes)
+ * 36: 10, 13, 26 or something like that
+ * 39: len?
+ * 40: volume
+ * 41: looping data
+ * 49: type (0 = 8-bit, else 16)
+ * 50: loop mode
+ * 51: data
+ * described in Fsm.txt and Far-form.txt http://www.wotsit.org/music.htm
+ */
+
+static int read_farandole_header(const char *filename, int chan)
+{
+ chans = 1;
+ data_location = 51;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = 8000;
+ if (hdrbuf[49] == 0)
+ data_format = MUS_BYTE;
+ else data_format = MUS_LSHORT;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ Yamaha TX-16W -------------------------------------
+ *
+ * ftp://ftp.t0.or.at/pub/sound/tx16w/samples.yamaha
+ * ftp://ftp.t0.or.at/pub/sound/tx16w/faq/tx16w.tec
+ * http://www.t0.or.at/~mpakesch/tx16w/
+ *
+ * from tx16w.c sox 12.15: (7-Oct-98) (Mark Lakata and Leigh Smith)
+ * char filetype[6] "LM8953"
+ * nulls[10],
+ * dummy_aeg[6]
+ * format 0x49 = looped, 0xC9 = non-looped
+ * sample_rate 1 = 33 kHz, 2 = 50 kHz, 3 = 16 kHz
+ * atc_length[3] if sample rate 0, [2]&0xfe = 6: 33kHz, 0x10:50, 0xf6: 16, depending on [5] but to heck with it
+ * rpt_length[3] (these are for looped samples, attack and loop lengths)
+ * unused[2]
+ */
+
+static int read_tx16w_header(const char *filename, int chan)
+{
+ if ((hdrbuf[4] != '5') || (hdrbuf[5] != '3')) return(mus_error(MUS_HEADER_READ_FAILED, "%s TX16 magic number bogus", filename));
+ chans = 1;
+ data_location = 32;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = 16000;
+ if (hdrbuf[23] == 1) srate = 33000;
+ else if (hdrbuf[23] == 2) srate = 50000;
+ else if (hdrbuf[23] == 3) srate = 16000;
+ else if (hdrbuf[23] == 0)
+ {
+ if ((hdrbuf[26] & 0xFE) == 6) srate = 33000;
+ else if ((hdrbuf[26] & 0xFE) == 0x10) srate = 50000;
+ else if ((hdrbuf[26] & 0xFE) == 0xf6) srate = 16000;
+ }
+ original_data_format = MUS_UNKNOWN;
+ data_format = MUS_UNKNOWN;
+ data_size = (off_t)((double)data_size / 1.5);
+ if (hdrbuf[22] == 0x49)
+ {
+ loop_modes[0] = 1;
+ loop_starts[0] = ((hdrbuf[26] & 1) << 16) + (hdrbuf[25] << 8) + hdrbuf[24];
+ loop_ends[0] = loop_starts[0] + ((hdrbuf[29] & 1) << 16) + (hdrbuf[28] << 8) + hdrbuf[27];
+ }
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Yamaha SY-85 and SY-99 -------------------------------------
+ *
+ * more reverse engineering...
+ * 0: SY85 (SY80 is SY-99) SY85ALL SY80 SYALL
+ * 5: name ("WAVE1")
+ * (26 int len)
+ * (33: comment or prompt?)
+ * data in 16-bit little endian (?)
+ */
+
+static int read_sy85_header(const char *filename, int chan)
+{
+ if ((hdrbuf[4] != ' ') && (hdrbuf[4] != 'A')) return(mus_error(MUS_HEADER_READ_FAILED, "%s: unknown magic number", filename));
+ chans = 1;
+ data_location = 1024;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = 8000; /* unknown */
+ data_format = MUS_BSHORT; /* not right */
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Kurzweil 2000 -------------------------------------
+ *
+ * "PRAM" then header len as big endian int??
+ * from krz2tx.c (Mark Lakata)
+ */
+static int read_kurzweil_2000_header(const char *filename, int chan)
+{
+ chans = 1;
+ data_location = mus_char_to_bint((unsigned char *)(hdrbuf + 4));
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = 44100; /* unknown */
+ data_format = MUS_BSHORT;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Korg -------------------------------------
+ *
+ * "SMP1" -- guessing on the rest
+ */
+static int read_korg_header(const char *filename, int chan)
+{
+ chans = 1;
+ data_location = 70;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = mus_char_to_bint((unsigned char *)(hdrbuf + 48));
+ data_format = MUS_BSHORT;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Maui -------------------------------------
+ *
+ * "Maui" -- guessing on the rest
+ */
+static int read_maui_header(const char *filename, int chan)
+{
+ lseek(chan, 420, SEEK_SET);
+ if (read(chan, hdrbuf, 64) != 64) return(mus_error(MUS_HEADER_READ_FAILED, "%s truncated maui header?", filename));
+ chans = 1;
+ data_location = 776;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 8));
+ if ((data_size * 2) > true_file_length)
+ data_size = (true_file_length - data_location) / 2;
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf));
+ data_format = MUS_LSHORT;
+ return(MUS_NO_ERROR);
+}
+
+/* ------------------------------------ Impulse Tracker -------------------------------------
+ *
+ * data from its2raw.c by Ben Collver
+ * 0: IMPS
+ * 4: filename (12 bytes)
+ * 17: global vol
+ * 18: flags (1: 16-bit or 8(0), 2: stereo or mono(0)
+ * 19: default vol
+ * 20: sample name (26 bytes)
+ * 46: convert
+ * 47: default pan
+ * 48: length (samps)
+ * 52: loop start
+ * 56: loop end
+ * 60: srate
+ * 64: sustain loop start
+ * 68: sustain loop end
+ * 72: data location
+ * 76: vib speed
+ * 77: vib depth
+ * 78: vib wave
+ * 79: vib rate
+ */
+static int read_impulsetracker_header(const char *filename, int chan)
+{
+ if (hdrbuf[18] & 4) chans = 2; else chans = 1;
+ if (hdrbuf[18] & 2) data_format = MUS_LSHORT; else data_format = MUS_BYTE;
+ data_location = mus_char_to_lint((unsigned char *)(hdrbuf + 72));
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ data_size = (true_file_length - data_location);
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 60));
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+#if 0
+/* ------------------------------------ AKAI 3? -------------------------------------
+ */
+static int read_akai3_header(const char *filename, int chan)
+{
+ chans = 1;
+ data_location = 192;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ if (hdrbuf[1] == 0) srate = 22050; else srate = 44100;
+ data_format = MUS_LSHORT;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+#endif
+
+
+/* ------------------------------------ AKAI 4 -------------------------------------
+ *
+ * 1, 4, info from Paul Kellet -- lost the url ("MPC-2000")
+ */
+static int read_akai4_header(const char *filename, int chan)
+{
+ chans = hdrbuf[21] + 1;
+ data_location = 42;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = mus_char_to_ulshort((unsigned char *)(hdrbuf + 40));
+ data_format = MUS_LSHORT;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ PVF (portable voice format) -------------------------------------
+ *
+ * info from mgetty-voice-1.1.22/voice/libpvf/lib.c
+ * this is a modem-related interchange format
+ *
+ * PVF1\n
+ * 1 11025 32\n
+ * then data
+ * PVF1 = binary data, PVF2 = ascii
+ * chans | srate | sample size
+ */
+
+static int read_pvf_header(const char *filename, int chan)
+{
+ char *buf;
+ int bits, i;
+ if (hdrbuf[4] != '\n') return(mus_error(MUS_HEADER_READ_FAILED, "PVF header messed up"));
+ type_specifier = mus_char_to_uninterpreted_int((unsigned char *)hdrbuf);
+ buf = (char *)(hdrbuf + 5);
+ sscanf(buf, "%d %d %d", &chans, &srate, &bits);
+ if (chans < 1) chans = 1;
+ if (srate < 0) srate = 8000;
+ if (bits < 8) bits = 8;
+ for (i = 6; i < INITIAL_READ_SIZE; i++)
+ if (hdrbuf[i] == '\n')
+ {
+ data_location = i + 1;
+ break;
+ }
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s PVF header bad data location", filename));
+ if (match_four_chars((unsigned char *)hdrbuf, I_PVF2))
+ {
+ data_format = MUS_UNKNOWN; /* ascii text */
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s PVF header unknown data format", filename));
+ }
+ /* big endian data -- they're using htonl etc */
+ if (bits == 8)
+ data_format = MUS_BYTE;
+ else
+ if (bits == 16)
+ data_format = MUS_BSHORT;
+ else data_format = MUS_BINT;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = mus_bytes_to_samples(data_format, true_file_length - data_location);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Ultratracker WaveSample -------------------------------------
+ *
+ * 0..31: name (32 = ctrl-Z?)
+ * 33: PMUWFD (but docs say this is "dos name" -- perhaps we can't recognize this header type reliably)
+ * 44: 4 ints giving loop and size data
+ * 60: vol
+ * 61: "bidi" 0|8|24->8 bit else 16 -- but actual example has 0 with 16-bit
+ * 62: finetune
+ * 64: data (or 68?)
+ * described in Ult-form.txt http://www.wotsit.org/music.htm
+ */
+
+static int read_ultratracker_header(const char *filename, int chan)
+{
+ chans = 1;
+ data_location = 64;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ data_size = (true_file_length - data_location);
+ srate = 8000;
+ data_format = MUS_LSHORT;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ Sample dump exchange -------------------------------------
+ *
+ * 0: SDX:
+ * sdx2tx.c (Mark Lakata) reads from 4 for 26 (^z), then
+ * version (1)
+ * comment as pascal-style string (byte len, bytes chars)
+ * then 23 bytes:
+ * 0: packing (0 = pcm)
+ * 1: midi channel
+ * 2 + 256*[3]: sample number
+ * 4: sample format (15: 16 bit unsigned(?), 8: 8bit unsigned(?)
+ * 5: sample rate (big int?)
+ * 9: sample length
+ * 13: loop start
+ * 17: loop end
+ * 21: loop type
+ * 22: reserved
+ */
+
+static int read_sample_dump_header(const char *filename, int chan)
+{
+ int i, len;
+ for (i = 4; i < HDRBUFSIZ; i++) if (hdrbuf[i] == 26) break;
+ len = hdrbuf[i + 2];
+ if (len > 0)
+ {
+ comment_start = i + 3;
+ comment_end = i + 3 + len;
+ }
+ seek_and_read(chan, (unsigned char *)hdrbuf, i + 3 + len, HDRBUFSIZ);
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + 5));
+ loop_modes[0] = 0;
+ if (hdrbuf[21] == 0)
+ {
+ loop_modes[0] = 1;
+ loop_starts[0] = mus_char_to_lint((unsigned char *)(hdrbuf + 13));
+ loop_ends[0] = mus_char_to_lint((unsigned char *)(hdrbuf + 17));
+ }
+ /* data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 9)); */
+ if ((srate < 100) || (srate > 100000)) srate = 8000;
+ chans = 1;
+ data_location = i + 3 + len + 23;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ if (hdrbuf[0] == 0)
+ data_format = MUS_ULSHORT;
+ else data_format = MUS_UNKNOWN;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Digiplayer ST3 -------------------------------------
+ *
+ * 0: 1 (use 'SCRS' at 76)
+ * 1: name
+ * 13: nada
+ * 14: "paragraph" offset of sample data
+ * 16: length in bytes (looks like #samples in the actual files...)
+ * 20: loop start
+ * 24: loop end
+ * 28: vol
+ * 29: ?
+ * 30: 0 = unpacked, 1 = DP30ADPCM
+ * 31: bits: 0 = loop, 1 = stereo (chans not interleaved!), 2 = 16-bit samples (little endian)
+ * 32: freq
+ * 36: nada
+ * 40: nada
+ * 42: 512
+ * 44: date?
+ * 48: sample name (28 char ASCIZ)
+ * 76: 'SCRS'
+ * 80: data starts
+ *
+ * info from http://www.wotsit.org/ S3m-form.txt
+ */
+
+static int read_digiplayer_header(const char *filename, int chan)
+{
+ chans = 1;
+ data_location = 80;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ data_size = (true_file_length - data_location);
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ srate = 8000;
+ data_format = MUS_ULSHORT;
+ if (hdrbuf[30] & 2) chans = 2;
+ if (hdrbuf[30] & 1)
+ data_format = MUS_UNKNOWN;
+ else
+ {
+ if (hdrbuf[30] & 4) data_format = MUS_UBYTE; /* may be backwards -- using Convert 1.4 output here */
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ CSRE adf -------------------------------------
+ *
+ * Info from Stuart Rosen
+ *
+ * 0-7: CSRE40
+ * 8: samples in file (long)
+ * 12: center line(?) (long)
+ * 16: start channel(?) (unsigned)
+ * 18: bits -- 12 or 16 (unsigned) -- is 12 bit sample file packed?
+ * 20: number system (0 = signed, 1 = unsigned)
+ * 22: srate in kHz (float)
+ * 26: peak sample in file (long) (can be 0)
+ * 30-511: comment possibly
+ *
+ * probably always little-endian (S.R. reads each sample using sizeof(int) -> 16 bits I think)
+ * if 12-bit unsigned we need to handle the offset somewhere
+ */
+
+static int read_adf_header(const char *filename, int chan)
+{
+ int bits, numsys;
+ lseek(chan, 0, SEEK_SET);
+ if ((hdrbuf[4] != '4') || (hdrbuf[5] != '0')) return(mus_error(MUS_HEADER_READ_FAILED, "%s csre header bad magic number", filename));
+ if (read(chan, hdrbuf, 30) != 30) return(mus_error(MUS_HEADER_READ_FAILED, "%s csre header truncated?", filename));
+ chans = 1;
+ numsys = mus_char_to_ulshort((unsigned char *)(hdrbuf + 20));
+ bits = mus_char_to_ulshort((unsigned char *)(hdrbuf + 18));
+ if ((bits == 16) || (bits == 12))
+ {
+ if (numsys == 0)
+ data_format = MUS_LSHORT;
+ else data_format = MUS_ULSHORT;
+ }
+ else data_format = MUS_UNKNOWN;
+ srate = (int)(1000 * mus_char_to_lfloat((unsigned char *)(hdrbuf + 22)));
+ data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 8));
+ data_location = 512;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ if (data_size > mus_bytes_to_samples(data_format, true_file_length - data_location))
+ data_size = mus_bytes_to_samples(data_format, true_file_length - data_location);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ Diamondware -------------------------------------
+ *
+ * info from Keith Weiner at DiamondWare (www.dw.com):
+ *
+ * 0-22: DWD Header Byte "DiamondWare Digitized\n\0"
+ * 23: 1A (EOF to abort printing of file)
+ * 24: Major version number
+ * 25: Minor version number
+ * 26-29: Unique sound ID (checksum XOR timestamp)
+ * 30: Reserved
+ * 31: Compression type (0 = none)
+ * 32-33: Sampling rate (in Hz)
+ * 34: Number of channels (1 = mono, 2 = stereo) (interleaved)
+ * 35: Number of bits per sample (8, 16) (all data signed)
+ * 36-37: Absolute value of largest sample in file
+ * 38-41: length of data section (in bytes)
+ * 42-45: # samples (16-bit stereo is 4 bytes/sample)
+ * 46-49: Offset of data from start of file (in bytes)
+ * 50-53: Reserved for future expansion (markers)
+ * 54-55: Padding
+ * 56:offset -- additional text: field = value
+ * suggested fields: TITLE, ORGARTIST, GENRE, KEYWORDS, ORGMEDIUM, EDITOR, DIGITIZER, COMMENT, SUBJECT, COPYRIGHT, SOFTWARE, CREATEDATE
+ *
+ * since this is all Windows/DOS oriented, I'll assume little-endian byte order.
+ */
+
+static int read_diamondware_header(const char *filename, int chan)
+{
+ lseek(chan, 0, SEEK_SET);
+ if (read(chan, hdrbuf, 64) != 64) return(mus_error(MUS_HEADER_READ_FAILED, "%s truncated diamondware header?", filename));
+ chans = hdrbuf[34];
+ if (hdrbuf[31] == 0)
+ {
+ if (hdrbuf[35] == 8) data_format = MUS_BYTE;
+ else data_format = MUS_LSHORT;
+ }
+ else
+ {
+ data_format = MUS_UNKNOWN;
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s unknown data format", filename));
+ }
+ srate = mus_char_to_ulshort((unsigned char *)(hdrbuf + 32));
+ data_size = mus_char_to_lint((unsigned char *)(hdrbuf + 38));
+ data_location = mus_char_to_lint((unsigned char *)(hdrbuf + 46));
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ if (data_size > true_file_length - data_location)
+ data_size = true_file_length - data_location;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+/* ------------------------------------ Ensoniq Paris -------------------------------------
+ * _paf -> Ensoniq Paris? (this info from libaudiofile)
+ * 0 paf (or fap)
+ * 4 version (0)
+ * 8 endianess (0 = big)
+ * 12 rate (unsigned int)
+ * 16 format (0: 16-bit linear, 24-bit linear)
+ * 20 channels
+ * 24 source (an encoded comment)
+ * 2048 data (24 bit files are compressed)
+ */
+
+static int read_paf_header(const char *filename, int chan)
+{
+ int form;
+ bool little = false;
+ lseek(chan, 0, SEEK_SET);
+ if (read(chan, hdrbuf, 32) != 32) return(mus_error(MUS_HEADER_READ_FAILED, "%s PAF header truncated?", filename));
+ data_format = MUS_UNKNOWN;
+ if (mus_char_to_bint((unsigned char *)(hdrbuf + 8))) little = true;
+ if (little)
+ {
+ srate = mus_char_to_ulint((unsigned char *)(hdrbuf + 12));
+ form = mus_char_to_ulint((unsigned char *)(hdrbuf + 16));
+ if (form == 0) data_format = MUS_LSHORT;
+ if (form == 2) data_format = MUS_BYTE;
+ chans = mus_char_to_ulint((unsigned char *)(hdrbuf + 20));
+ }
+ else
+ {
+ srate = mus_char_to_ubint((unsigned char *)(hdrbuf + 12));
+ form = mus_char_to_ubint((unsigned char *)(hdrbuf + 16));
+ if (form == 0) data_format = MUS_BSHORT;
+ if (form == 2) data_format = MUS_BYTE;
+ chans = mus_char_to_ubint((unsigned char *)(hdrbuf + 20));
+ }
+ data_location = 2048;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (true_file_length < data_location)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_location " OFF_TD " > file length: " OFF_TD, filename, data_location, true_file_length));
+ if (data_format != MUS_UNKNOWN)
+ data_size = mus_bytes_to_samples(data_format, true_file_length - 2048);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ Comdisco SPW -------------------------------------
+ * info from AFsp libtsp/AF/nucleus/AFgetSWpar.c
+ *
+ * header is text as in NIST:
+ *
+ * $SIGNAL_FILE 9\n (12 chars)
+ * $USER_COMMENT
+ * <comment line(s)>
+ * $COMMON_INFO
+ * SPW Version = 3.10
+ * System Type = <machine> (e.g. "sun4", "hp700")
+ * Sampling Frequency = <Sfreq> (e.g. "8000")
+ * Starting Time = 0
+ * $DATA_INFO
+ * Number of points = <Nsamp> (e.g. "2000")
+ * Signal Type = <type> ("Double", "Float", "Fixed-point", "Integer", "Logical")
+ * Fixed Point Format = <16, 0, t> <16, 16, t> <8, 8, t> <8, 0, t> (optional)
+ * Complex Format = Real_Imag (optional)
+ * $DATA <data_type> ("ASCII", "BINARY")
+ *
+ * the fixed point <n, m, b> is decoded as n = number of bits total per sample, m = integer bits, b = t: signed, u: unsigned
+ * if $DATA ASCII, data is ascii text as in IEEE text files.
+ * There are other complications as well. We'll just hack up a stop-gap until someone complains.
+ */
+
+static int read_comdisco_header(const char *filename, int chan)
+{
+ /* need to grab a line at a time, call strcmp over and over. This is very tedious. */
+ char *line = NULL;
+ int i, j, k, m, n, curend, offset, len, type, d_size = 0;
+ bool happy = true, little, commenting;
+ k = 15;
+ line = (char *)CALLOC(256, sizeof(char));
+ little = false;
+ offset = 0;
+ type = 0;
+ srate = 0;
+ curend = INITIAL_READ_SIZE;
+ commenting = false;
+ while (happy)
+ {
+ for (i = 0; i < 256; i++)
+ {
+ if (k == curend)
+ {
+ offset += curend;
+ if (read(chan, hdrbuf, HDRBUFSIZ) != HDRBUFSIZ)
+ {
+ FREE(line);
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s comdisco header truncated?", filename));
+ }
+ k = 0;
+ curend = HDRBUFSIZ;
+ }
+ if (hdrbuf[k] == '\n')
+ {
+ k++;
+ break;
+ }
+ line[i] = hdrbuf[k++];
+ }
+ line[i] = '\0';
+ if ((strcmp(line, "$DATA BINARY") == 0) ||
+ (strcmp(line, "$DATA ASCII") == 0))
+ {
+ happy = false;
+ data_location = offset + k;
+ }
+ if (strcmp(line, "$USER_COMMENT") == 0)
+ {
+ comment_start = offset + k;
+ commenting = true;
+ }
+ else
+ {
+ if (commenting)
+ {
+ if (line[0] == '$')
+ {
+ comment_end = offset + k - 2 - strlen(line);
+ commenting = false;
+ }
+ }
+ }
+ if (line[0] != '$')
+ {
+ char portion[32];
+ char value[32];
+ len = strlen(line);
+ for (j = 0; j < 8; j++)
+ portion[j] = line[j];
+ portion[8] ='\0';
+ for (j = 8; j < len; j++)
+ if (line[j] == '=')
+ break;
+ for (n = 0, m = j + 2; m < len; m++, n++)
+ value[n] = line[m];
+ value[n] ='\0';
+ if (strcmp(portion, "Sampling") == 0) sscanf(value, "%d", &srate); else
+ if (strcmp(portion, "Number o") == 0) sscanf(value, "%d", &d_size); else
+ if (strcmp(portion, "Signal T") == 0) {if (value[1] == 'o') type = 2; else if (value[1] == 'l') type = 1;} else
+ if (strcmp(portion, "Fixed Po") == 0) {if (value[1] == '8') type = 3;}
+ }
+ }
+ /* now clean up this mess */
+ if (data_location == 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: no $DATA BINARY field?", filename));
+ if (srate == 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: srate == 0", filename));
+ chans = 1;
+ if (d_size != 0) data_size = (off_t)d_size;
+ switch (type)
+ {
+ case 0: if (little) data_format = MUS_LSHORT; else data_format = MUS_BSHORT; break;
+ case 1: if (little) data_format = MUS_LFLOAT; else data_format = MUS_BFLOAT; break;
+ case 2: if (little) data_format = MUS_LDOUBLE; else data_format = MUS_BDOUBLE; break;
+ case 3: data_format = MUS_BYTE; break;
+ }
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > mus_bytes_to_samples(data_format, true_file_length - data_location))
+ data_size = mus_bytes_to_samples(data_format, true_file_length - data_location);
+ FREE(line);
+ return(MUS_NO_ERROR);
+}
+
+
+/* ------------------------------------ MS ASF -------------------------------------
+ *
+ * asf format is described at http://www.microsoft.com/asf/specs.htm
+ * http://www.microsoft.com/asf/spec3/ASF0198ps.exe
+ *
+ * this header is completely insane
+ */
+
+static int read_asf_header(const char *filename, int chan)
+{
+ /* a chunked data format, so not really acceptable here or elsewhere -- needs to be unchunked */
+ int len, ilen = 0, i, j, bits = 0;
+ bool asf_huge = false, present;
+ /* apparently "huge" has some meaning in Windoze C */
+ len = mus_char_to_lint((unsigned char *)(hdrbuf + 16)); /* actually 64 bits */
+ i = (128+64) / 8;
+ srate = 0;
+ chans = 0;
+ while (i < len)
+ {
+ seek_and_read(chan, (unsigned char *)hdrbuf, i, HDRBUFSIZ);
+ if ((unsigned int)(hdrbuf[1]) == 0x29)
+ switch (hdrbuf[0])
+ {
+ case 0xd0:
+ asf_huge = (hdrbuf[((128+64+128+64+64+64+64+32)/8)] & 2);
+ break;
+ case 0xd4:
+ present = ((hdrbuf[16+8+16+8+8+ 4+4+4+4+ 4+4] >> 3) & 0x3);
+ if (present)
+ j = 16+8+16+8+8+ 4+4+4+4+ 4+4+ 4+ (4+4+4) + 2;
+ else j = 16+8+16+8+8+ 4+4+4+4+ 4+4+ 4+ 2;
+ srate = mus_char_to_lint((unsigned char *)(hdrbuf + j+11+36));
+ bits = mus_char_to_lint((unsigned char *)(hdrbuf + j+11+32));
+ chans = mus_char_to_ulshort((unsigned char *)(hdrbuf + j+65));
+ original_data_format = mus_char_to_lint((unsigned char *)(hdrbuf + j+11));
+ break;
+ default: break;
+ }
+ ilen = mus_char_to_lint((unsigned char *)(hdrbuf + 16));
+ if (ilen <= 0) break;
+ if ((chans > 0) && (srate > 0)) break;
+ i += ilen;
+ }
+ i = len;
+ seek_and_read(chan, (unsigned char *)hdrbuf, i, HDRBUFSIZ);
+ data_format = MUS_UNKNOWN;
+ if (((unsigned int)(hdrbuf[1]) == 0x29) && ((unsigned int)(hdrbuf[0]) == 0xd2))
+ {
+ int a_huge = 2;
+ ilen = mus_char_to_lint((unsigned char *)(hdrbuf + 16));
+ if (asf_huge) a_huge = 4;
+ data_location = i + 20 + a_huge + 2+4+3+1;
+ if (bits == 0) bits = 8;
+ data_format = wave_to_sndlib_format(original_data_format, bits, true);
+ }
+ else return(mus_error(MUS_HEADER_READ_FAILED, "%s: unknown data format", filename));
+ data_size = ilen - data_location;
+ true_file_length = SEEK_FILE_LENGTH(chan);
+ if (data_size > true_file_length)
+ {
+ data_size = true_file_length - data_location;
+ if (data_size < 0) return(mus_error(MUS_HEADER_READ_FAILED, "%s: data_size = " OFF_TD "?", filename, data_size));
+ }
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ------------------------------------ no header ------------------------------------- */
+
+static int header_raw_srate = 44100;
+static int header_raw_chans = 2;
+static int header_raw_format = MUS_BSHORT;
+
+static int read_no_header(const char *filename, int chan)
+{
+ srate = header_raw_srate;
+ chans = header_raw_chans;
+ data_format = header_raw_format;
+ data_location = 0;
+ data_size = SEEK_FILE_LENGTH(chan);
+ true_file_length = data_size;
+ data_size = mus_bytes_to_samples(data_format, data_size);
+ return(MUS_NO_ERROR);
+}
+
+void mus_header_set_raw_defaults(int sr, int chn, int frm)
+{
+ if (sr > 0) header_raw_srate = sr;
+ if (chn > 0) header_raw_chans = chn;
+ if (MUS_DATA_FORMAT_OK(frm)) header_raw_format = frm;
+}
+
+void mus_header_raw_defaults(int *sr, int *chn, int *frm)
+{
+ (*sr) = header_raw_srate;
+ (*chn) = header_raw_chans;
+ (*frm) = header_raw_format;
+}
+
+
+/* ------------------------------------ all together now ------------------------------------ */
+
+static int mus_header_read_1(const char *filename, int chan)
+{
+ /* returns 0 on success (at least to the extent that we can report the header type), -1 for error */
+ int i, loc = 0, bytes;
+ bool happy;
+ header_type = MUS_UNSUPPORTED;
+ data_format = MUS_UNKNOWN;
+ comment_start = 0;
+ comment_end = 0;
+ data_size = 0;
+ data_location = 0;
+ if (loop_modes)
+ {
+ loop_modes[0] = 0;
+ loop_modes[1] = 0;
+ }
+ bytes = read(chan, hdrbuf, INITIAL_READ_SIZE);
+ /* if it's a 0 length file we need to get out */
+ if (bytes < 0)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: %s", filename, (errno) ? STRERROR(errno) : "bytes read < 0?"));
+ if (bytes == 0)
+ {
+ header_type = MUS_RAW;
+ srate = header_raw_srate;
+ chans = header_raw_chans;
+ data_format = header_raw_format;
+ data_location = 0;
+ true_file_length = 0;
+ return(MUS_NO_ERROR);
+ }
+ if (bytes < 4)
+ {
+ header_type = MUS_RAW;
+ return(read_no_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_DSND)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_DECN)))
+ {
+ if (bytes < 24)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s NeXT header truncated? found only %d bytes", filename, bytes));
+ header_type = MUS_NEXT;
+ return(read_next_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_FORM))
+ {
+ /* next 4 bytes are apparently the file size or something equally useless */
+ if (bytes < 12)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s AIFF header truncated? found only %d bytes", filename, bytes));
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_AIFF))
+ {
+ header_type = MUS_AIFF;
+ return(read_aiff_header(filename, chan, 0));
+ }
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_AIFC))
+ {
+ header_type = MUS_AIFC;
+ return(read_aiff_header(filename, chan, 0));
+ }
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_8SVX))
+ {
+ header_type = MUS_SVX;
+ return(read_8svx_header(filename, chan, true));
+ }
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_16SV))
+ {
+ header_type = MUS_SVX;
+ return(read_8svx_header(filename, chan, false));
+ }
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_MAUD))
+ {
+ header_type = MUS_MAUD;
+ return(read_maud_header(filename, chan));
+ }
+ /* apparently SAMP here -> sampled audio data (?) */
+
+ if (match_four_chars((unsigned char *)(hdrbuf + 4), I_DS16))
+ {
+ header_type = MUS_CSL;
+ return(read_csl_header(filename, chan));
+ }
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: unrecognized \"FORM\" (i.e. AIFF) header", filename));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_RIFF)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_RIFX)))
+ {
+ if (bytes < 12)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s RIFF header truncated? found only %d bytes", filename, bytes));
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_WAVE))
+ {
+ header_type = MUS_RIFF;
+ return(read_riff_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_sfbk))
+ {
+ header_type = MUS_SOUNDFONT;
+ return(read_soundfont_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)(hdrbuf + 8), I_AVI_))
+ {
+ header_type = MUS_AVI;
+ return(read_avi_header(filename, chan));
+ }
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s: unrecognized \"RIFF\" (i.e. 'wave') header", filename));
+ }
+ if ((equal_big_or_little_endian((unsigned char *)hdrbuf, I_IRCAM_VAX)) ||
+ (equal_big_or_little_endian((unsigned char *)hdrbuf, I_IRCAM_SUN)) ||
+ (equal_big_or_little_endian((unsigned char *)hdrbuf, I_IRCAM_MIPS)) ||
+ (equal_big_or_little_endian((unsigned char *)hdrbuf, I_IRCAM_NEXT)))
+ {
+ if (bytes < 24)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s IRCAM header truncated? found only %d bytes", filename, bytes));
+ header_type = MUS_IRCAM;
+ return(read_ircam_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_NIST))
+ {
+ header_type = MUS_NIST;
+ return(read_nist_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_SOUN))
+ {
+ if ((match_four_chars((unsigned char *)(hdrbuf + 4), I_D_SA)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 8), I_MPLE)))
+ {
+ header_type = MUS_SMP;
+ return(read_smp_header(filename, chan));
+ }
+ else
+ {
+ header_type = MUS_SNDT;
+ return(read_sndt_header(filename, chan));
+ }
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_VOC0)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I_VOC1)))
+ {
+ if (bytes < 24)
+ return(mus_error(MUS_HEADER_READ_FAILED, "%s VOC header truncated? found only %d bytes", filename, bytes));
+ header_type = MUS_VOC;
+ return(read_voc_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_AVR_))
+ {
+ header_type = MUS_AVR;
+ return(read_avr_header(filename, chan));
+ }
+ if (mus_char_to_bshort((unsigned char *)hdrbuf) == 1336)
+ {
+ header_type = MUS_SD1;
+ return(read_sd1_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_ALaw)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I_Soun)))
+ {
+ header_type = MUS_PSION;
+ return(read_psion_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_GF1P)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I_ATCH)))
+ {
+ header_type = MUS_GRAVIS;
+ return(read_gravis_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_DSIG)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I_NAL_)))
+ {
+ header_type = MUS_COMDISCO;
+ return(read_comdisco_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_GOLD)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I__WAV)))
+ {
+ header_type = MUS_GOLDWAVE;
+ return(read_goldwave_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_Diam)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I_ondW)))
+ {
+ header_type = MUS_DIAMONDWARE;
+ return(read_diamondware_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_SRFS))
+ {
+ header_type = MUS_SRFS;
+ return(read_srfs_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_CSRE))
+ {
+ header_type = MUS_ADF;
+ return(read_adf_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_fLaC))
+ {
+ header_type = MUS_FLAC;
+ return(MUS_NO_ERROR);
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_OggS))
+ {
+ if ((hdrbuf[29] == 'v') && (hdrbuf[30] == 'o') && (hdrbuf[31] == 'r'))
+ header_type = MUS_OGG;
+ else
+ {
+ if ((hdrbuf[28] == 'S') && (hdrbuf[29] == 'p') && (hdrbuf[30] == 'e'))
+ header_type = MUS_SPEEX;
+ }
+ return(MUS_NO_ERROR);
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_file)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I__sam)))
+ {
+ header_type = MUS_FILE_SAMP;
+ return(read_file_samp_header(filename, chan));
+ }
+ if ((hdrbuf[0] == 0xf0) && (hdrbuf[1] == 0x7e) && (hdrbuf[3] == 0x01))
+ {
+ header_type = MUS_MIDI_SAMPLE_DUMP;
+ chans = 1;
+ srate = (int)(1.0e9 / (float)((hdrbuf[7] + (hdrbuf[8] << 7) + (hdrbuf[9] << 14))));
+ data_size = (hdrbuf[10] + (hdrbuf[11] << 7) + (hdrbuf[12] << 14));
+ /* since this file type has embedded blocks, we have to translate it elsewhere */
+ return(MUS_NO_ERROR);
+ }
+ /* no recognized magic number at start -- poke around in possible header for other types */
+ /* ESPS is either 0x00006a1a or 0x1a6a0000 at byte 16 */
+ if (equal_big_or_little_endian((unsigned char *)(hdrbuf + 16), 0x00006a1a))
+ {
+ header_type = MUS_ESPS;
+ return(read_esps_header(filename, chan));
+ }
+ lseek(chan, 0, SEEK_SET);
+ CHK_READ(chan, hdrbuf, 256);
+ if ((hdrbuf[252] == 64) && (hdrbuf[253] == 195)) /* #o100 and #o303 */
+ {
+ header_type = MUS_SPPACK;
+ return(read_sppack_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)(hdrbuf + 65), I_FSSD)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 128), I_HCOM)))
+ {
+ header_type = MUS_HCOM;
+ return(MUS_NO_ERROR);
+ }
+ happy = false;
+ for (i = 0; i < NINRS; i++)
+ {
+ if (equal_big_or_little_endian((unsigned char *)hdrbuf, I_INRS[i]))
+ {
+ happy = true;
+ loc = inrs_srates[i];
+ }
+ }
+ if (happy)
+ {
+ header_type = MUS_INRS;
+ return(read_inrs_header(filename, chan, loc));
+ }
+ if (mus_char_to_ubint((unsigned char *)hdrbuf) == 0xAAAAAAAA)
+ {
+ header_type = MUS_MUS10;
+ return(MUS_NO_ERROR);
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_SPIB)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_S___)))
+ {
+ header_type = MUS_IEEE;
+ return(MUS_NO_ERROR);
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_riff))
+ {
+ header_type = MUS_SOUNDFORGE;
+ return(read_soundforge_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I_PVF1)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_PVF2)))
+ {
+ header_type = MUS_PVF;
+ return(read_pvf_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_MThd))
+ {
+ header_type = MUS_MIDI;
+ return(MUS_ERROR);
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_SND_))
+ {
+ header_type = MUS_SBSTUDIOII;
+ return(read_sbstudio_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_FSMt))
+ {
+ header_type = MUS_FARANDOLE;
+ return(read_farandole_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_SDXc))
+ {
+ header_type = MUS_SAMPLE_DUMP;
+ return(read_sample_dump_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_DDSF))
+ {
+ header_type = MUS_DELUSION;
+ return(read_delusion_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_LM89))
+ {
+ header_type = MUS_YAMAHA_TX16W;
+ return(read_tx16w_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_SY85))
+ {
+ header_type = MUS_YAMAHA_SY85;
+ return(read_sy85_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_SY80))
+ {
+ header_type = MUS_YAMAHA_SY99;
+ return(read_sy85_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_PRAM))
+ {
+ header_type = MUS_KURZWEIL_2000;
+ return(read_kurzweil_2000_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_SMP1))
+ {
+ header_type = MUS_KORG;
+ return(read_korg_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_Maui))
+ {
+ header_type = MUS_MAUI;
+ return(read_maui_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_IMPS))
+ {
+ header_type = MUS_IMPULSETRACKER;
+ return(read_impulsetracker_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)(hdrbuf + 35), I_UWFD))
+ {
+ header_type = MUS_ULTRATRACKER;
+ return(read_ultratracker_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)(hdrbuf + 76), I_SCRS))
+ {
+ header_type = MUS_DIGIPLAYER;
+ return(read_digiplayer_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_covox))
+ {
+ header_type = MUS_COVOX;
+ return(read_covox_header(filename, chan));
+ }
+ if ((match_four_chars((unsigned char *)hdrbuf, I__PAF)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_FAP_)))
+ {
+ header_type = MUS_PAF;
+ return(read_paf_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_TWIN))
+ {
+ header_type = MUS_TWINVQ;
+ return(read_twinvq_header(filename, chan));
+ }
+#if MUS_LITTLE_ENDIAN
+ if (mus_char_to_uninterpreted_int((unsigned char *)hdrbuf) == 0x01000800)
+#else
+ if (mus_char_to_uninterpreted_int((unsigned char *)hdrbuf) == 0x00080001)
+#endif
+ {
+ header_type = MUS_ADC;
+ return(read_adc_header(filename, chan));
+ }
+
+ if ((match_four_chars((unsigned char *)hdrbuf, I_ones)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 12), I_FORM)))
+ {
+ /* possibly an OMF file with an embedded AIFF data file -- this is just a guess... */
+ header_type = MUS_OMF;
+ return(read_aiff_header(filename, chan, 12));
+ /* another (apparently) along these lines is TOC */
+ }
+
+ if ((match_four_chars((unsigned char *)hdrbuf, I_zeros)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I_mdat)))
+ {
+ /* possibly quicktime?? */
+ header_type = MUS_QUICKTIME;
+ return(read_qt_header(filename, chan));
+ }
+ if ((hdrbuf[0] == 1) && (hdrbuf[1] == 4)) /* name follows --check? */
+ {
+ header_type = MUS_AKAI4;
+ return(read_akai4_header(filename, chan));
+ }
+#if 0
+ if ((hdrbuf[0] == 3) && (hdrbuf[16] == 128))
+ {
+ header_type = MUS_AKAI4;
+ return(read_akai3_header(filename, chan));
+ }
+#endif
+ if ((match_four_chars((unsigned char *)hdrbuf, I_asf0)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 4), I_asf1)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 8), I_asf2)) &&
+ (match_four_chars((unsigned char *)(hdrbuf + 12), I_asf3)))
+ {
+ header_type = MUS_ASF;
+ return(read_asf_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_SDIF))
+ {
+ header_type = MUS_SDIF;
+ return(read_sdif_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_NVF_))
+ {
+ header_type = MUS_NVF;
+ return(read_nvf_header(filename, chan));
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_ajkg))
+ {
+ header_type = MUS_SHORTEN;
+ return(MUS_NO_ERROR);
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_TTA1))
+ {
+ header_type = MUS_TTA;
+ return(MUS_NO_ERROR);
+ }
+ if (match_four_chars((unsigned char *)hdrbuf, I_wvpk))
+ {
+ header_type = MUS_WAVPACK;
+ return(MUS_NO_ERROR);
+ }
+
+ header_type = MUS_RAW;
+ return(read_no_header(filename, chan));
+}
+
+static int local_error_type = MUS_NO_ERROR;
+static char *local_error_msg = NULL;
+static mus_error_handler_t *old_error_handler;
+
+static void local_mus_error(int type, char *msg)
+{
+ local_error_type = type;
+ if (local_error_msg)
+ free(local_error_msg);
+ if (msg)
+ local_error_msg = strdup(msg);
+ else local_error_msg = NULL;
+}
+
+int mus_header_read(const char *name)
+{
+ int chan, err = 0;
+ chan = mus_file_open_read(name);
+ if (chan == -1)
+ return(mus_error(MUS_CANT_OPEN_FILE, "can't open %s: %s", name, STRERROR(errno)));
+ old_error_handler = mus_error_set_handler(local_mus_error);
+ err = mus_header_read_1(name, chan);
+ mus_error_set_handler(old_error_handler);
+ CLOSE(chan, name);
+ if (err != MUS_NO_ERROR)
+ return(mus_error(local_error_type, local_error_msg)); /* pass error info on up the chain now that we've cleaned up the open file descriptor */
+ return(err);
+}
+
+static mus_header_write_hook_t *mus_header_write_hook = NULL;
+
+mus_header_write_hook_t *mus_header_write_set_hook(mus_header_write_hook_t *new_hook)
+{
+ mus_header_write_hook_t *old_hook;
+ old_hook = mus_header_write_hook;
+ mus_header_write_hook = new_hook;
+ return(old_hook);
+}
+
+int mus_header_write(const char *name, int type, int in_srate, int in_chans, off_t loc, off_t size_in_samples, int format, const char *comment, int len)
+{
+ /* the "loc" arg is a mistake -- just always set it to 0 */
+ int chan, err = MUS_NO_ERROR;
+ off_t siz;
+ chan = mus_file_create(name);
+ if (chan == -1)
+ return(mus_error(MUS_CANT_OPEN_FILE, "can't write %s: %s", name, STRERROR(errno)));
+ if (mus_header_write_hook)
+ (*mus_header_write_hook)(name);
+ siz = mus_samples_to_bytes(format, size_in_samples);
+ /* no mus_error calls within any of the write functions */
+ switch (type)
+ {
+ case MUS_NEXT: err = mus_header_write_next_header(chan, in_srate, in_chans, loc, siz, format, comment, len); break;
+ case MUS_AIFC: err = write_aif_header(chan, in_srate, in_chans, siz, format, comment, len, true); break;
+ case MUS_AIFF: err = write_aif_header(chan, in_srate, in_chans, siz, format, comment, len, false); break;
+ case MUS_RIFF: err = write_riff_header(chan, in_srate, in_chans, siz, format, comment, len); break;
+ case MUS_IRCAM: err = write_ircam_header(chan, in_srate, in_chans, format, comment, len); break;
+ case MUS_NIST: err = write_nist_header(chan, in_srate, in_chans, siz, format); break;
+ case MUS_RAW:
+ data_location = 0;
+ data_size = mus_bytes_to_samples(format, siz);
+ srate = in_srate;
+ chans = in_chans;
+ header_type = MUS_RAW;
+ data_format = format;
+ break;
+ default:
+ CLOSE(chan, name);
+ return(mus_error(MUS_UNSUPPORTED_HEADER_TYPE, "can't write %s header for %s", mus_header_type_name(type), name));
+ break;
+ }
+ CLOSE(chan, name);
+ return(err);
+}
+
+int mus_header_change_data_size(const char *filename, int type, off_t size) /* in bytes */
+{
+ /* the read header at sample update (sound-close) time could be avoided if the
+ * ssnd_location (etc) were saved and passed in -- perhaps an added optimized
+ * header change data size? Means saving the relevant data, and exporting it
+ * from headers.c. Can we guarantee consistency here?
+ */
+ int chan, err = MUS_NO_ERROR;
+ switch (type)
+ {
+ case MUS_AIFF:
+ case MUS_AIFC:
+ case MUS_NIST:
+ case MUS_RIFF:
+ err = mus_header_read(filename);
+ break;
+ default:
+ break;
+ }
+ if (err == MUS_ERROR) return(err);
+ chan = mus_file_reopen_write(filename);
+ if (chan == -1) return(mus_error(MUS_HEADER_WRITE_FAILED, "%s: %s", filename, STRERROR(errno)));
+ switch (type)
+ {
+ case MUS_NEXT:
+ lseek(chan, 8L, SEEK_SET);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 0), (int)size);
+ CHK_WRITE(chan, hdrbuf, 4);
+ break;
+ case MUS_AIFC:
+ case MUS_AIFF:
+ /* we apparently have to make sure the form size and the data size are correct
+ * assumed here that we'll only be updating our own AIFF files
+ * There are 3 such locations -- the 2nd word of the file which is the overall form size,
+ * the frames variable in the COMM chunk, and the chunk-size variable in the SSND chunk
+ * an unexpected hassle for CLM is that we can open/close the output file many times if running mix,
+ * so we have to update the various size fields taking into account the old size
+ */
+
+ /* read sets current update_form_size, data_size, data_format, update_frames_location, update_ssnd_location */
+
+ lseek(chan, 4L, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, (int)size + update_form_size - mus_samples_to_bytes(data_format, data_size));
+ /* cancel old data_size from previous possible write */
+ CHK_WRITE(chan, hdrbuf, 4);
+ lseek(chan, update_frames_location, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, (int)size / (chans * mus_bytes_per_sample(data_format)));
+ CHK_WRITE(chan, hdrbuf, 4);
+ lseek(chan, update_ssnd_location, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, (int)size + 8);
+ CHK_WRITE(chan, hdrbuf, 4);
+ break;
+ case MUS_RIFF:
+
+ /* read sets current update_form_size, data_format, data_size, update_ssnd_location */
+
+ lseek(chan, 4L, SEEK_SET);
+ mus_lint_to_char((unsigned char *)hdrbuf, (int)size + update_form_size - mus_samples_to_bytes(data_format, data_size));
+ CHK_WRITE(chan, hdrbuf, 4);
+ lseek(chan, update_ssnd_location, SEEK_SET);
+ mus_lint_to_char((unsigned char *)hdrbuf, (int)size);
+ CHK_WRITE(chan, hdrbuf, 4);
+ break;
+ case MUS_IRCAM:
+ case MUS_RAW:
+ /* size is implicit in file size */
+ break;
+ case MUS_NIST:
+
+ /* read sets current srate, chans, data_format */
+
+ lseek(chan, 0L, SEEK_SET);
+ write_nist_header(chan, mus_header_srate(), mus_header_chans(), size, mus_header_format());
+ break;
+ default:
+ CLOSE(chan, filename);
+ return(mus_error(MUS_UNSUPPORTED_HEADER_TYPE, "mus_header_change_data_size: can't update %s headers", mus_header_type_name(type)));
+ break;
+ }
+ CLOSE(chan, filename);
+ return(err);
+}
+
+int mus_header_change_chans(const char *filename, int type, int new_chans)
+{
+ int err = MUS_NO_ERROR, fd;
+ off_t new_frames;
+ switch (type)
+ {
+ case MUS_AIFF:
+ case MUS_AIFC:
+ case MUS_NIST:
+ case MUS_RIFF:
+ err = mus_header_read(filename);
+ break;
+ default:
+ break;
+ }
+ if (err == MUS_ERROR) return(err);
+ fd = mus_file_reopen_write(filename);
+ if (fd == -1)
+ return(mus_error(MUS_CANT_OPEN_FILE, "mus_header_change_chans for %s failed: %s", filename, STRERROR(errno)));
+ switch (type)
+ {
+ case MUS_NEXT:
+ lseek(fd, 20L, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, new_chans);
+ CHK_WRITE(fd, hdrbuf, 4);
+ break;
+ case MUS_IRCAM:
+ lseek(fd, 8L, SEEK_SET);
+ if (little_endian)
+ mus_lint_to_char((unsigned char *)hdrbuf, new_chans);
+ else mus_bint_to_char((unsigned char *)hdrbuf, new_chans);
+ CHK_WRITE(fd, hdrbuf, 4);
+ break;
+ case MUS_NIST:
+ lseek(fd, 0L, SEEK_SET);
+ write_nist_header(fd, srate, new_chans, mus_bytes_per_sample(data_format) * data_size, data_format);
+ /* header size is always 1024, so this is safe */
+ break;
+ case MUS_AIFF: case MUS_AIFC:
+ lseek(fd, update_frames_location - 2, SEEK_SET);
+ new_frames = data_size / new_chans;
+ mus_bshort_to_char((unsigned char *)hdrbuf, new_chans);
+ mus_bint_to_char((unsigned char *)(hdrbuf + 2), new_frames);
+ CHK_WRITE(fd, hdrbuf, 6);
+ break;
+ case MUS_RIFF:
+ lseek(fd, update_frames_location - 2, SEEK_SET);
+ if (little_endian)
+ mus_lshort_to_char((unsigned char *)hdrbuf, new_chans);
+ else mus_bshort_to_char((unsigned char *)hdrbuf, new_chans);
+ CHK_WRITE(fd, hdrbuf, 2);
+ break;
+ }
+ CLOSE(fd, filename);
+ return(err);
+}
+
+int mus_header_change_srate(const char *filename, int type, int new_srate)
+{
+ int err = MUS_NO_ERROR, fd;
+ switch (type)
+ {
+ case MUS_AIFF:
+ case MUS_AIFC:
+ case MUS_NIST:
+ case MUS_RIFF:
+ err = mus_header_read(filename);
+ break;
+ default:
+ break;
+ }
+ if (err == MUS_ERROR) return(err);
+ fd = mus_file_reopen_write(filename);
+ if (fd == -1)
+ return(mus_error(MUS_CANT_OPEN_FILE, "mus_header_change_srate for %s failed: %s", filename, STRERROR(errno)));
+ switch (type)
+ {
+ case MUS_NEXT:
+ lseek(fd, 16L, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, new_srate);
+ CHK_WRITE(fd, hdrbuf, 4);
+ break;
+ case MUS_IRCAM:
+ lseek(fd, 4L, SEEK_SET);
+ if (little_endian)
+ mus_lfloat_to_char((unsigned char *)hdrbuf, (float)new_srate);
+ else mus_bfloat_to_char((unsigned char *)hdrbuf, (float)new_srate);
+ CHK_WRITE(fd, hdrbuf, 4);
+ break;
+ case MUS_NIST:
+ lseek(fd, 0L, SEEK_SET);
+ write_nist_header(fd, new_srate, chans, mus_bytes_per_sample(data_format) * data_size, data_format);
+ break;
+ case MUS_AIFF:
+ case MUS_AIFC:
+ lseek(fd, update_frames_location + 6, SEEK_SET);
+ double_to_ieee_80((double)new_srate, (unsigned char *)hdrbuf);
+ CHK_WRITE(fd, hdrbuf, 10);
+ break;
+ case MUS_RIFF:
+ lseek(fd, update_frames_location, SEEK_SET);
+ if (little_endian)
+ mus_lint_to_char((unsigned char *)hdrbuf, new_srate);
+ else mus_bint_to_char((unsigned char *)hdrbuf, new_srate);
+ CHK_WRITE(fd, hdrbuf, 4);
+ break;
+ }
+ CLOSE(fd, filename);
+ return(err);
+}
+
+int mus_header_change_type(const char *filename, int new_type, int new_format)
+{
+ int err = MUS_NO_ERROR;
+ /* open temp, write header, copy data, replace original with temp */
+ err = mus_header_read(filename);
+ if (err == MUS_NO_ERROR)
+ {
+ if (header_type != new_type)
+ {
+ int ofd, ifd, nbytes;
+ off_t loc, len = 0;
+ char *buf = NULL;
+ char *new_file, *comment = NULL;
+ new_file = (char *)CALLOC(strlen(filename) + 5, sizeof(char));
+ sprintf(new_file, "%s.tmp", filename);
+ loc = mus_header_data_location();
+ if (new_type != MUS_RAW)
+ {
+ if (comment_end > comment_start)
+ {
+ len = comment_end - comment_start + 1;
+ comment = (char *)CALLOC(len + 1, sizeof(char));
+ ifd = mus_file_open_read(filename);
+ lseek(ifd, comment_start, SEEK_SET);
+ CHK_READ(ifd, (unsigned char *)comment, len);
+ CLOSE(ifd, filename);
+ }
+ data_size = data_size * mus_bytes_per_sample(data_format) / mus_bytes_per_sample(new_format);
+ mus_header_write(new_file, new_type, srate, chans, loc, data_size, new_format, comment, len);
+ }
+ else mus_file_create(new_file);
+ ifd = mus_file_open_read(filename);
+ lseek(ifd, loc, SEEK_SET);
+ ofd = mus_file_reopen_write(new_file);
+ lseek(ofd, 0L, SEEK_END);
+ buf = (char *)CALLOC(8192, sizeof(char));
+ while ((nbytes = read(ifd, buf, 8192))) CHK_WRITE(ofd, buf, nbytes);
+ CLOSE(ifd, filename);
+ CLOSE(ofd, new_file);
+ FREE(buf);
+ if (comment) FREE(comment);
+ rename(new_file, filename);
+ FREE(new_file);
+ }
+ }
+ return(err);
+}
+
+int mus_header_change_format(const char *filename, int type, int new_format)
+{
+ int err = MUS_NO_ERROR, fd;
+ off_t old_bytes;
+ switch (type)
+ {
+ case MUS_AIFF:
+ case MUS_AIFC:
+ case MUS_NIST:
+ case MUS_RIFF:
+ err = mus_header_read(filename);
+ break;
+ default:
+ break;
+ }
+ if (err == MUS_ERROR) return(err);
+ fd = mus_file_reopen_write(filename);
+ if (fd == -1)
+ return(mus_error(MUS_CANT_OPEN_FILE, "mus_header_change_format for %s failed: %s", filename, STRERROR(errno)));
+ switch (type)
+ {
+ case MUS_NEXT:
+ lseek(fd, 12L, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, sndlib_format_to_next(new_format));
+ CHK_WRITE(fd, hdrbuf, 4);
+ break;
+ case MUS_IRCAM:
+ lseek(fd, 12L, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, sndlib_format_to_ircam(new_format));
+ CHK_WRITE(fd, hdrbuf, 4);
+ break;
+ case MUS_NIST:
+ lseek(fd, 0L, SEEK_SET);
+ write_nist_header(fd, srate, chans, mus_bytes_per_sample(data_format) * data_size, new_format);
+ break;
+ case MUS_AIFF:
+ case MUS_AIFC:
+ old_bytes = data_size * mus_bytes_per_sample(data_format);
+ lseek(fd, update_frames_location, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, old_bytes / (chans * mus_bytes_per_sample(new_format)));
+ mus_bshort_to_char((unsigned char *)(hdrbuf + 4), sndlib_format_to_aiff_bits(new_format));
+ CHK_WRITE(fd, hdrbuf, 6);
+ if (header_type == MUS_AIFC)
+ {
+ const char *str;
+ str = sndlib_format_to_aifc_name(new_format);
+ lseek(fd, update_frames_location + 16, SEEK_SET);
+ write_four_chars((unsigned char *)(hdrbuf + 0), (const unsigned char *)str);
+ (*(unsigned char *)(hdrbuf + 4)) = 4; /* final pad null not accounted-for */
+ write_four_chars((unsigned char *)(hdrbuf + 5), (const unsigned char *)str);
+ (*(unsigned char *)(hdrbuf + 9)) = 0;
+ CHK_WRITE(fd, hdrbuf, 10);
+ }
+ break;
+ case MUS_RIFF:
+ lseek(fd, update_frames_location + 24, SEEK_SET);
+ if (little_endian)
+ mus_lshort_to_char((unsigned char *)hdrbuf, sndlib_format_to_aiff_bits(new_format));
+ else mus_bshort_to_char((unsigned char *)hdrbuf, sndlib_format_to_aiff_bits(new_format));
+ CHK_WRITE(fd, hdrbuf, 2);
+ lseek(fd, update_frames_location + 10, SEEK_SET);
+ switch (new_format)
+ {
+ case MUS_MULAW:
+ new_format = 7;
+ break;
+ case MUS_ALAW:
+ new_format = 6;
+ break;
+ case MUS_UBYTE:
+ case MUS_LSHORT: case MUS_L24INT: case MUS_LINT:
+ case MUS_BSHORT: case MUS_B24INT: case MUS_BINT:
+ new_format = 1;
+ break;
+ case MUS_LFLOAT: case MUS_LDOUBLE:
+ case MUS_BFLOAT: case MUS_BDOUBLE:
+ new_format = 3;
+ break;
+ }
+ if (little_endian)
+ mus_lshort_to_char((unsigned char *)hdrbuf, new_format);
+ else mus_bshort_to_char((unsigned char *)hdrbuf, new_format);
+ CHK_WRITE(fd, hdrbuf, 2);
+ break;
+ }
+ CLOSE(fd, filename);
+ return(err);
+}
+
+int mus_header_change_location(const char *filename, int type, off_t new_location)
+{
+ /* only Next/Sun changeable in this regard */
+ int err = MUS_NO_ERROR, fd;
+ fd = mus_file_reopen_write(filename);
+ if (fd == -1)
+ return(mus_error(MUS_CANT_OPEN_FILE, "mus_header_change_location for %s failed: %s", filename, STRERROR(errno)));
+ if (type == MUS_NEXT)
+ {
+ lseek(fd, 4L, SEEK_SET);
+ mus_bint_to_char((unsigned char *)hdrbuf, new_location);
+ CHK_WRITE(fd, hdrbuf, 4);
+ }
+ CLOSE(fd, filename);
+ return(err);
+}
+
+int mus_header_change_comment(const char *filename, int type, char *new_comment)
+{
+ int err = MUS_NO_ERROR, fd, len = 0;
+ bool need_ripple = false;
+ err = mus_header_read(filename);
+ if (err == MUS_NO_ERROR)
+ {
+ switch (type)
+ {
+ case MUS_IRCAM:
+ fd = mus_file_reopen_write(filename);
+ lseek(fd, 16L, SEEK_SET);
+ if (new_comment) len = strlen(new_comment);
+ write_ircam_comment(fd, new_comment, len);
+ CLOSE(fd, filename);
+ break;
+ case MUS_NEXT:
+ fd = mus_file_reopen_write(filename);
+ lseek(fd, 24L, SEEK_SET);
+ if (new_comment == NULL)
+ write_next_comment(fd, new_comment, 0, data_location); /* erase old possibly */
+ else
+ {
+ if ((comment_start != comment_end) &&
+ ((int)(data_location - 24) >= (int)strlen(new_comment)))
+ write_next_comment(fd, new_comment, strlen(new_comment), data_location); /* there's room to overwrite old comment */
+ else need_ripple = true;
+ }
+ CLOSE(fd, filename);
+ break;
+ default:
+ need_ripple = true;
+ break;
+ }
+ if (need_ripple)
+ {
+ /* open temp, write header, copy data, replace original with temp */
+ char *new_file;
+ int ofd, ifd;
+ off_t loc;
+ int nbytes;
+ char *buf = NULL;
+ new_file = (char *)CALLOC(strlen(filename) + 5, sizeof(char));
+ sprintf(new_file, "%s.tmp", filename);
+ loc = mus_header_data_location();
+ mus_header_write(new_file, header_type, srate, chans, loc, data_size, data_format, new_comment, (new_comment) ? strlen(new_comment) : 0);
+ ifd = mus_file_open_read(filename);
+ lseek(ifd, loc, SEEK_SET);
+ ofd = mus_file_reopen_write(new_file);
+ lseek(ofd, 0L, SEEK_END);
+ buf = (char *)CALLOC(8192, sizeof(char));
+ while ((nbytes = read(ifd, buf, 8192))) CHK_WRITE(ofd, buf, nbytes);
+ CLOSE(ifd, filename);
+ CLOSE(ofd, new_file);
+ FREE(buf);
+ rename(new_file, filename);
+ FREE(new_file);
+ }
+ }
+ return(err);
+}
+
+bool mus_header_writable(int type, int format) /* -2 to ignore format for this call */
+{
+ switch (type)
+ {
+ case MUS_NEXT:
+ if (format == MUS_UNKNOWN) return(false);
+ return(true);
+ break;
+ case MUS_NIST:
+ if (format == -2) return(true);
+ switch (format)
+ {
+ case MUS_BYTE: case MUS_BSHORT: case MUS_B24INT: case MUS_BINT:
+ case MUS_LSHORT: case MUS_L24INT: case MUS_LINT:
+ return(true); break;
+ default:
+ return(false); break;
+ }
+ break;
+ case MUS_AIFC:
+ if (format == -2) return(true);
+ switch (format)
+ {
+ case MUS_BSHORT: case MUS_B24INT: case MUS_BINT:
+ case MUS_BYTE: case MUS_MULAW: case MUS_ALAW:
+ case MUS_BFLOAT: case MUS_BDOUBLE: case MUS_UBYTE: case MUS_UBSHORT:
+ case MUS_LSHORT: case MUS_L24INT: case MUS_LINT:
+ return(true);
+ break;
+ default:
+ return(false);
+ break;
+ }
+ break;
+ case MUS_AIFF:
+ if (format == -2) return(true);
+ switch (format)
+ {
+ case MUS_BSHORT: case MUS_B24INT: case MUS_BINT: case MUS_BYTE:
+ return(true);
+ break;
+ default:
+ return(false);
+ break;
+ }
+ break;
+ case MUS_RIFF:
+ if (format == -2) return(true);
+ switch (format)
+ {
+ case MUS_MULAW: case MUS_ALAW: case MUS_UBYTE: case MUS_LFLOAT:
+ case MUS_LSHORT: case MUS_L24INT: case MUS_LINT: case MUS_LDOUBLE:
+ return(true);
+ break;
+ default:
+ return(false);
+ break;
+ }
+ break;
+ case MUS_IRCAM:
+ if (format == -2) return(true);
+ switch (format)
+ {
+ case MUS_MULAW: case MUS_ALAW: case MUS_BSHORT: case MUS_BINT: case MUS_BFLOAT:
+ return(true);
+ break;
+ default:
+ return(false);
+ break;
+ }
+ break;
+ case MUS_RAW:
+ return(true);
+ break;
+ default: return(false); break;
+ }
+ return(false);
+}
+
+static char aifc_format[5];
+
+/* try to give some info on data formats that aren't supported by sndlib */
+const char *mus_header_original_format_name(int format, int type)
+{
+ switch (type)
+ {
+ case MUS_NEXT:
+ switch (format)
+ {
+ case 0: return("unspecified"); break; case 8: return("indirect"); break; case 9: return("nested"); break;
+ case 10: return("dsp_core"); break; case 11: return("dsp_data_8"); break; case 12: return("dsp_data_16"); break;
+ case 13: return("dsp_data_24"); break; case 14: return("dsp_data_32"); break; case 16: return("display"); break;
+ case 17: return("mulaw_squelch"); break; case 18: return("emphasized"); break; case 19: return("compressed"); break;
+ case 20: return("compressed_emphasized"); break; case 21: return("dsp_commands"); break; case 22: return("dsp_commands_samples"); break;
+ case 23: return("adpcm_g721"); break; case 24: return("adpcm_g722"); break; case 25: return("adpcm_g723"); break;
+ case 26: return("adpcm_g723_5"); break; case 28: return("aes"); break; case 29: return("delat_mulaw_8"); break;
+ }
+ break;
+ case MUS_AIFC:
+ aifc_format[4] = 0;
+#if MUS_LITTLE_ENDIAN
+ sprintf(aifc_format, "%c%c%c%c", format & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, (format >> 24) & 0xff);
+#else
+ sprintf(aifc_format, "%c%c%c%c", (format >> 24) & 0xff, (format >> 16) & 0xff, (format >> 8) & 0xff, format & 0xff);
+#endif
+ return(aifc_format);
+ break;
+ case MUS_PVF:
+ if (type_specifier == mus_char_to_uninterpreted_int((unsigned const char *)I_PVF2))
+ return("ascii text");
+ break;
+ case MUS_RIFF:
+ switch (format)
+ {
+ case 2: return("ADPCM"); break; case 4: return("VSELP"); break; case 5: return("IBM_CVSD"); break;
+ case 0x10: return("OKI_ADPCM"); break; case 0x11: return("DVI_ADPCM"); break; case 0x12: return("MediaSpace_ADPCM"); break;
+ case 0x13: return("Sierra_ADPCM"); break; case 0x14: return("G723_ADPCM"); break; case 0x15: return("DIGISTD"); break;
+ case 0x16: return("DIGIFIX"); break; case 0x17: return("Dialogic ADPCM"); break; case 0x18: return("Mediavision ADPCM"); break;
+ case 0x19: return("HP cu codec"); break; case 0x20: return("Yamaha_ADPCM"); break; case 0x21: return("SONARC"); break;
+ case 0x22: return("DSPGroup_TrueSpeech"); break; case 0x23: return("EchoSC1"); break; case 0x24: return("AudioFile_AF36"); break;
+ case 0x25: return("APTX"); break; case 0x26: return("AudioFile_AF10"); break; case 0x27: return("prosody 1612"); break;
+ case 0x28: return("lrc"); break; case 0x30: return("Dolby_Ac2"); break; case 0x31: return("GSM610"); break;
+ case 0x32: return("MSN audio codec"); break; case 0x33: return("Antext_ADPCM"); break; case 0x34: return("Control_res_vqlpc"); break;
+ case 0x35: return("DIGIREAL"); break; case 0x36: return("DIGIADPCM"); break; case 0x37: return("Control_res_cr10"); break;
+ case 0x38: return("NMS_VBXADPCM"); break; case 0x39: return("oland rdac"); break; case 0x3a: return("echo sc3"); break;
+ case 0x3b: return("Rockwell adpcm"); break; case 0x3c: return("Rockwell digitalk codec"); break; case 0x3d: return("Xebec"); break;
+ case 0x40: return("G721_ADPCM"); break; case 0x41: return("G728 CELP"); break; case 0x42: return("MS G723"); break;
+ case 0x50: return("MPEG"); break; case 0x52: return("RT24"); break; case 0x53: return("PAC"); break;
+ case 0x55: return("Mpeg layer 3"); break; case 0x59: return("Lucent G723"); break; case 0x60: return("Cirrus"); break;
+ case 0x61: return("ESS Tech pcm"); break; case 0x62: return("voxware "); break; case 0x63: return("canopus atrac"); break;
+ case 0x64: return("G726"); break; case 0x65: return("G722"); break; case 0x66: return("DSAT"); break;
+ case 0x67: return("DSAT display"); break; case 0x69: return("voxware "); break; case 0x70: return("voxware ac8 "); break;
+ case 0x71: return("voxware ac10 "); break; case 0x72: return("voxware ac16"); break; case 0x73: return("voxware ac20"); break;
+ case 0x74: return("voxware rt24"); break; case 0x75: return("voxware rt29"); break; case 0x76: return("voxware rt29hw"); break;
+ case 0x77: return("voxware vr12 "); break; case 0x78: return("voxware vr18"); break; case 0x79: return("voxware tq40"); break;
+ case 0x80: return("softsound"); break; case 0x81: return("voxware tq60 "); break; case 0x82: return("MS RT24"); break;
+ case 0x83: return("G729A"); break; case 0x84: return("MVI_MVI2"); break; case 0x85: return("DF G726"); break;
+ case 0x86: return("DF GSM610"); break; case 0x88: return("isaudio"); break; case 0x89: return("onlive"); break;
+ case 0x91: return("sbc24"); break; case 0x92: return("dolby ac3 spdif"); break; case 0x97: return("zyxel adpcm"); break;
+ case 0x98: return("philips lpcbb"); break; case 0x99: return("packed"); break; case 0x100: return("rhetorex adpcm"); break;
+ case 0x101: return("Irat"); break; case 0x102: return("IBM_alaw?"); break; case 0x103: return("IBM_ADPCM?"); break;
+ case 0x111: return("vivo G723"); break; case 0x112: return("vivo siren"); break; case 0x123: return("digital g273"); break;
+ case 0x200: return("Creative_ADPCM"); break; case 0x202: return("Creative fastspeech 8"); break;
+ case 0x203: return("Creative fastspeech 10"); break;
+ case 0x220: return("quarterdeck"); break; case 0x300: return("FM_TOWNS_SND"); break; case 0x400: return("BTV digital"); break;
+ case 0x680: return("VME vmpcm"); break; case 0x1000: return("OLIGSM"); break; case 0x1001: return("OLIADPCM"); break;
+ case 0x1002: return("OLICELP"); break; case 0x1003: return("OLISBC"); break; case 0x1004: return("OLIOPR"); break;
+ case 0x1100: return("LH codec"); break; case 0x1400: return("Norris"); break; case 0x1401: return("isaudio"); break;
+ case 0x1500: return("Soundspace musicompression"); break; case 0x2000: return("DVM"); break;
+ }
+ break;
+ }
+ return("unknown"); /* NULL here isn't safe -- Sun segfaults */
+}
+
+bool mus_header_no_header(const char *filename)
+{
+ int chan, bytes;
+ bool ok = false;
+ chan = mus_file_open_read(filename);
+ if (chan == -1)
+ return(mus_error(MUS_CANT_OPEN_FILE, "mus_header: can't open %s: %s", filename, STRERROR(errno)));
+ bytes = read(chan, hdrbuf, INITIAL_READ_SIZE);
+ CLOSE(chan, filename);
+ if (bytes > 4)
+ ok = ((match_four_chars((unsigned char *)hdrbuf, I_DSND)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_DECN)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_FORM)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_RIFF)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_RIFX)) ||
+ (equal_big_or_little_endian((unsigned char *)hdrbuf, I_IRCAM_VAX)) ||
+ (equal_big_or_little_endian((unsigned char *)hdrbuf, I_IRCAM_SUN)) ||
+ (equal_big_or_little_endian((unsigned char *)hdrbuf, I_IRCAM_MIPS)) ||
+ (equal_big_or_little_endian((unsigned char *)hdrbuf, I_IRCAM_NEXT)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_NIST)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SOUN)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_VOC0)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_AVR_)) ||
+ (mus_char_to_bshort((unsigned char *)hdrbuf) == 1336) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_ALaw)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_GF1P)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_DSIG)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_GOLD)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_Diam)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SRFS)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_CSRE)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_file)) ||
+ ((hdrbuf[0] == 0xf0) && (hdrbuf[1] == 0x7e) && (hdrbuf[3] == 0x01)) ||
+ (equal_big_or_little_endian((unsigned char *)(hdrbuf + 16), 0x00006a1a)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SPIB)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_S___)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_riff)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_PVF1)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_PVF2)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_MThd)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SND_)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_FSMt)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_DDSF)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_LM89)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SY85)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SY80)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_PRAM)) ||
+ (match_four_chars((unsigned char *)(hdrbuf + 35), I_UWFD)) ||
+ (match_four_chars((unsigned char *)(hdrbuf + 76), I_SCRS)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_covox)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I__PAF)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_FAP_)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_TWIN)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_IMPS)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SMP1)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_Maui)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_SDIF)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_ajkg)) ||
+ (match_four_chars((unsigned char *)hdrbuf, I_NVF_)));
+ return(!ok);
+}
+
+void mus_header_set_aiff_loop_info(int *data)
+{
+ /* include modes */
+ if (data)
+ {
+ loop_starts[0] = data[0];
+ loop_ends[0] = data[1];
+ loop_starts[1] = data[2];
+ loop_ends[1] = data[3];
+ base_note = data[4];
+ base_detune = data[5];
+ loop_modes[0] = data[6];
+ loop_modes[1] = data[7];
+ }
+ else
+ {
+ loop_modes[0] = 0;
+ loop_modes[1] = 0;
+ }
+}
diff --git a/third_party/resample/sndlib-20/io.c b/third_party/resample/sndlib-20/io.c
new file mode 100644
index 00000000..57376b7e
--- /dev/null
+++ b/third_party/resample/sndlib-20/io.c
@@ -0,0 +1,1513 @@
+/* IO handlers */
+/*
+ * --------------------------------
+ * int mus_file_read(int fd, int beg, int end, int chans, mus_sample_t **bufs)
+ * int mus_file_write(int tfd, int beg, int end, int chans, mus_sample_t **bufs)
+ * int mus_file_open_read(const char *arg)
+ * int mus_file_open_write(const char *arg)
+ * int mus_file_create(const char *arg)
+ * int mus_file_reopen_write(const char *arg)
+ * int mus_file_close(int fd)
+ * bool mus_file_probe(const char *arg)
+ * char *mus_format(const char *format, ...)
+ * off_t mus_file_seek_frame(int tfd, off_t frame)
+ * --------------------------------
+ */
+
+#include <mus-config.h>
+
+#if USE_SND
+ #include "snd.h"
+#endif
+
+#include <math.h>
+#include <stdio.h>
+#if HAVE_FCNTL_H
+ #include <fcntl.h>
+#endif
+#if HAVE_LIMITS_H
+ #include <limits.h>
+#endif
+#include <errno.h>
+#include <stdlib.h>
+
+#if (defined(HAVE_LIBC_H) && (!defined(HAVE_UNISTD_H)))
+ #include <libc.h>
+#else
+ #if (!(defined(_MSC_VER)))
+ #include <unistd.h>
+ #endif
+#endif
+#if HAVE_STRING_H
+ #include <string.h>
+#endif
+#include <stdarg.h>
+
+#include "_sndlib.h"
+
+/* data translations for big/little endian machines
+ * the m_* forms are macros where possible for speed (dating back to 1991 -- probably not needed)
+ */
+
+void mus_bint_to_char(unsigned char *j, int x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if MUS_LITTLE_ENDIAN
+ j[0] = ox[3]; j[1] = ox[2]; j[2] = ox[1]; j[3] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 4);
+#endif
+}
+
+int mus_char_to_bint(const unsigned char *inp)
+{
+ int o;
+ unsigned char *outp = (unsigned char *)&o;
+#if MUS_LITTLE_ENDIAN
+ outp[0] = inp[3]; outp[1] = inp[2]; outp[2] = inp[1]; outp[3] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 4);
+#endif
+ return(o);
+}
+
+void mus_lint_to_char(unsigned char *j, int x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if (!MUS_LITTLE_ENDIAN)
+ j[0] = ox[3]; j[1] = ox[2]; j[2] = ox[1]; j[3] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 4);
+#endif
+}
+
+int mus_char_to_lint(const unsigned char *inp)
+{
+ int o;
+ unsigned char *outp = (unsigned char *)&o;
+#if (!MUS_LITTLE_ENDIAN)
+ outp[0] = inp[3]; outp[1] = inp[2]; outp[2] = inp[1]; outp[3] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 4);
+#endif
+ return(o);
+}
+
+int mus_char_to_uninterpreted_int(const unsigned char *inp)
+{
+ int o;
+ unsigned char *outp = (unsigned char *)&o;
+ memcpy((void *)outp, (void *)inp, 4);
+ return(o);
+}
+
+unsigned int mus_char_to_ubint(const unsigned char *inp)
+{
+ unsigned int o;
+ unsigned char *outp = (unsigned char *)&o;
+#if MUS_LITTLE_ENDIAN
+ outp[0] = inp[3]; outp[1] = inp[2]; outp[2] = inp[1]; outp[3] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 4);
+#endif
+ return(o);
+}
+
+unsigned int mus_char_to_ulint(const unsigned char *inp)
+{
+ unsigned int o;
+ unsigned char *outp = (unsigned char *)&o;
+#if (!MUS_LITTLE_ENDIAN)
+ outp[0] = inp[3]; outp[1] = inp[2]; outp[2] = inp[1]; outp[3] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 4);
+#endif
+ return(o);
+}
+
+
+void mus_bfloat_to_char(unsigned char *j, float x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if MUS_LITTLE_ENDIAN
+ j[0] = ox[3]; j[1] = ox[2]; j[2] = ox[1]; j[3] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 4);
+#endif
+}
+
+float mus_char_to_bfloat(const unsigned char *inp)
+{
+ float o;
+ unsigned char *outp = (unsigned char *)&o;
+#if MUS_LITTLE_ENDIAN
+ outp[0] = inp[3]; outp[1] = inp[2]; outp[2] = inp[1]; outp[3] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 4);
+#endif
+ return(o);
+}
+
+void mus_lfloat_to_char(unsigned char *j, float x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if (!MUS_LITTLE_ENDIAN)
+ j[0] = ox[3]; j[1] = ox[2]; j[2] = ox[1]; j[3] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 4);
+#endif
+}
+
+float mus_char_to_lfloat(const unsigned char *inp)
+{
+ float o;
+ unsigned char *outp = (unsigned char *)&o;
+#if (!MUS_LITTLE_ENDIAN)
+ outp[0] = inp[3]; outp[1] = inp[2]; outp[2] = inp[1]; outp[3] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 4);
+#endif
+ return(o);
+}
+
+void mus_bshort_to_char(unsigned char *j, short x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if MUS_LITTLE_ENDIAN
+ j[0] = ox[1]; j[1] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 2); /* I wonder if this is faster */
+#endif
+}
+
+short mus_char_to_bshort(const unsigned char *inp)
+{
+ short o;
+ unsigned char *outp = (unsigned char *)&o;
+#if MUS_LITTLE_ENDIAN
+ outp[0] = inp[1]; outp[1] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 2);
+#endif
+ return(o);
+}
+
+void mus_lshort_to_char(unsigned char *j, short x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if (!MUS_LITTLE_ENDIAN)
+ j[0] = ox[1]; j[1] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 2);
+#endif
+}
+
+short mus_char_to_lshort(const unsigned char *inp)
+{
+ short o;
+ unsigned char *outp = (unsigned char *)&o;
+#if (!MUS_LITTLE_ENDIAN)
+ outp[0] = inp[1]; outp[1] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 2);
+#endif
+ return(o);
+}
+
+void mus_ubshort_to_char(unsigned char *j, unsigned short x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if MUS_LITTLE_ENDIAN
+ j[0] = ox[1]; j[1] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 2);
+#endif
+}
+
+unsigned short mus_char_to_ubshort(const unsigned char *inp)
+{
+ unsigned short o;
+ unsigned char *outp = (unsigned char *)&o;
+#if MUS_LITTLE_ENDIAN
+ outp[0] = inp[1]; outp[1] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 2);
+#endif
+ return(o);
+}
+
+void mus_ulshort_to_char(unsigned char *j, unsigned short x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if (!MUS_LITTLE_ENDIAN)
+ j[0] = ox[1]; j[1] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 2);
+#endif
+}
+
+unsigned short mus_char_to_ulshort(const unsigned char *inp)
+{
+ unsigned short o;
+ unsigned char *outp = (unsigned char *)&o;
+#if (!MUS_LITTLE_ENDIAN)
+ outp[0] = inp[1]; outp[1] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 2);
+#endif
+ return(o);
+}
+
+double mus_char_to_ldouble(const unsigned char *inp)
+{
+ double o;
+ unsigned char *outp = (unsigned char *)&o;
+#if (MUS_LITTLE_ENDIAN)
+ memcpy((void *)outp, (void *)inp, 8);
+#else
+ outp[0] = inp[7]; outp[1] = inp[6]; outp[2] = inp[5]; outp[3] = inp[4]; outp[4] = inp[3]; outp[5] = inp[2]; outp[6] = inp[1]; outp[7] = inp[0];
+#endif
+ return(o);
+}
+
+double mus_char_to_bdouble(const unsigned char *inp)
+{
+ double o;
+ unsigned char *outp = (unsigned char *)&o;
+#if (MUS_LITTLE_ENDIAN)
+ outp[0] = inp[7]; outp[1] = inp[6]; outp[2] = inp[5]; outp[3] = inp[4]; outp[4] = inp[3]; outp[5] = inp[2]; outp[6] = inp[1]; outp[7] = inp[0];
+#else
+ memcpy((void *)outp, (void *)inp, 8);
+#endif
+ return(o);
+}
+
+void mus_bdouble_to_char(unsigned char *j, double x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if (MUS_LITTLE_ENDIAN)
+ j[0] = ox[7]; j[1] = ox[6]; j[2] = ox[5]; j[3] = ox[4]; j[4] = ox[3]; j[5] = ox[2]; j[6] = ox[1]; j[7] = ox[0];
+#else
+ memcpy((void *)j, (void *)ox, 8);
+#endif
+}
+
+void mus_ldouble_to_char(unsigned char *j, double x)
+{
+ unsigned char *ox = (unsigned char *)&x;
+#if (MUS_LITTLE_ENDIAN)
+ memcpy((void *)j, (void *)ox, 8);
+#else
+ j[0] = ox[7]; j[1] = ox[6]; j[2] = ox[5]; j[3] = ox[4]; j[4] = ox[3]; j[5] = ox[2]; j[6] = ox[1]; j[7] = ox[0];
+#endif
+}
+
+#if HAVE_BYTESWAP_H
+ #include <byteswap.h>
+#endif
+
+#if MUS_LITTLE_ENDIAN
+
+ #if HAVE_BYTESWAP_H
+ #define m_big_endian_short(n) ((short)(bswap_16((*((unsigned short *)n)))))
+ #define m_big_endian_int(n) ((int)(bswap_32((*((unsigned int *)n)))))
+ #define m_big_endian_unsigned_short(n) ((unsigned short)(bswap_16((*((unsigned short *)n)))))
+ #else
+ #define m_big_endian_short(n) (mus_char_to_bshort(n))
+ #define m_big_endian_int(n) (mus_char_to_bint(n))
+ #define m_big_endian_unsigned_short(n) (mus_char_to_ubshort(n))
+ #endif
+ #define m_big_endian_float(n) (mus_char_to_bfloat(n))
+ #define m_big_endian_double(n) (mus_char_to_bdouble(n))
+
+ #define m_little_endian_short(n) (*((short *)n))
+ #define m_little_endian_int(n) (*((int *)n))
+ #define m_little_endian_float(n) (*((float *)n))
+ #define m_little_endian_double(n) (*((double *)n))
+ #define m_little_endian_unsigned_short(n) (*((unsigned short *)n))
+
+ #if HAVE_BYTESWAP_H
+ #define m_set_big_endian_short(n, x) (*((short *)n)) = ((short)(bswap_16(x)))
+ #define m_set_big_endian_int(n, x) (*((int *)n)) = ((int)(bswap_32(x)))
+ #define m_set_big_endian_unsigned_short(n, x) (*((unsigned short *)n)) = ((unsigned short)(bswap_16(x)))
+ #else
+ #define m_set_big_endian_short(n, x) mus_bshort_to_char(n, x)
+ #define m_set_big_endian_int(n, x) mus_bint_to_char(n, x)
+ #define m_set_big_endian_unsigned_short(n, x) mus_ubshort_to_char(n, x)
+ #endif
+ #define m_set_big_endian_float(n, x) mus_bfloat_to_char(n, x)
+ #define m_set_big_endian_double(n, x) mus_bdouble_to_char(n, x)
+
+ #define m_set_little_endian_short(n, x) (*((short *)n)) = x
+ #define m_set_little_endian_int(n, x) (*((int *)n)) = x
+ #define m_set_little_endian_float(n, x) (*((float *)n)) = x
+ #define m_set_little_endian_double(n, x) (*((double *)n)) = x
+ #define m_set_little_endian_unsigned_short(n, x) (*((unsigned short *)n)) = x
+
+#else
+
+ #ifndef MUS_SUN
+ #define m_big_endian_short(n) (*((short *)n))
+ #define m_big_endian_int(n) (*((int *)n))
+ #define m_big_endian_float(n) (*((float *)n))
+ #define m_big_endian_double(n) (*((double *)n))
+ #define m_big_endian_unsigned_short(n) (*((unsigned short *)n))
+
+ #define m_set_big_endian_short(n, x) (*((short *)n)) = x
+ #define m_set_big_endian_int(n, x) (*((int *)n)) = x
+ #define m_set_big_endian_float(n, x) (*((float *)n)) = x
+ #define m_set_big_endian_double(n, x) (*((double *)n)) = x
+ #define m_set_big_endian_unsigned_short(n, x) (*((unsigned short *)n)) = x
+ #else
+ #define m_big_endian_short(n) (mus_char_to_bshort(n))
+ #define m_big_endian_int(n) (mus_char_to_bint(n))
+ #define m_big_endian_float(n) (mus_char_to_bfloat(n))
+ #define m_big_endian_double(n) (mus_char_to_bdouble(n))
+ #define m_big_endian_unsigned_short(n) (mus_char_to_ubshort(n))
+
+ #define m_set_big_endian_short(n, x) mus_bshort_to_char(n, x)
+ #define m_set_big_endian_int(n, x) mus_bint_to_char(n, x)
+ #define m_set_big_endian_float(n, x) mus_bfloat_to_char(n, x)
+ #define m_set_big_endian_double(n, x) mus_bdouble_to_char(n, x)
+ #define m_set_big_endian_unsigned_short(n, x) mus_ubshort_to_char(n, x)
+ #endif
+
+ #if HAVE_BYTESWAP_H
+ #define m_little_endian_short(n) ((short)(bswap_16((*((unsigned short *)n)))))
+ #define m_little_endian_int(n) ((int)(bswap_32((*((unsigned int *)n)))))
+ #define m_little_endian_unsigned_short(n) ((unsigned short)(bswap_16((*((unsigned short *)n)))))
+ #else
+ #define m_little_endian_short(n) (mus_char_to_lshort(n))
+ #define m_little_endian_int(n) (mus_char_to_lint(n))
+ #define m_little_endian_unsigned_short(n) (mus_char_to_ulshort(n))
+ #endif
+ #define m_little_endian_float(n) (mus_char_to_lfloat(n))
+ #define m_little_endian_double(n) (mus_char_to_ldouble(n))
+
+ #if HAVE_BYTESWAP_H
+ #define m_set_little_endian_short(n, x) (*((short *)n)) = ((short)(bswap_16(x)))
+ #define m_set_little_endian_int(n, x) (*((int *)n)) = ((int)(bswap_32(x)))
+ #define m_set_little_endian_unsigned_short(n, x) (*((unsigned short *)n)) = ((unsigned short)(bswap_16(x)))
+ #else
+ #define m_set_little_endian_short(n, x) mus_lshort_to_char(n, x)
+ #define m_set_little_endian_int(n, x) mus_lint_to_char(n, x)
+ #define m_set_little_endian_unsigned_short(n, x) mus_ulshort_to_char(n, x)
+ #endif
+ #define m_set_little_endian_float(n, x) mus_lfloat_to_char(n, x)
+ #define m_set_little_endian_double(n, x) mus_ldouble_to_char(n, x)
+
+#endif
+
+
+/* ---------------- file descriptors ---------------- */
+
+typedef struct {
+ char *name;
+ int data_format, bytes_per_sample, chans, header_type;
+ bool clipping;
+ off_t data_location;
+ Float prescaler;
+} io_fd;
+
+static int io_fd_size = 0;
+static io_fd **io_fds = NULL;
+#define IO_FD_ALLOC_SIZE 8
+static bool clipping_default = false;
+static Float prescaler_default = 1.0;
+
+bool mus_clipping(void) {return(clipping_default);}
+bool mus_set_clipping(bool new_value) {clipping_default = new_value; return(new_value);}
+Float mus_prescaler(void) {return(prescaler_default);}
+Float mus_set_prescaler(Float new_value) {prescaler_default = new_value; return(new_value);}
+
+int mus_file_open_descriptors(int tfd, const char *name, int format, int size /* datum size */, off_t location, int chans, int type)
+{
+ io_fd *fd;
+ int i, lim = -1;
+ if (io_fd_size == 0)
+ {
+ io_fd_size = tfd + IO_FD_ALLOC_SIZE;
+ io_fds = (io_fd **)CALLOC(io_fd_size, sizeof(io_fd *));
+ if (!io_fds) return(MUS_MEMORY_ALLOCATION_FAILED);
+ }
+ if (io_fd_size <= tfd)
+ {
+ lim = io_fd_size;
+ io_fd_size = tfd + IO_FD_ALLOC_SIZE;
+ io_fds = (io_fd **)REALLOC(io_fds, io_fd_size * sizeof(io_fd *));
+ for (i = lim; i < io_fd_size; i++) io_fds[i] = NULL;
+ }
+ if (io_fds[tfd] == NULL)
+ {
+ io_fds[tfd] = (io_fd *)CALLOC(1, sizeof(io_fd));
+ if (!(io_fds[tfd])) return(MUS_MEMORY_ALLOCATION_FAILED);
+ }
+
+ fd = io_fds[tfd];
+ fd->data_format = format;
+ fd->bytes_per_sample = size;
+#if MUS_DEBUGGING
+ if (size != mus_bytes_per_sample(format))
+ fprintf(stderr, "format trouble in mus_file_open_descriptors: %d != %d\n", size, mus_bytes_per_sample(format));
+#endif
+ fd->data_location = location;
+ fd->clipping = clipping_default;
+ fd->prescaler = prescaler_default;
+ fd->header_type = type;
+ fd->chans = chans;
+ if (name)
+ {
+ fd->name = (char *)CALLOC(strlen(name) + 1, sizeof(char));
+ strcpy(fd->name, name);
+ }
+ return(MUS_NO_ERROR);
+}
+
+bool mus_file_clipping(int tfd)
+{
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL)) return(false);
+ fd = io_fds[tfd];
+ return(fd->clipping);
+}
+
+int mus_file_set_clipping(int tfd, bool clipped)
+{
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL)) return(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED);
+ fd = io_fds[tfd];
+ fd->clipping = clipped;
+ return(MUS_NO_ERROR);
+}
+
+int mus_file_set_header_type(int tfd, int type)
+{
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL)) return(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED);
+ fd = io_fds[tfd];
+ fd->header_type = type;
+ return(MUS_NO_ERROR);
+}
+
+int mus_file_header_type(int tfd)
+{
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL)) return(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED);
+ fd = io_fds[tfd];
+ return(fd->header_type);
+}
+
+Float mus_file_prescaler(int tfd)
+{
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL)) return(0.0);
+ fd = io_fds[tfd];
+ return(fd->prescaler);
+}
+
+Float mus_file_set_prescaler(int tfd, Float val)
+{
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL)) return(0.0);
+ fd = io_fds[tfd];
+ fd->prescaler = val;
+ return(val);
+}
+
+char *mus_file_fd_name(int tfd)
+{
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL)) return(NULL);
+ fd = io_fds[tfd];
+ return(fd->name);
+}
+
+int mus_file_set_chans(int tfd, int chans)
+{
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL)) return(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED);
+ fd = io_fds[tfd];
+ fd->chans = chans;
+ return(MUS_NO_ERROR);
+}
+
+
+/* ---------------- open, creat, close ---------------- */
+
+int mus_file_open_read(const char *arg)
+{
+ int fd;
+#ifdef MUS_WINDOZE
+ fd = OPEN(arg, O_RDONLY | O_BINARY, 0);
+#else
+ fd = OPEN(arg, O_RDONLY, 0);
+#endif
+ return(fd);
+}
+
+bool mus_file_probe(const char *arg)
+{
+#if HAVE_ACCESS
+ return(access(arg, F_OK) == 0);
+#else
+ int fd;
+#ifdef O_NONBLOCK
+ fd = OPEN(arg, O_RDONLY, O_NONBLOCK);
+#else
+ fd = OPEN(arg, O_RDONLY, 0);
+#endif
+ if (fd == -1) return(false);
+ CLOSE(fd, arg);
+ return(true);
+#endif
+}
+
+int mus_file_open_write(const char *arg)
+{
+ int fd;
+#ifdef MUS_WINDOZE
+ if ((fd = OPEN(arg, O_RDWR | O_BINARY, 0)) == -1)
+#else
+ if ((fd = OPEN(arg, O_RDWR, 0)) == -1)
+#endif
+ fd = CREAT(arg, 0666); /* equivalent to the new open(arg, O_RDWR | O_CREAT | O_TRUNC, 0666) */
+ else lseek(fd, 0L, SEEK_END);
+ return(fd);
+}
+
+int mus_file_create(const char *arg)
+{
+ return(CREAT(arg, 0666));
+}
+
+int mus_file_reopen_write(const char *arg)
+{
+ int fd;
+#ifdef MUS_WINDOZE
+ fd = OPEN(arg, O_RDWR | O_BINARY, 0);
+#else
+ fd = OPEN(arg, O_RDWR, 0);
+#endif
+ return(fd);
+}
+
+int mus_file_close(int fd)
+{
+ io_fd *fdp;
+ int close_result = 0;
+ if ((io_fds == NULL) || (fd >= io_fd_size) || (fd < 0) || (io_fds[fd] == NULL)) return(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED);
+ fdp = io_fds[fd];
+#if USE_SND
+ CLOSE(fd, fdp->name);
+#else
+ close_result = close(fd);
+#endif
+ if (fdp->name) {FREE(fdp->name); fdp->name = NULL;}
+ FREE(fdp);
+ io_fds[fd] = NULL;
+ if (close_result < 0)
+ return(MUS_CANT_CLOSE_FILE);
+ return(MUS_NO_ERROR);
+}
+
+
+
+/* ---------------- seek ---------------- */
+
+off_t mus_file_seek_frame(int tfd, off_t frame)
+{
+ io_fd *fd;
+ if (io_fds == NULL)
+ return(mus_error(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED, "mus_file_seek_frame: no file descriptors!"));
+ if (tfd < 0)
+ return(mus_error(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED, "mus_file_seek_frame: file descriptor = %d?", tfd));
+ if ((tfd >= io_fd_size) ||
+ (io_fds[tfd] == NULL))
+ return(mus_error(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED,
+ "mus_file_seek_frame: file descriptors not realloc'd? (tfd: %d, io_fd_size: %d)", tfd, io_fd_size));
+ fd = io_fds[tfd];
+ if (fd->data_format == MUS_UNKNOWN)
+ return(mus_error(MUS_NOT_A_SOUND_FILE, "mus_file_seek_frame: invalid data format for %s", fd->name));
+ return(lseek(tfd, fd->data_location + (fd->chans * frame * fd->bytes_per_sample), SEEK_SET));
+}
+
+
+
+/* ---------------- mulaw/alaw conversions ----------------
+ *
+ * x : input signal with max value 32767
+ * mu : compression parameter (mu = 255 used for telephony)
+ * y = (32767/log(1+mu))*log(1+mu*abs(x)/32767)*sign(x); -- this isn't right -- typo?
+ */
+
+/* from sox g711.c */
+#define QUANT_MASK (0xf) /* Quantization field mask. */
+#define SEG_SHIFT (4) /* Left shift for segment number. */
+
+static short seg_end[8] = {0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF};
+
+static int search(int val, short *table, int size)
+{
+ int i;
+ for (i = 0; i < size; i++) {if (val <= *table++) return (i);}
+ return (size);
+}
+
+static unsigned char to_alaw(int pcm_val)
+{
+ int mask, seg;
+ if (pcm_val >= 0) mask = 0xD5; else {mask = 0x55; pcm_val = -pcm_val - 8;}
+ seg = search(pcm_val, seg_end, 8);
+ if (seg >= 8) return (0x7F ^ mask);
+ else
+ {
+ unsigned char aval;
+ aval = seg << SEG_SHIFT;
+ if (seg < 2) aval |= (pcm_val >> 4) & QUANT_MASK; else aval |= (pcm_val >> (seg + 3)) & QUANT_MASK;
+ return (aval ^ mask);
+ }
+}
+
+static const int alaw[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
+};
+
+#define BIAS (0x84) /* Bias for linear code. */
+
+static unsigned char to_mulaw(int pcm_val)
+{
+ int mask;
+ int seg;
+ if (pcm_val < 0) {pcm_val = BIAS - pcm_val; mask = 0x7F;} else {pcm_val += BIAS; mask = 0xFF;}
+ seg = search(pcm_val, seg_end, 8);
+ if (seg >= 8) return (0x7F ^ mask);
+ else
+ {
+ unsigned char uval;
+ uval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0xF);
+ return (uval ^ mask);
+ }
+}
+
+/* generated by SNDiMulaw on a NeXT */
+static const int mulaw[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};
+
+
+
+/* ---------------- read ---------------- */
+
+#define BUFLIM (64 * 1024)
+
+#if SNDLIB_USE_FLOATS
+ #define MUS_SAMPLE_UNSCALED(n) ((n) / 32768.0)
+#else
+ #define MUS_SAMPLE_UNSCALED(n) ((n) * (1 << (MUS_SAMPLE_BITS - 16)))
+#endif
+
+static int mus_read_any_1(int tfd, int beg, int chans, int nints, mus_sample_t **bufs, mus_sample_t **cm, char *inbuf)
+{
+ int loclim;
+ io_fd *fd;
+ int bytes, j, lim, siz, total, leftover, total_read, k, loc, oldloc, siz_chans, buflim, format;
+ unsigned char *jchar;
+ char *charbuf = NULL;
+ mus_sample_t *buffer;
+ float prescaling;
+ bool from_buffer = false;
+ if (nints <= 0) return(0);
+ if (inbuf) from_buffer = true;
+ if (!from_buffer)
+ {
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL))
+ return(mus_error(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED, "mus_read: no file descriptors!"));
+ fd = io_fds[tfd];
+ if (fd->data_format == MUS_UNKNOWN)
+ return(mus_error(MUS_FILE_CLOSED, "mus_read: invalid data format for %s", fd->name));
+ format = fd->data_format;
+ siz = fd->bytes_per_sample;
+ if ((format == MUS_OUT_FORMAT) &&
+ (chans == 1) &&
+ (beg == 0)
+#if SNDLIB_USE_FLOATS
+ && (fd->prescaler == 1.0)
+#endif
+ )
+ {
+ bytes = nints * siz;
+ total = read(tfd, (char *)(bufs[0]), bytes);
+ if (total != bytes)
+ {
+ if (total <= 0)
+ memset((void *)(bufs[0]), 0, bytes);
+ else
+ {
+ int i, last;
+ last = beg + nints;
+ for (i = total / siz; i < last; i++)
+ bufs[0][i] = MUS_SAMPLE_0;
+ }
+ }
+ return(total / siz);
+ }
+
+ prescaling = (float)(fd->prescaler * MUS_FLOAT_TO_SAMPLE(1.0));
+ /* not MUS_FLOAT_TO_SAMPLE(fd->prescaler) here because there's a possible cast to int which can overflow */
+
+ charbuf = (char *)CALLOC(BUFLIM, sizeof(char));
+ if (charbuf == NULL)
+ return(mus_error(MUS_MEMORY_ALLOCATION_FAILED, "mus_read: IO buffer allocation failed"));
+ }
+ else
+ {
+ charbuf = inbuf;
+ siz = mus_bytes_per_sample(tfd);
+ prescaling = (float)(MUS_FLOAT_TO_SAMPLE(1.0));
+ format = tfd;
+ }
+ siz_chans = siz * chans;
+ leftover = (nints * siz_chans);
+ k = (BUFLIM) % siz_chans;
+ if (k != 0) /* for example, 3 channel output of 1-byte (mulaw) samples will need a mod 3 buffer */
+ buflim = (BUFLIM) - k;
+ else buflim = BUFLIM;
+ total_read = 0;
+ loc = beg;
+ while (leftover > 0)
+ {
+ bytes = leftover;
+ if (bytes > buflim)
+ {
+ leftover = (bytes - buflim);
+ bytes = buflim;
+ }
+ else leftover = 0;
+ if (!from_buffer)
+ {
+ total = read(tfd, charbuf, bytes);
+ if (total <= 0)
+ {
+ /* zero out trailing section (some callers don't check the returned value) -- this added 9-May-99 */
+
+ lim = beg + nints;
+ if (loc < lim)
+ for (k = 0; k < chans; k++)
+ if ((cm == NULL) || (cm[k]))
+ {
+ if (loc == 0)
+ memset((void *)(bufs[k]), 0, lim * sizeof(mus_sample_t));
+ else
+ for (j = loc; j < lim; j++)
+ bufs[k][j] = MUS_SAMPLE_0;
+ }
+ FREE(charbuf);
+ return(total_read);
+ }
+ lim = (int) (total / siz_chans); /* this divide must be exact (hence the buflim calc above) */
+ }
+ else
+ {
+ lim = nints; /* frames in this case */
+ leftover = 0;
+ }
+ total_read += lim;
+ oldloc = loc;
+
+ for (k = 0; k < chans; k++)
+ {
+ if ((cm == NULL) || (cm[k]))
+ {
+ buffer = (mus_sample_t *)(bufs[k]);
+ if (buffer)
+ {
+ loc = oldloc;
+ loclim = loc + lim;
+ jchar = (unsigned char *)charbuf;
+ jchar += (k * siz);
+ switch (format)
+ {
+ case MUS_BSHORT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_SHORT_TO_SAMPLE(m_big_endian_short(jchar));
+ break;
+ case MUS_LSHORT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_SHORT_TO_SAMPLE(m_little_endian_short(jchar));
+ break;
+ case MUS_BINT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_INT_TO_SAMPLE(m_big_endian_int(jchar));
+ break;
+ case MUS_LINT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_INT_TO_SAMPLE(m_little_endian_int(jchar));
+ break;
+ case MUS_BINTN:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_INT_TO_SAMPLE((m_big_endian_int(jchar) >> (32 - MUS_SAMPLE_BITS)));
+ break;
+ case MUS_LINTN:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_INT_TO_SAMPLE((m_little_endian_int(jchar) >> (32 - MUS_SAMPLE_BITS)));
+ break;
+ case MUS_MULAW:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_SHORT_TO_SAMPLE(mulaw[*jchar]);
+ break;
+ case MUS_ALAW:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_SHORT_TO_SAMPLE(alaw[*jchar]);
+ break;
+ case MUS_BYTE:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_BYTE_TO_SAMPLE((signed char)(*jchar));
+ break;
+ case MUS_UBYTE:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_BYTE_TO_SAMPLE((int)(*jchar) - 128);
+ break;
+ case MUS_BFLOAT:
+ if (prescaling == 1.0)
+ {
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (m_big_endian_float(jchar));
+ }
+ else
+ {
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (prescaling * (m_big_endian_float(jchar)));
+ }
+ break;
+ case MUS_BFLOAT_UNSCALED:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (MUS_SAMPLE_UNSCALED(m_big_endian_float(jchar)));
+ break;
+ case MUS_BDOUBLE:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (prescaling * (m_big_endian_double(jchar)));
+ break;
+ case MUS_BDOUBLE_UNSCALED:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (MUS_SAMPLE_UNSCALED(m_big_endian_double(jchar)));
+ break;
+ case MUS_LFLOAT:
+ if (prescaling == 1.0)
+ {
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (m_little_endian_float(jchar));
+ }
+ else
+ {
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (prescaling * (m_little_endian_float(jchar)));
+ }
+ break;
+ case MUS_LFLOAT_UNSCALED:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (MUS_SAMPLE_UNSCALED(m_little_endian_float(jchar)));
+ break;
+ case MUS_LDOUBLE:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (prescaling * (m_little_endian_double(jchar)));
+ break;
+ case MUS_LDOUBLE_UNSCALED:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = (mus_sample_t) (MUS_SAMPLE_UNSCALED(m_little_endian_double(jchar)));
+ break;
+ case MUS_UBSHORT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_SHORT_TO_SAMPLE((int)(m_big_endian_unsigned_short(jchar)) - 32768);
+ break;
+ case MUS_ULSHORT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_SHORT_TO_SAMPLE((int)(m_little_endian_unsigned_short(jchar)) - 32768);
+ break;
+ case MUS_B24INT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_INT24_TO_SAMPLE((int)(((jchar[0] << 24) +
+ (jchar[1] << 16) +
+ (jchar[2] << 8)) >> 8));
+ break;
+ case MUS_L24INT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ buffer[loc] = MUS_INT24_TO_SAMPLE((int)(((jchar[2] << 24) +
+ (jchar[1] << 16) +
+ (jchar[0] << 8)) >> 8));
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!from_buffer) FREE(charbuf);
+ return(total_read);
+}
+
+int mus_file_read_any(int tfd, int beg, int chans, int nints, mus_sample_t **bufs, mus_sample_t **cm)
+{
+ return(mus_read_any_1(tfd, beg, chans, nints, bufs, cm, NULL));
+}
+
+int mus_file_read_file(int tfd, int beg, int chans, int nints, mus_sample_t **bufs)
+{
+ return(mus_read_any_1(tfd, beg, chans, nints, bufs, NULL, NULL));
+}
+
+int mus_file_read_buffer(int charbuf_data_format, int beg, int chans, int nints, mus_sample_t **bufs, char *charbuf)
+{
+ return(mus_read_any_1(charbuf_data_format, beg, chans, nints, bufs, NULL, charbuf));
+}
+
+int mus_file_read(int tfd, int beg, int end, int chans, mus_sample_t **bufs)
+{
+ int num, rtn, i, k;
+ num = (end - beg + 1);
+ rtn = mus_read_any_1(tfd, beg, chans, num, bufs, NULL, NULL);
+ if (rtn == MUS_ERROR) return(MUS_ERROR);
+ if (rtn < num)
+ /* this zeroing can be fooled if the file is chunked and has trailing, non-data chunks */
+ for (k = 0; k < chans; k++)
+ {
+ mus_sample_t *buffer;
+ buffer = bufs[k];
+ i = rtn + beg;
+ /* this happens routinely in mus_outa + initial write (reads ahead in effect) */
+ memset((void *)(buffer + i), 0, (end - i + 1) * sizeof(mus_sample_t));
+ }
+ return(num);
+}
+
+int mus_file_read_chans(int tfd, int beg, int end, int chans, mus_sample_t **bufs, mus_sample_t **cm)
+{
+ /* an optimization of mus_file_read -- just reads the desired channels */
+ int num, rtn, i, k;
+ num = (end - beg + 1);
+ rtn = mus_read_any_1(tfd, beg, chans, num, bufs, cm, NULL);
+ if (rtn == MUS_ERROR) return(MUS_ERROR);
+ if (rtn < num)
+ for (k = 0; k < chans; k++)
+ if ((cm == NULL) || (cm[k]))
+ {
+ mus_sample_t *buffer;
+ buffer = bufs[k];
+ i = rtn + beg;
+ memset((void *)(buffer + i), 0, (end - i + 1) * sizeof(mus_sample_t));
+ }
+ return(num);
+}
+
+
+/* ---------------- write ---------------- */
+
+static int checked_write(int tfd, char *buf, int chars)
+{
+ int bytes;
+ bytes = write(tfd, buf, chars);
+ if (bytes != chars)
+ {
+ io_fd *fd;
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL))
+ return(mus_error(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED, "mus_write: no file descriptors!"));
+ fd = io_fds[tfd];
+ if (fd->data_format == MUS_UNKNOWN)
+ return(mus_error(MUS_FILE_CLOSED,
+ "attempt to write closed file %s",
+ fd->name));
+ else
+ return(mus_error(MUS_WRITE_ERROR,
+ "mus_write: write error for %s%s%s: only %d of %d bytes written",
+ fd->name, (errno) ? ": " : "", (errno) ? STRERROR(errno) : "",
+ bytes, chars));
+ }
+ return(MUS_NO_ERROR);
+}
+
+static int mus_write_1(int tfd, int beg, int end, int chans, mus_sample_t **bufs, char *inbuf, bool clipped)
+{
+ int loclim, c3;
+ int err;
+ io_fd *fd;
+ int bytes, j, k, lim, siz, leftover, loc, bk, val, oldloc, buflim, siz_chans, cliploc, data_format;
+ bool clipping = false;
+ unsigned char *jchar;
+ char *charbuf = NULL;
+ bool to_buffer = false;
+ mus_sample_t *buffer;
+ if (chans <= 0) return(0);
+ if (inbuf) to_buffer = true;
+ if (!to_buffer)
+ {
+ if ((io_fds == NULL) || (tfd >= io_fd_size) || (tfd < 0) || (io_fds[tfd] == NULL))
+ return(mus_error(MUS_FILE_DESCRIPTORS_NOT_INITIALIZED, "mus_write: no file descriptors!"));
+ fd = io_fds[tfd];
+ if (fd->data_format == MUS_UNKNOWN)
+ return(mus_error(MUS_FILE_CLOSED, "mus_write: invalid data format for %s", fd->name));
+
+ siz = fd->bytes_per_sample;
+ data_format = fd->data_format;
+ clipping = fd->clipping;
+
+ if ((data_format == MUS_OUT_FORMAT) && (chans == 1) && (!clipping) && (beg == 0))
+ {
+ bytes = (end + 1) * siz;
+ return(checked_write(tfd, (char *)(bufs[0]), bytes));
+ }
+ charbuf = (char *)CALLOC(BUFLIM, sizeof(char));
+ if (charbuf == NULL)
+ return(mus_error(MUS_MEMORY_ALLOCATION_FAILED, "mus_write: IO buffer allocation failed"));
+ }
+ else
+ {
+ charbuf = inbuf;
+ siz = mus_bytes_per_sample(tfd);
+ data_format = tfd; /* in this case, tfd is the data format (see mus_file_write_buffer below) -- this should be changed! */
+ clipping = clipped;
+ }
+ lim = (end - beg + 1);
+ siz_chans = siz * chans;
+ leftover = lim * siz_chans;
+ k = (BUFLIM) % siz_chans;
+ if (k != 0)
+ buflim = (BUFLIM) - k;
+ else buflim = BUFLIM;
+ loc = beg;
+ while (leftover > 0)
+ {
+ bytes = leftover;
+ if (bytes > buflim)
+ {
+ leftover = (bytes - buflim);
+ bytes = buflim;
+ }
+ else leftover = 0;
+ lim = (int)(bytes / siz_chans); /* see note above */
+ oldloc = loc;
+
+ for (k = 0; k < chans; k++)
+ {
+ if (bufs[k] == NULL) continue;
+ loc = oldloc;
+ buffer = (mus_sample_t *)(bufs[k]);
+ if (clipping)
+ {
+ cliploc = oldloc;
+ for (j = 0; j < lim; j++, cliploc++)
+ if (buffer[cliploc] > MUS_SAMPLE_MAX)
+ buffer[cliploc] = MUS_SAMPLE_MAX;
+ else
+ if (buffer[cliploc] < MUS_SAMPLE_MIN)
+ buffer[cliploc] = MUS_SAMPLE_MIN;
+ }
+ loclim = loc + lim;
+ jchar = (unsigned char *)charbuf; /* if to_buffer we should add the loop offset here, or never loop */
+ jchar += (k * siz);
+ switch (data_format)
+ {
+ case MUS_BSHORT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_big_endian_short(jchar, MUS_SAMPLE_TO_SHORT(buffer[loc]));
+ break;
+ case MUS_LSHORT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_little_endian_short(jchar, MUS_SAMPLE_TO_SHORT(buffer[loc]));
+ break;
+ case MUS_BINT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_big_endian_int(jchar, MUS_SAMPLE_TO_INT(buffer[loc]));
+ break;
+ case MUS_LINT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_little_endian_int(jchar, MUS_SAMPLE_TO_INT(buffer[loc]));
+ break;
+ case MUS_BINTN:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_big_endian_int(jchar, MUS_SAMPLE_TO_INT(buffer[loc]) << (32 - MUS_SAMPLE_BITS));
+ break;
+ case MUS_LINTN:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_little_endian_int(jchar, MUS_SAMPLE_TO_INT(buffer[loc]) << (32 - MUS_SAMPLE_BITS));
+ break;
+ case MUS_MULAW:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ (*jchar) = to_mulaw(MUS_SAMPLE_TO_SHORT(buffer[loc]));
+ break;
+ case MUS_ALAW:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ (*jchar) = to_alaw(MUS_SAMPLE_TO_SHORT(buffer[loc]));
+ break;
+ case MUS_BYTE:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ (*((signed char *)jchar)) = MUS_SAMPLE_TO_BYTE(buffer[loc]);
+ break;
+ case MUS_UBYTE:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ (*jchar) = MUS_SAMPLE_TO_BYTE(buffer[loc]) + 128;
+ break;
+ case MUS_BFLOAT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_big_endian_float(jchar, MUS_SAMPLE_TO_FLOAT(buffer[loc]));
+ break;
+ case MUS_LFLOAT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_little_endian_float(jchar, MUS_SAMPLE_TO_FLOAT(buffer[loc]));
+ break;
+ case MUS_BDOUBLE:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_big_endian_double(jchar, MUS_SAMPLE_TO_DOUBLE(buffer[loc]));
+ break;
+ case MUS_LDOUBLE:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_little_endian_double(jchar, MUS_SAMPLE_TO_DOUBLE(buffer[loc]));
+ break;
+ case MUS_BFLOAT_UNSCALED:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_big_endian_float(jchar, 32768.0 * MUS_SAMPLE_TO_FLOAT(buffer[loc]));
+ break;
+ case MUS_LFLOAT_UNSCALED:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_little_endian_float(jchar, 32768.0 * MUS_SAMPLE_TO_FLOAT(buffer[loc]));
+ break;
+ case MUS_BDOUBLE_UNSCALED:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_big_endian_double(jchar, 32768.0 * MUS_SAMPLE_TO_DOUBLE(buffer[loc]));
+ break;
+ case MUS_LDOUBLE_UNSCALED:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_little_endian_double(jchar, 32768.0 * MUS_SAMPLE_TO_DOUBLE(buffer[loc]));
+ break;
+ case MUS_UBSHORT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_big_endian_unsigned_short(jchar, (unsigned short)(MUS_SAMPLE_TO_SHORT(buffer[loc]) + 32768));
+ break;
+ case MUS_ULSHORT:
+ for (; loc < loclim; loc++, jchar += siz_chans)
+ m_set_little_endian_unsigned_short(jchar, (unsigned short)(MUS_SAMPLE_TO_SHORT(buffer[loc]) + 32768));
+ break;
+ case MUS_B24INT:
+ bk = (k * 3);
+ c3 = chans * 3;
+ for (; loc < loclim; loc++, bk += c3)
+ {
+ val = MUS_SAMPLE_TO_INT24(buffer[loc]);
+ charbuf[bk] = (val >> 16);
+ charbuf[bk + 1] = (val >> 8);
+ charbuf[bk + 2] = (val & 0xFF);
+ }
+ break;
+ case MUS_L24INT:
+ bk = (k * 3);
+ c3 = chans * 3;
+ for (; loc < loclim; loc++, bk += c3)
+ {
+ val = MUS_SAMPLE_TO_INT24(buffer[loc]);
+ charbuf[bk + 2] = (val >> 16);
+ charbuf[bk + 1] = (val >> 8);
+ charbuf[bk] = (val & 0xFF);
+ }
+ break;
+ }
+ }
+ if (!to_buffer)
+ {
+ err = checked_write(tfd, charbuf, bytes);
+ if (err == MUS_ERROR)
+ {
+ FREE(charbuf);
+ return(MUS_ERROR);
+ }
+ }
+ }
+ if (!to_buffer) FREE(charbuf);
+ return(MUS_NO_ERROR);
+}
+
+int mus_file_write(int tfd, int beg, int end, int chans, mus_sample_t **bufs)
+{
+ return(mus_write_1(tfd, beg, end, chans, bufs, NULL, false));
+}
+
+int mus_file_write_file(int tfd, int beg, int end, int chans, mus_sample_t **bufs)
+{
+ return(mus_write_1(tfd, beg, end, chans, bufs, NULL, false));
+}
+
+int mus_file_write_buffer(int charbuf_data_format, int beg, int end, int chans, mus_sample_t **bufs, char *charbuf, bool clipped)
+{
+ return(mus_write_1(charbuf_data_format, beg, end, chans, bufs, charbuf, clipped));
+}
+
+
+/* for CLM */
+void mus_reset_io_c(void)
+{
+ io_fd_size = 0;
+ io_fds = NULL;
+ clipping_default = false;
+ prescaler_default = 1.0;
+}
+
+
+#if (!HAVE_STRDUP)
+/* this taken from libit-0.7 */
+char *strdup (const char *str)
+{
+ char *newstr;
+ newstr = (char *)malloc(strlen(str) + 1);
+ if (newstr) strcpy(newstr, str);
+ return(newstr);
+}
+#endif
+
+#if (!HAVE_FILENO)
+/* this is needed by XtAppAddInput */
+int fileno(FILE *fp)
+{
+ if (fp == stdout)
+ return(0);
+ else
+ {
+ if (fp == stdin)
+ return(1);
+ }
+ return(2);
+}
+#endif
+
+static int sndlib_strlen(const char *str)
+{
+ /* strlen(NULL) -> seg fault! */
+ if ((str) && (*str)) return(strlen(str));
+ return(0);
+}
+
+char *mus_getcwd(void)
+{
+ int i, path_max = 0;
+ char *pwd = NULL, *res = NULL;
+#if HAVE_PATHCONF
+ path_max = pathconf("/", _PC_PATH_MAX);
+#endif
+ if (path_max < 1024)
+ {
+#if defined(PATH_MAX)
+ path_max = PATH_MAX;
+#endif
+ if (path_max < 1024)
+ path_max = 1024;
+ }
+#if HAVE_GETCWD
+ for (i = path_max;; i *= 2)
+ {
+ if (pwd) FREE(pwd);
+ pwd = (char *)CALLOC(i, sizeof(char));
+ res = getcwd(pwd, i);
+ if (res) break; /* NULL is returned if failure, but what about success? should I check errno=ERANGE? */
+ }
+#else
+#if HAVE_GETWD
+ pwd = (char *)CALLOC(path_max, sizeof(char));
+ getwd(pwd);
+#endif
+#endif
+ return(pwd);
+}
+
+char *mus_expand_filename(const char *filename)
+{
+ /* fill out under-specified library pathnames etc */
+#if defined(MUS_WINDOZE) && (!(defined(__CYGWIN__)))
+ return(strdup(filename));
+#else
+ char *file_name_buf = NULL;
+ char *tok = NULL, *orig = NULL;
+ int i, j = 0, len = 0;
+ if ((filename) && (*filename))
+ len = strlen(filename);
+ else return(NULL);
+ if (len == 0) return(NULL);
+ orig = strdup(filename);
+ tok = orig;
+ /* get rid of "//" */
+ for (i = 0; i < len - 1; i++)
+ {
+ if ((tok[i] == '/') &&
+ (tok[i + 1] == '/'))
+ j = i + 1;
+ }
+ if (j > 0)
+ {
+ for (i = 0; j < len; i++, j++)
+ tok[i] = tok[j];
+ tok[i] ='\0';
+ }
+ /* get rid of "~/" at start */
+ if (tok[0] != '/')
+ {
+ char *home = NULL;
+ if ((tok[0] == '~') && (home = getenv("HOME")))
+ {
+ file_name_buf = (char *)CALLOC(len + sndlib_strlen(home) + 8, sizeof(char));
+ strcpy(file_name_buf, home);
+ strcat(file_name_buf, ++tok);
+ }
+ else
+ {
+ char *pwd;
+ pwd = mus_getcwd();
+ file_name_buf = (char *)CALLOC(len + sndlib_strlen(pwd) + 8, sizeof(char));
+ strcpy(file_name_buf, pwd);
+ FREE(pwd);
+ strcat(file_name_buf, "/");
+ if (tok[0])
+ strcat(file_name_buf, tok);
+ }
+ }
+ else
+ {
+ file_name_buf = (char *)CALLOC(len + 8, sizeof(char));
+ strcpy(file_name_buf, tok);
+ }
+ /* get rid of "/../" and "/./" also "/." at end */
+ {
+ int slash_at = -1;
+ bool found_one = true;
+ while (found_one)
+ {
+ found_one = false;
+ len = strlen(file_name_buf);
+ for (i = 0; i < len - 3; i++)
+ if (file_name_buf[i] == '/')
+ {
+ if ((file_name_buf[i + 1] == '.') &&
+ (file_name_buf[i + 2] == '.') &&
+ (file_name_buf[i + 3] == '/'))
+ {
+ i += 4;
+ for (j = slash_at + 1; i < len; i++, j++)
+ file_name_buf[j] = file_name_buf[i];
+ file_name_buf[j] = '\0';
+ found_one = true;
+ break;
+ }
+ else
+ {
+ if ((file_name_buf[i + 1] == '.') &&
+ (file_name_buf[i + 2] == '/'))
+ {
+ for (j = i + 3, i = i + 1; j < len; i++, j++)
+ file_name_buf[i] = file_name_buf[j];
+ file_name_buf[i] = '\0';
+ found_one = true;
+ }
+ else slash_at = i;
+ }
+ }
+ }
+ len = strlen(file_name_buf);
+ if ((len > 1) &&
+ (file_name_buf[len - 1] == '.') &&
+ (file_name_buf[len - 2] == '/'))
+ file_name_buf[len - 1] = '\0';
+ }
+ free(orig);
+ return(file_name_buf);
+#endif
+}
+
+
+void mus_snprintf(char *buffer, int buffer_len, const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+#if HAVE_VSNPRINTF
+ vsnprintf(buffer, buffer_len, format, ap);
+#else
+ vsprintf(buffer, format, ap);
+#endif
+ va_end(ap);
+}
+
+#define MUS_FORMAT_STRING_MAX 1024
+
+char *mus_format(const char *format, ...)
+{
+ /* caller should free result */
+ char *buf = NULL, *rtn = NULL;
+ va_list ap;
+ buf = (char *)CALLOC(MUS_FORMAT_STRING_MAX, sizeof(char));
+ va_start(ap, format);
+#if HAVE_VSNPRINTF
+ vsnprintf(buf, MUS_FORMAT_STRING_MAX, format, ap);
+#else
+ vsprintf(buf, format, ap);
+#endif
+ va_end(ap);
+#if MUS_DEBUGGING
+ rtn = copy_string(buf);
+#else
+ rtn = strdup(buf);
+#endif
+ FREE(buf);
+ return(rtn);
+}
+
+Float mus_fclamp(Float lo, Float val, Float hi)
+{
+ if (val > hi)
+ return(hi);
+ else
+ if (val < lo)
+ return(lo);
+ else return(val);
+}
+
+int mus_iclamp(int lo, int val, int hi)
+{
+ if (val > hi)
+ return(hi);
+ else
+ if (val < lo)
+ return(lo);
+ else return(val);
+}
+
+off_t mus_oclamp(off_t lo, off_t val, off_t hi)
+{
+ if (val > hi)
+ return(hi);
+ else
+ if (val < lo)
+ return(lo);
+ else return(val);
+}
diff --git a/third_party/resample/sndlib-20/makefile.in b/third_party/resample/sndlib-20/makefile.in
new file mode 100644
index 00000000..72bf7c2d
--- /dev/null
+++ b/third_party/resample/sndlib-20/makefile.in
@@ -0,0 +1,88 @@
+SHELL = /bin/sh
+top_srcdir = .
+
+INSTALL = @INSTALL@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
+bindir = @bindir@
+srcdir = @srcdir@
+mandir = @mandir@
+libdir = @libdir@
+includedir = @includedir@
+VPATH = @srcdir@
+mkinstalldirs = $(SHELL) $(srcdir)/mkinstalldirs
+
+CC = @CC@
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+
+GUILE_LIBS = @GUILE_LIBS@
+GUILE_CFLAGS = @GUILE_CFLAGS@
+AUDIO_LIB = @AUDIO_LIB@
+GSL_LIBS = @GSL_LIBS@
+GSL_FLAGS = @GSL_CFLAGS@
+
+LDSO_FLAGS = @LDSO_FLAGS@
+SO_FLAGS = @SO_FLAGS@
+SO_INSTALL = @SO_INSTALL@
+A_INSTALL = @A_INSTALL@
+SO_LD = @SO_LD@
+A_LD = @A_LD@
+A_LD_FLAGS = @A_LD_FLAGS@
+LD_FLAGS = @LD_FLAGS@
+
+.c.o:
+ $(CC) -c $(DEFS) $(CFLAGS) $(SO_FLAGS) $(GUILE_CFLAGS) $<
+
+SNDLIB_HEADERS = sndlib.h sndlib-strings.h vct.h clm.h xen.h sndlib2xen.h clm2xen.h
+SNDLIB_O_FILES = headers.o audio.o io.o sound.o xen.o vct.o clm.o sndlib2xen.o clm2xen.o midi.o
+SNDLIB_SIMPLE_O_FILES = headers.o audio.o io.o sound.o
+
+
+sndlib: $(SNDLIB_HEADERS) $(SNDLIB_O_FILES)
+ $(SO_LD) $(LDFLAGS) $(SNDLIB_O_FILES) -o sndlib.so $(LDSO_FLAGS) $(AUDIO_LIB) $(GSL_LIBS) $(GUILE_LIBS) $(LIBS)
+# $(A_LD) $(LD_FLAGS) $(LDFLAGS) $(SNDLIB_O_FILES) -o sndlib.a $(A_LD_FLAGS) $(AUDIO_LIB) $(GSL_LIBS) $(GUILE_LIBS) $(LIBS)
+ $(A_LD) $(A_LD_FLAGS) sndlib.a $(SNDLIB_O_FILES)
+
+$(SNDLIB_O_FILES): $(SNDLIB_HEADERS)
+
+clean:
+ rm -f $(SNDLIB_O_FILES)
+
+sndplay: $(SNDLIB_HEADERS) $(SNDLIB_O_FILES) sndplay.o
+ $(CC) sndplay.c -o sndplay $(SNDLIB_SIMPLE_O_FILES) $(AUDIO_LIB) $(LIBS)
+
+sndrecord: $(SNDLIB_HEADERS) $(SNDLIB_O_FILES) sndrecord.o
+ $(CC) sndrecord.c -o sndrecord $(SNDLIB_SIMPLE_O_FILES) $(AUDIO_LIB) $(LIBS)
+
+sndinfo: $(SNDLIB_HEADERS) $(SNDLIB_O_FILES) sndinfo.o
+ $(CC) sndinfo.c -o sndinfo $(SNDLIB_SIMPLE_O_FILES) $(AUDIO_LIB) $(LIBS)
+
+audinfo: $(SNDLIB_HEADERS) $(SNDLIB_O_FILES) audinfo.o
+ $(CC) audinfo.c -o audinfo $(SNDLIB_SIMPLE_O_FILES) $(AUDIO_LIB) $(LIBS)
+
+install: sndlib
+ $(mkinstalldirs) $(bindir)
+ $(mkinstalldirs) $(libdir)
+ $(mkinstalldirs) $(includedir)
+ $(SO_INSTALL) sndlib.so $(libdir)/libsndlib.so
+ $(A_INSTALL) sndlib.a $(libdir)/libsndlib.a
+ $(INSTALL) sndlib-config $(bindir)/sndlib-config
+ $(INSTALL) sndlib.h $(includedir)/sndlib.h
+
+uninstall:
+ rm -f $(libdir)/libsndlib.so
+ rm -f $(libdir)/libsndlib.a
+
+Makefile: Makefile.in config.status
+ ./config.status
+
+config.status: configure
+ ./config.status --recheck
+
+configure: configure.in
+ cd $(srcdir); autoconf
+
diff --git a/third_party/resample/sndlib-20/mus-config.h b/third_party/resample/sndlib-20/mus-config.h
new file mode 100644
index 00000000..b32abfd6
--- /dev/null
+++ b/third_party/resample/sndlib-20/mus-config.h
@@ -0,0 +1,103 @@
+/* mus-config.h. Generated from mus-config.h.in by configure. */
+#ifndef SNDLIB_CONFIG_H_LOADED
+#define SNDLIB_CONFIG_H_LOADED
+
+/* Define to `int' or something if <sys/types.h> doesn't define. */
+/* #undef mode_t */
+/* #undef pid_t */
+/* #undef size_t */
+/* #undef off_t */
+
+#define HAVE_GETCWD 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRERROR 1
+#define HAVE_ACCESS 1
+#define HAVE_VSNPRINTF 1
+#define HAVE_SNPRINTF 1
+#define HAVE_MEMMOVE 1
+#define HAVE_STRDUP 1
+#define HAVE_FILENO 1
+#define HAVE_COMPLEX_TRIG 1
+/* #undef WORDS_BIGENDIAN */
+
+#define HAVE_FCNTL_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_STDBOOL_H 1
+#define HAVE_SYS_SOUNDCARD_H 1
+/* #undef HAVE_MACHINE_SOUNDCARD_H */
+/* #undef HAVE_SYS_MIXER_H */
+/* #undef MUS_HAVE_USR_LIB_OSS */
+/* #undef MUS_HAVE_USR_LOCAL_LIB_OSS */
+/* #undef MUS_HAVE_OPT_OSS */
+/* #undef MUS_HAVE_VAR_LIB_OSS */
+/* #undef HAVE_LIBC_H */
+#define HAVE_ALSA_ASOUNDLIB_H 1
+#define HAVE_BYTESWAP_H 1
+#define HAVE_STDINT_H 1
+
+#define SIZEOF_OFF_T 8
+#define HAVE_DECL_ISNAN 1
+#define HAVE_DECL_ISINF 1
+
+#define MUS_LINUX 1
+/* #undef MUS_SGI */
+/* #undef MUS_ALPHA */
+/* #undef MUS_SUN */
+/* #undef MUS_OPENBSD */
+/* #undef MUS_NETBSD */
+/* #undef MUS_WINDOZE */
+#define HAVE_OSS 1
+/* #undef HAVE_ALSA */
+/* #undef HAVE_JACK */
+/* #undef HAVE_SAM_9407 */
+/* #undef MUS_MAC_OSX */
+/* #undef MUS_ESD */
+/* #undef MUS_HPUX */
+
+#define HAVE_GUILE 0
+/* #undef HAVE_SCHEME */
+/* #undef HAVE_RUBY */
+/* #undef HAVE_FORTH */
+/* #undef HAVE_GAUCHE */
+#define HAVE_EXTENSION_LANGUAGE 0
+/* #undef SND_CONFIG_GET_ID_ARGS */
+#define Float float
+#define _FILE_OFFSET_BITS 64
+/* #undef _LARGE_FILES */
+/* #undef HAVE_GSL */
+#define SNDLIB_USE_FLOATS 0
+#define MUS_SAMPLE_BITS 24
+/* #undef MUS_ESD_VERSION */
+/* #undef MUS_AUDIOFILE_VERSION */
+/* #undef HAVE_READLINE */
+/* #undef HAVE_APPLICABLE_SMOB */
+/* #undef HAVE_SCM_REMEMBER_UPTO_HERE */
+/* #undef HAVE_SCM_MAKE_REAL */
+/* #undef HAVE_SCM_OBJECT_TO_STRING */
+/* #undef HAVE_SCM_NUM2LONG_LONG */
+/* #undef HAVE_SCM_C_MAKE_VECTOR */
+/* #undef HAVE_SCM_C_DEFINE */
+/* #undef HAVE_SCM_C_DEFINE_GSUBR */
+/* #undef HAVE_SCM_C_EVAL_STRING */
+/* #undef HAVE_SCM_NUM2INT */
+/* #undef HAVE_SCM_LIST_N */
+/* #undef HAVE_SCM_STR2SYMBOL */
+/* #undef HAVE_SCM_T_CATCH_BODY */
+/* #undef HAVE_SCM_TO_SIGNED_INTEGER */
+/* #undef HAVE_SCM_C_MAKE_RECTANGULAR */
+/* #undef HAVE_SCM_CAR */
+/* #undef HAVE_SCM_FROM_LOCALE_KEYWORD */
+/* #undef HAVE_SCM_IS_VECTOR */
+/* #undef HAVE_SCM_IS_SIMPLE_VECTOR */
+/* #undef HAVE_RB_GC_DISABLE */
+/* #undef HAVE_RB_ARY_DUP */
+/* #undef WITH_MODULES */
+/* #undef HAVE_KAUDIODEVICEPROPERTYTRANSPORTTYPE */
+/* #undef HAVE_KLINEARPCMFORMATFLAGISNONINTERLEAVED */
+/* #undef WITH_HOBBIT */
+
+#define MUS_OUT_FORMAT MUS_LFLOAT
+#define USE_SND 0
+#endif
diff --git a/third_party/resample/sndlib-20/sndins/Makefile.in b/third_party/resample/sndlib-20/sndins/Makefile.in
new file mode 100644
index 00000000..1c2837c2
--- /dev/null
+++ b/third_party/resample/sndlib-20/sndins/Makefile.in
@@ -0,0 +1,61 @@
+# Makefile for libsndins.so
+
+prefix = @prefix@
+srcdir = @srcdir@
+libdir = $(prefix)/lib
+top_builddir = ..
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+includedir = @includedir@
+SHELL = @SHELL@
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+
+CC = @CC@
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@ -fPIC
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+XEN_CFLAGS = @GUILE_CFLAGS@
+XEN_LIBS = @GUILE_LIBS@
+GSL_FLAGS = @GSL_CFLAGS@
+GSL_LIBS = @GSL_LIBS@
+
+INSTALL = @INSTALL@
+SO_INSTALL = @SO_INSTALL@
+SO_LD = @SO_LD@
+A_LD = ar
+A_LD_FLAGS = cr
+LD_FLAGS = @LD_FLAGS@
+LDSO_FLAGS = @LDSO_FLAGS@
+
+OBJS = sndins.o $(top_builddir)/sndlib.a
+SO_TARGET = libsndins.so
+A_TARGET = libsndins.a
+LIB_TARGET = sndins.so
+
+.c.o:
+ $(CC) -c $(DEFS) $(CFLAGS) $(XEN_CFLAGS) $(GSL_FLAGS) -I$(top_builddir) -I$(top_srcdir) $<
+
+sndins: $(OBJS)
+ $(SO_LD) $(LDSO_FLAGS) $(LDFLAGS) -o $(SO_TARGET) $(OBJS) $(XEN_LIBS) $(GSL_LIBS) $(LIBS)
+ $(A_LD) $(A_LD_FLAGS) $(A_TARGET) $(OBJS)
+ ranlib $(A_TARGET)
+ cp $(SO_TARGET) $(LIB_TARGET)
+
+install: sndins
+ $(mkinstalldirs) $(libdir)
+ $(mkinstalldirs) $(includedir)
+ $(INSTALL) $(A_TARGET) $(libdir)/$(A_TARGET)
+ $(SO_INSTALL) $(SO_TARGET) $(libdir)/$(SO_TARGET)
+
+uninstall:
+ rm -f $(libdir)/$(A_TARGET)
+ rm -f $(libdir)/$(SO_TARGET)
+
+clean:
+ rm -f *.so *.a *.o *.core core 0
+
+distclean: clean
+ rm -f Makefile *~
+
+# Makefile ends here
diff --git a/third_party/resample/sndlib-20/sndlib-strings.h b/third_party/resample/sndlib-20/sndlib-strings.h
new file mode 100644
index 00000000..ce35b49d
--- /dev/null
+++ b/third_party/resample/sndlib-20/sndlib-strings.h
@@ -0,0 +1,150 @@
+#ifndef SNDLIB_STRINGS_H
+#define SNDLIB_STRINGS_H
+
+#define S_array_to_file "array->file"
+#define S_file_to_array "file->array"
+#define S_make_sound_data "make-sound-data"
+#define S_mus_aifc "mus-aifc"
+#define S_mus_aiff "mus-aiff"
+#define S_mus_alaw "mus-alaw"
+#define S_mus_alsa_buffer_size "mus-alsa-buffer-size"
+#define S_mus_alsa_buffers "mus-alsa-buffers"
+#define S_mus_alsa_capture_device "mus-alsa-capture-device"
+#define S_mus_alsa_device "mus-alsa-device"
+#define S_mus_alsa_playback_device "mus-alsa-playback-device"
+#define S_mus_alsa_squelch_warning "mus-alsa-squelch-warning"
+#define S_mus_audio_adat_in "mus-audio-adat-in"
+#define S_mus_audio_adat_out "mus-audio-adat-out"
+#define S_mus_audio_aes_in "mus-audio-aes-in"
+#define S_mus_audio_aes_out "mus-audio-aes-out"
+#define S_mus_audio_amp "mus-audio-amp"
+#define S_mus_audio_aux_input "mus-audio-aux-input"
+#define S_mus_audio_aux_output "mus-audio-aux-output"
+#define S_mus_audio_bass "mus-audio-bass"
+#define S_mus_audio_cd "mus-audio-cd"
+#define S_mus_audio_channel "mus-audio-channel"
+#define S_mus_audio_close "mus-audio-close"
+#define S_mus_audio_dac_filter "mus-audio-dac-filter"
+#define S_mus_audio_dac_out "mus-audio-dac-out"
+#define S_mus_audio_default "mus-audio-default"
+#define S_mus_audio_digital_in "mus-audio-digital-in"
+#define S_mus_audio_digital_out "mus-audio-digital-out"
+#define S_mus_audio_direction "mus-audio-direction"
+#define S_mus_audio_duplex_default "mus-audio-duplex-default"
+#define S_mus_audio_format "mus-audio-format"
+#define S_mus_audio_igain "mus-audio-igain"
+#define S_mus_audio_imix "mus-audio-imix"
+#define S_mus_audio_line "mus-audio-line"
+#define S_mus_audio_line1 "mus-audio-line1"
+#define S_mus_audio_line2 "mus-audio-line2"
+#define S_mus_audio_line3 "mus-audio-line3"
+#define S_mus_audio_line_in "mus-audio-line-in"
+#define S_mus_audio_line_out "mus-audio-line-out"
+#define S_mus_audio_microphone "mus-audio-microphone"
+#define S_mus_audio_mixer "mus-audio-mixer"
+#define S_mus_audio_mixer_read "mus-audio-mixer-read"
+#define S_mus_audio_mixer_write "mus-audio-mixer-write"
+#define S_mus_audio_ogain "mus-audio-ogain"
+#define S_mus_audio_open_input "mus-audio-open-input"
+#define S_mus_audio_open_output "mus-audio-open-output"
+#define S_mus_audio_pcm "mus-audio-pcm"
+#define S_mus_audio_pcm2 "mus-audio-pcm2"
+#define S_mus_audio_port "mus-audio-port"
+#define S_mus_audio_read "mus-audio-read"
+#define S_mus_audio_reclev "mus-audio-reclev"
+#define S_mus_audio_report "mus-audio-report"
+#define S_mus_audio_samples_per_channel "mus-audio-samples-per-channel"
+#define S_mus_audio_spdif_in "mus-audio-spdif-in"
+#define S_mus_audio_spdif_out "mus-audio-spdif-out"
+#define S_mus_audio_speakers "mus-audio-speakers"
+#define S_mus_audio_srate "mus-audio-srate"
+#define S_mus_audio_synth "mus-audio-synth"
+#define S_mus_audio_systems "mus-audio-systems"
+#define S_mus_audio_treble "mus-audio-treble"
+#define S_mus_audio_write "mus-audio-write"
+#define S_mus_b24int "mus-b24int"
+#define S_mus_bdouble "mus-bdouble"
+#define S_mus_bdouble_unscaled "mus-bdouble-unscaled"
+#define S_mus_bfloat "mus-bfloat"
+#define S_mus_bfloat_unscaled "mus-bfloat-unscaled"
+#define S_mus_bicsf "mus-bicsf"
+#define S_mus_bint "mus-bint"
+#define S_mus_bintn "mus-bintn"
+#define S_mus_bshort "mus-bshort"
+#define S_mus_byte "mus-byte"
+#define S_mus_bytes_per_sample "mus-bytes-per-sample"
+#define S_mus_clipping "mus-clipping"
+#define S_mus_data_format_name "mus-data-format-name"
+#define S_mus_data_format_to_string "mus-data-format->string"
+#define S_mus_error_type_to_string "mus-error-type->string"
+#define S_mus_expand_filename "mus-expand-filename"
+#define S_mus_file_clipping "mus-file-clipping"
+#define S_mus_file_prescaler "mus-file-prescaler"
+#define S_mus_header_raw_defaults "mus-header-raw-defaults"
+#define S_mus_header_type_name "mus-header-type-name"
+#define S_mus_header_type_to_string "mus-header-type->string"
+#define S_mus_ircam "mus-ircam"
+#define S_mus_l24int "mus-l24int"
+#define S_mus_ldouble "mus-ldouble"
+#define S_mus_ldouble_unscaled "mus-ldouble-unscaled"
+#define S_mus_lfloat "mus-lfloat"
+#define S_mus_lfloat_unscaled "mus-lfloat-unscaled"
+#define S_mus_lint "mus-lint"
+#define S_mus_lintn "mus-lintn"
+#define S_mus_lshort "mus-lshort"
+#define S_mus_mulaw "mus-mulaw"
+#define S_mus_netbsd_set_outputs "mus-netbsd-set-outputs"
+#define S_mus_next "mus-next"
+#define S_mus_nist "mus-nist"
+#define S_mus_oss_set_buffers "mus-oss-set-buffers"
+#define S_mus_out_format "mus-out-format"
+#define S_mus_prescaler "mus-prescaler"
+#define S_mus_raw "mus-raw"
+#define S_mus_riff "mus-riff"
+#define S_mus_sound_chans "mus-sound-chans"
+#define S_mus_sound_close_input "mus-sound-close-input"
+#define S_mus_sound_close_output "mus-sound-close-output"
+#define S_mus_sound_comment "mus-sound-comment"
+#define S_mus_sound_data_format "mus-sound-data-format"
+#define S_mus_sound_data_location "mus-sound-data-location"
+#define S_mus_sound_datum_size "mus-sound-datum-size"
+#define S_mus_sound_duration "mus-sound-duration"
+#define S_mus_sound_forget "mus-sound-forget"
+#define S_mus_sound_frames "mus-sound-frames"
+#define S_mus_sound_header_type "mus-sound-header-type"
+#define S_mus_sound_length "mus-sound-length"
+#define S_mus_sound_loop_info "mus-sound-loop-info"
+#define S_mus_sound_maxamp "mus-sound-maxamp"
+#define S_mus_sound_maxamp_exists "mus-sound-maxamp-exists?"
+#define S_mus_sound_open_input "mus-sound-open-input"
+#define S_mus_sound_open_output "mus-sound-open-output"
+#define S_mus_sound_prune "mus-sound-prune"
+#define S_mus_sound_read "mus-sound-read"
+#define S_mus_sound_reopen_output "mus-sound-reopen-output"
+#define S_mus_sound_report_cache "mus-sound-report-cache"
+#define S_mus_sound_samples "mus-sound-samples"
+#define S_mus_sound_seek_frame "mus-sound-seek-frame"
+#define S_mus_sound_srate "mus-sound-srate"
+#define S_mus_sound_type_specifier "mus-sound-type-specifier"
+#define S_mus_sound_write "mus-sound-write"
+#define S_mus_sound_write_date "mus-sound-write-date"
+#define S_mus_soundfont "mus-soundfont"
+#define S_mus_sun_set_outputs "mus-sun-set-outputs"
+#define S_mus_svx "mus-svx"
+#define S_mus_ubshort "mus-ubshort"
+#define S_mus_ubyte "mus-ubyte"
+#define S_mus_ulshort "mus-ulshort"
+#define S_mus_unknown "mus-unknown"
+#define S_mus_unsupported "mus-unsupported"
+#define S_mus_voc "mus-voc"
+#define S_new_sound_hook "new-sound-hook"
+#define S_sound_data_to_vct "sound-data->vct"
+#define S_sound_data_chans "sound-data-chans"
+#define S_sound_data_length "sound-data-length"
+#define S_sound_data_maxamp "sound-data-maxamp"
+#define S_sound_data_p "sound-data?"
+#define S_sound_data_ref "sound-data-ref"
+#define S_sound_data_setB "sound-data-set!"
+#define S_vct_to_sound_data "vct->sound-data"
+
+#endif
diff --git a/third_party/resample/sndlib-20/sndlib.h b/third_party/resample/sndlib-20/sndlib.h
new file mode 100644
index 00000000..61b749da
--- /dev/null
+++ b/third_party/resample/sndlib-20/sndlib.h
@@ -0,0 +1,457 @@
+/* sndlib.h. Generated from sndlib.h.in by configure. */
+#ifndef SNDLIB_H
+#define SNDLIB_H
+
+#define SNDLIB_VERSION 20
+#define SNDLIB_REVISION 0
+#define SNDLIB_DATE "28-Mar-06"
+
+#include <stdio.h>
+
+/* these are picked up during configuration */
+
+#define MUS_LITTLE_ENDIAN 1
+#define SNDLIB_USE_FLOATS 0
+#define MUS_SAMPLE_BITS 24
+#define MUS_AUDIO_COMPATIBLE_FORMAT MUS_LSHORT
+#define MUS_OUT_FORMAT MUS_LFLOAT
+#define Float float
+
+#include <time.h>
+/* time_t used by mus_sound_write_date */
+#include <sys/types.h>
+/* off_t used everywhere -- should this be redefined to long if not defined in types.h? */
+
+/* not sure how to handle this one cleanly: */
+#ifndef __cplusplus
+#if HAVE_STDBOOL_H
+ #include <stdbool.h>
+#else
+#ifndef true
+ #define bool int
+ #define true 1
+ #define false 0
+#endif
+#endif
+#endif
+
+
+
+#if (!SNDLIB_USE_FLOATS)
+ #define mus_sample_t int
+ #ifndef MUS_SAMPLE_BITS
+ #define MUS_SAMPLE_BITS 24
+ #endif
+ #define MUS_SAMPLE_0 0
+ #define MUS_BYTE_TO_SAMPLE(n) ((mus_sample_t)((n) << (MUS_SAMPLE_BITS - 8)))
+ #define MUS_SAMPLE_TO_BYTE(n) ((n) >> (MUS_SAMPLE_BITS - 8))
+ #define MUS_SHORT_TO_SAMPLE(n) ((mus_sample_t)((n) << (MUS_SAMPLE_BITS - 16)))
+ #define MUS_SAMPLE_TO_SHORT(n) ((short)((n) >> (MUS_SAMPLE_BITS - 16)))
+ #if (MUS_SAMPLE_BITS < 24)
+ #define MUS_INT24_TO_SAMPLE(n) ((mus_sample_t)((n) >> (24 - MUS_SAMPLE_BITS)))
+ #define MUS_SAMPLE_TO_INT24(n) ((int)((n) << (24 - MUS_SAMPLE_BITS)))
+ #else
+ #define MUS_INT24_TO_SAMPLE(n) ((mus_sample_t)((n) << (MUS_SAMPLE_BITS - 24)))
+ #define MUS_SAMPLE_TO_INT24(n) ((int)((n) >> (MUS_SAMPLE_BITS - 24)))
+ #endif
+ #define MUS_INT_TO_SAMPLE(n) ((mus_sample_t)(n))
+ #define MUS_SAMPLE_TO_INT(n) ((int)(n))
+ /* these are for direct read/write (no cross-image assumption is made about 32 bit int scaling) */
+ #define MUS_FLOAT_TO_FIX ((MUS_SAMPLE_BITS < 32) ? (1 << (MUS_SAMPLE_BITS - 1)) : 0x7fffffff)
+ #define MUS_FIX_TO_FLOAT (1.0 / (float)(MUS_FLOAT_TO_FIX))
+ #define MUS_FLOAT_TO_SAMPLE(n) ((mus_sample_t)((n) * MUS_FLOAT_TO_FIX))
+ #define MUS_SAMPLE_TO_FLOAT(n) ((float)((n) * MUS_FIX_TO_FLOAT))
+ #define MUS_DOUBLE_TO_SAMPLE(n) ((mus_sample_t)((n) * MUS_FLOAT_TO_FIX))
+ #define MUS_SAMPLE_TO_DOUBLE(n) ((double)((n) * MUS_FIX_TO_FLOAT))
+ #define MUS_SAMPLE_MAX ((mus_sample_t)((MUS_SAMPLE_BITS < 32) ? (MUS_FLOAT_TO_FIX - 1) : 0x7fffffff))
+ #define MUS_SAMPLE_MIN ((mus_sample_t)((MUS_SAMPLE_BITS < 32) ? (-(MUS_FLOAT_TO_FIX)) : -0x7fffffff))
+ #define mus_sample_abs(Sample) abs(Sample)
+#else
+ #define mus_sample_t Float
+ #ifndef MUS_SAMPLE_BITS
+ #define MUS_SAMPLE_BITS 24
+ #endif
+ #define MUS_SAMPLE_0 0.0
+ #define MUS_BYTE_TO_SAMPLE(n) ((mus_sample_t)((Float)(n) / (Float)(1 << 7)))
+ #define MUS_SHORT_TO_SAMPLE(n) ((mus_sample_t)((Float)(n) / (Float)(1 << 15)))
+ #define MUS_INT_TO_SAMPLE(n) ((mus_sample_t)((Float)(n) / (Float)(1 << (MUS_SAMPLE_BITS - 1))))
+ #define MUS_INT24_TO_SAMPLE(n) ((mus_sample_t)((Float)(n) / (Float)(1 << 23)))
+ #define MUS_FLOAT_TO_FIX 1.0
+ #define MUS_FIX_TO_FLOAT 1.0
+ #define MUS_FLOAT_TO_SAMPLE(n) ((mus_sample_t)(n))
+ #define MUS_DOUBLE_TO_SAMPLE(n) ((mus_sample_t)(n))
+ #define MUS_SAMPLE_TO_FLOAT(n) ((Float)(n))
+ #define MUS_SAMPLE_TO_DOUBLE(n) ((double)(n))
+ #define MUS_SAMPLE_TO_INT(n) ((int)((n) * (1 << (MUS_SAMPLE_BITS - 1))))
+ #define MUS_SAMPLE_TO_INT24(n) ((int)((n) * (1 << 23)))
+ #define MUS_SAMPLE_TO_SHORT(n) ((short)((n) * (1 << 15)))
+ #define MUS_SAMPLE_TO_BYTE(n) ((char)((n) * (1 << 7)))
+ #define MUS_SAMPLE_MAX 0.99999
+ #define MUS_SAMPLE_MIN (-1.0)
+ #define mus_sample_abs(Sample) fabs(Sample)
+#endif
+
+enum {MUS_UNSUPPORTED, MUS_NEXT, MUS_AIFC, MUS_RIFF, MUS_BICSF, MUS_NIST, MUS_INRS, MUS_ESPS, MUS_SVX, MUS_VOC,
+ MUS_SNDT, MUS_RAW, MUS_SMP, MUS_AVR, MUS_IRCAM, MUS_SD1, MUS_SPPACK, MUS_MUS10, MUS_HCOM, MUS_PSION, MUS_MAUD,
+ MUS_IEEE, MUS_MATLAB, MUS_ADC, MUS_MIDI, MUS_SOUNDFONT, MUS_GRAVIS, MUS_COMDISCO, MUS_GOLDWAVE, MUS_SRFS,
+ MUS_MIDI_SAMPLE_DUMP, MUS_DIAMONDWARE, MUS_ADF, MUS_SBSTUDIOII, MUS_DELUSION,
+ MUS_FARANDOLE, MUS_SAMPLE_DUMP, MUS_ULTRATRACKER, MUS_YAMAHA_SY85, MUS_YAMAHA_TX16W, MUS_DIGIPLAYER,
+ MUS_COVOX, MUS_AVI, MUS_OMF, MUS_QUICKTIME, MUS_ASF, MUS_YAMAHA_SY99, MUS_KURZWEIL_2000,
+ MUS_AIFF, MUS_PAF, MUS_CSL, MUS_FILE_SAMP, MUS_PVF, MUS_SOUNDFORGE, MUS_TWINVQ, MUS_AKAI4,
+ MUS_IMPULSETRACKER, MUS_KORG, MUS_NVF, MUS_MAUI, MUS_SDIF, MUS_OGG, MUS_FLAC, MUS_SPEEX, MUS_MPEG,
+ MUS_SHORTEN, MUS_TTA, MUS_WAVPACK,
+ MUS_NUM_HEADER_TYPES};
+
+#if defined(__GNUC__) && (!(defined(__cplusplus)))
+ #define MUS_HEADER_TYPE_OK(n) ({ int _sndlib_h_0 = n; ((_sndlib_h_0 > MUS_UNSUPPORTED) && (_sndlib_h_0 <= MUS_MAUI)); })
+#else
+ #define MUS_HEADER_TYPE_OK(n) (((n) > MUS_UNSUPPORTED) && ((n) <= MUS_MAUI))
+#endif
+
+enum {MUS_UNKNOWN, MUS_BSHORT, MUS_MULAW, MUS_BYTE, MUS_BFLOAT, MUS_BINT, MUS_ALAW, MUS_UBYTE, MUS_B24INT,
+ MUS_BDOUBLE, MUS_LSHORT, MUS_LINT, MUS_LFLOAT, MUS_LDOUBLE, MUS_UBSHORT, MUS_ULSHORT, MUS_L24INT,
+ MUS_BINTN, MUS_LINTN, MUS_BFLOAT_UNSCALED, MUS_LFLOAT_UNSCALED, MUS_BDOUBLE_UNSCALED, MUS_LDOUBLE_UNSCALED,
+ MUS_NUM_DATA_FORMATS};
+
+/* MUS_LINTN and MUS_BINTN refer to 32 bit ints with 31 bits of "fraction" -- the data is "left justified" */
+/* "unscaled" means the float value is used directly (i.e. not as -1.0 to 1.0, but (probably) -32768.0 to 32768.0) */
+
+#if defined(__GNUC__) && (!(defined(__cplusplus)))
+ #define MUS_DATA_FORMAT_OK(n) ({ int _sndlib_h_1 = n; ((_sndlib_h_1 > MUS_UNKNOWN) && (_sndlib_h_1 < MUS_NUM_DATA_FORMATS)); })
+#else
+ #define MUS_DATA_FORMAT_OK(n) (((n) > MUS_UNKNOWN) && ((n) < MUS_NUM_DATA_FORMATS))
+#endif
+
+#define MUS_NIST_SHORTPACK 2
+#define MUS_AIFF_IMA_ADPCM 99
+
+#define MUS_AUDIO_PACK_SYSTEM(n) ((n) << 16)
+#define MUS_AUDIO_SYSTEM(n) (((n) >> 16) & 0xffff)
+#define MUS_AUDIO_DEVICE(n) ((n) & 0xffff)
+
+enum {MUS_AUDIO_DEFAULT, MUS_AUDIO_DUPLEX_DEFAULT, MUS_AUDIO_ADAT_IN, MUS_AUDIO_AES_IN, MUS_AUDIO_LINE_OUT,
+ MUS_AUDIO_LINE_IN, MUS_AUDIO_MICROPHONE, MUS_AUDIO_SPEAKERS, MUS_AUDIO_DIGITAL_IN, MUS_AUDIO_DIGITAL_OUT,
+ MUS_AUDIO_DAC_OUT, MUS_AUDIO_ADAT_OUT, MUS_AUDIO_AES_OUT, MUS_AUDIO_DAC_FILTER, MUS_AUDIO_MIXER,
+ MUS_AUDIO_LINE1, MUS_AUDIO_LINE2, MUS_AUDIO_LINE3, MUS_AUDIO_AUX_INPUT, MUS_AUDIO_CD,
+ MUS_AUDIO_AUX_OUTPUT, MUS_AUDIO_SPDIF_IN, MUS_AUDIO_SPDIF_OUT, MUS_AUDIO_AMP, MUS_AUDIO_SRATE,
+ MUS_AUDIO_CHANNEL, MUS_AUDIO_FORMAT, MUS_AUDIO_IMIX, MUS_AUDIO_IGAIN, MUS_AUDIO_RECLEV,
+ MUS_AUDIO_PCM, MUS_AUDIO_PCM2, MUS_AUDIO_OGAIN, MUS_AUDIO_LINE, MUS_AUDIO_SYNTH,
+ MUS_AUDIO_BASS, MUS_AUDIO_TREBLE, MUS_AUDIO_PORT, MUS_AUDIO_SAMPLES_PER_CHANNEL,
+ MUS_AUDIO_DIRECTION
+};
+/* Snd's recorder uses MUS_AUDIO_DIRECTION to find the size of this list */
+
+#if defined(__GNUC__) && (!(defined(__cplusplus)))
+ #define MUS_AUDIO_DEVICE_OK(a) ({ int _sndlib_h_2 = a; ((_sndlib_h_2 >= MUS_AUDIO_DEFAULT) && (_sndlib_h_2 <= MUS_AUDIO_DIRECTION)); })
+#else
+ #define MUS_AUDIO_DEVICE_OK(a) (((a) >= MUS_AUDIO_DEFAULT) && ((a) <= MUS_AUDIO_DIRECTION))
+#endif
+
+#define MUS_ERROR -1
+
+enum {MUS_NO_ERROR, MUS_NO_FREQUENCY, MUS_NO_PHASE, MUS_NO_GEN, MUS_NO_LENGTH,
+ MUS_NO_FREE, MUS_NO_DESCRIBE, MUS_NO_DATA, MUS_NO_SCALER,
+ MUS_MEMORY_ALLOCATION_FAILED, MUS_UNSTABLE_TWO_POLE_ERROR,
+ MUS_CANT_OPEN_FILE, MUS_NO_SAMPLE_INPUT, MUS_NO_SAMPLE_OUTPUT,
+ MUS_NO_SUCH_CHANNEL, MUS_NO_FILE_NAME_PROVIDED, MUS_NO_LOCATION, MUS_NO_CHANNEL,
+ MUS_NO_SUCH_FFT_WINDOW, MUS_UNSUPPORTED_DATA_FORMAT, MUS_HEADER_READ_FAILED,
+ MUS_UNSUPPORTED_HEADER_TYPE,
+ MUS_FILE_DESCRIPTORS_NOT_INITIALIZED, MUS_NOT_A_SOUND_FILE, MUS_FILE_CLOSED, MUS_WRITE_ERROR,
+ MUS_HEADER_WRITE_FAILED, MUS_CANT_OPEN_TEMP_FILE, MUS_INTERRUPTED, MUS_BAD_ENVELOPE,
+
+ MUS_AUDIO_CHANNELS_NOT_AVAILABLE, MUS_AUDIO_SRATE_NOT_AVAILABLE, MUS_AUDIO_FORMAT_NOT_AVAILABLE,
+ MUS_AUDIO_NO_INPUT_AVAILABLE, MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
+ MUS_AUDIO_NO_LINES_AVAILABLE, MUS_AUDIO_WRITE_ERROR, MUS_AUDIO_SIZE_NOT_AVAILABLE, MUS_AUDIO_DEVICE_NOT_AVAILABLE,
+ MUS_AUDIO_CANT_CLOSE, MUS_AUDIO_CANT_OPEN, MUS_AUDIO_READ_ERROR, MUS_AUDIO_AMP_NOT_AVAILABLE,
+ MUS_AUDIO_CANT_WRITE, MUS_AUDIO_CANT_READ, MUS_AUDIO_NO_READ_PERMISSION,
+ MUS_CANT_CLOSE_FILE, MUS_ARG_OUT_OF_RANGE,
+ MUS_MIDI_OPEN_ERROR, MUS_MIDI_READ_ERROR, MUS_MIDI_WRITE_ERROR, MUS_MIDI_CLOSE_ERROR, MUS_MIDI_INIT_ERROR, MUS_MIDI_MISC_ERROR,
+
+ MUS_NO_CHANNELS, MUS_NO_HOP, MUS_NO_WIDTH, MUS_NO_FILE_NAME, MUS_NO_RAMP, MUS_NO_RUN,
+ MUS_NO_INCREMENT, MUS_NO_OFFSET,
+ MUS_NO_XCOEFF, MUS_NO_YCOEFF, MUS_NO_XCOEFFS, MUS_NO_YCOEFFS, MUS_NO_RESET,
+ MUS_INITIAL_ERROR_TAG};
+
+/* keep this list in sync with mus_error_names in sound.c and snd-test.scm|rb */
+
+#define MUS_LOOP_INFO_SIZE 8
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* -------- sound.c -------- */
+
+#ifdef __GNUC__
+ int mus_error(int error, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+ void mus_print(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+ char *mus_format(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+ void mus_snprintf(char *buffer, int buffer_len, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
+#else
+ int mus_error(int error, const char *format, ...);
+ void mus_print(const char *format, ...);
+ char *mus_format(const char *format, ...);
+ void mus_snprintf(char *buffer, int buffer_len, const char *format, ...);
+#endif
+
+typedef void mus_error_handler_t(int type, char *msg);
+mus_error_handler_t *mus_error_set_handler (mus_error_handler_t *new_error_handler);
+int mus_make_error(char *error_name);
+const char *mus_error_type_to_string(int err);
+
+typedef void mus_print_handler_t(char *msg);
+mus_print_handler_t *mus_print_set_handler (mus_print_handler_t *new_print_handler);
+
+off_t mus_sound_samples(const char *arg);
+off_t mus_sound_frames(const char *arg);
+int mus_sound_datum_size(const char *arg);
+off_t mus_sound_data_location(const char *arg);
+int mus_sound_chans(const char *arg);
+int mus_sound_srate(const char *arg);
+int mus_sound_header_type(const char *arg);
+int mus_sound_data_format(const char *arg);
+int mus_sound_original_format(const char *arg);
+off_t mus_sound_comment_start(const char *arg);
+off_t mus_sound_comment_end(const char *arg);
+off_t mus_sound_length(const char *arg);
+int mus_sound_fact_samples(const char *arg);
+time_t mus_sound_write_date(const char *arg);
+int mus_sound_type_specifier(const char *arg);
+int mus_sound_block_align(const char *arg);
+int mus_sound_bits_per_sample(const char *arg);
+
+int mus_sound_set_chans(const char *arg, int val);
+int mus_sound_set_srate(const char *arg, int val);
+int mus_sound_set_header_type(const char *arg, int val);
+int mus_sound_set_data_format(const char *arg, int val);
+int mus_sound_set_data_location(const char *arg, off_t val);
+int mus_sound_set_samples(const char *arg, off_t val);
+
+const char *mus_header_type_name(int type);
+const char *mus_data_format_name(int format);
+char *mus_header_type_to_string(int type);
+char *mus_data_format_to_string(int format);
+const char *mus_data_format_short_name(int format);
+char *mus_sound_comment(const char *name);
+int mus_bytes_per_sample(int format);
+float mus_sound_duration(const char *arg);
+int mus_sound_initialize(void);
+int mus_sample_bits(void);
+int mus_sound_override_header(const char *arg, int srate, int chans, int format, int type, off_t location, off_t size);
+int mus_sound_forget(const char *name);
+int mus_sound_prune(void);
+void mus_sound_report_cache(FILE *fp);
+int *mus_sound_loop_info(const char *arg);
+void mus_sound_set_loop_info(const char *arg, int *loop);
+
+int mus_sound_open_input(const char *arg);
+int mus_sound_open_output(const char *arg, int srate, int chans, int data_format, int header_type, const char *comment);
+int mus_sound_reopen_output(const char *arg, int chans, int format, int type, off_t data_loc);
+int mus_sound_close_input(int fd);
+int mus_sound_close_output(int fd, off_t bytes_of_data);
+#define mus_sound_seek_frame(Ifd, Frm) mus_file_seek_frame(Ifd, Frm)
+#define mus_sound_read(Fd, Beg, End, Chans, Bufs) mus_file_read(Fd, Beg, End, Chans, Bufs)
+#define mus_sound_write(Fd, Beg, End, Chans, Bufs) mus_file_write(Fd, Beg, End, Chans, Bufs)
+
+off_t mus_sound_maxamps(const char *ifile, int chans, mus_sample_t *vals, off_t *times);
+int mus_sound_set_maxamps(const char *ifile, int chans, mus_sample_t *vals, off_t *times);
+bool mus_sound_maxamp_exists(const char *ifile);
+int mus_file_to_array(const char *filename, int chan, int start, int samples, mus_sample_t *array);
+int mus_array_to_file(const char *filename, mus_sample_t *ddata, int len, int srate, int channels);
+char *mus_array_to_file_with_error(const char *filename, mus_sample_t *ddata, int len, int srate, int channels);
+int mus_file_to_float_array(const char *filename, int chan, off_t start, int samples, Float *array);
+int mus_float_array_to_file(const char *filename, Float *ddata, int len, int srate, int channels);
+
+
+
+/* -------- audio.c -------- */
+
+void mus_audio_describe(void);
+char *mus_audio_report(void);
+int mus_audio_open_output(int dev, int srate, int chans, int format, int size);
+int mus_audio_open_input(int dev, int srate, int chans, int format, int size);
+int mus_audio_write(int line, char *buf, int bytes);
+int mus_audio_close(int line);
+int mus_audio_read(int line, char *buf, int bytes);
+
+int mus_audio_write_buffers(int line, int frames, int chans, mus_sample_t **bufs, int output_format, bool clipped);
+int mus_audio_read_buffers(int line, int frames, int chans, mus_sample_t **bufs, int input_format);
+
+int mus_audio_mixer_read(int dev, int field, int chan, float *val);
+int mus_audio_mixer_write(int dev, int field, int chan, float *val);
+int mus_audio_initialize(void);
+
+int mus_audio_reinitialize(void); /* 29-Aug-01 for CLM/Snd bugfix? */
+int mus_audio_systems(void);
+char *mus_audio_system_name(int sys);
+char *mus_audio_moniker(void);
+int mus_audio_api(void);
+int mus_audio_compatible_format(int dev);
+
+void mus_netbsd_set_outputs(int speakers, int headphones, int line_out);
+void mus_sun_set_outputs(int speakers, int headphones, int line_out);
+#define mus_audio_sun_outputs mus_sun_set_outputs
+
+void mus_oss_set_buffers(int num, int size);
+#define mus_audio_set_oss_buffers mus_oss_set_buffers
+
+char *mus_alsa_playback_device(void);
+char *mus_alsa_set_playback_device(const char *name);
+char *mus_alsa_capture_device(void);
+char *mus_alsa_set_capture_device(const char *name);
+char *mus_alsa_device(void);
+char *mus_alsa_set_device(const char *name);
+int mus_alsa_buffer_size(void);
+int mus_alsa_set_buffer_size(int size);
+int mus_alsa_buffers(void);
+int mus_alsa_set_buffers(int num);
+bool mus_alsa_squelch_warning(void);
+bool mus_alsa_set_squelch_warning(bool val);
+
+
+
+/* -------- io.c -------- */
+
+int mus_file_open_descriptors(int tfd, const char *arg, int df, int ds, off_t dl, int dc, int dt);
+int mus_file_open_read(const char *arg);
+bool mus_file_probe(const char *arg);
+int mus_file_open_write(const char *arg);
+int mus_file_create(const char *arg);
+int mus_file_reopen_write(const char *arg);
+int mus_file_close(int fd);
+off_t mus_file_seek_frame(int tfd, off_t frame);
+int mus_file_read(int fd, int beg, int end, int chans, mus_sample_t **bufs);
+int mus_file_read_chans(int fd, int beg, int end, int chans, mus_sample_t **bufs, mus_sample_t **cm);
+int mus_file_write(int tfd, int beg, int end, int chans, mus_sample_t **bufs);
+int mus_file_read_any(int tfd, int beg, int chans, int nints, mus_sample_t **bufs, mus_sample_t **cm);
+int mus_file_read_file(int tfd, int beg, int chans, int nints, mus_sample_t **bufs);
+int mus_file_read_buffer(int charbuf_data_format, int beg, int chans, int nints, mus_sample_t **bufs, char *charbuf);
+int mus_file_write_file(int tfd, int beg, int end, int chans, mus_sample_t **bufs);
+int mus_file_write_buffer(int charbuf_data_format, int beg, int end, int chans, mus_sample_t **bufs, char *charbuf, bool clipped);
+char *mus_expand_filename(const char *name);
+char *mus_getcwd(void);
+
+bool mus_clipping(void);
+bool mus_set_clipping(bool new_value);
+bool mus_file_clipping(int tfd);
+int mus_file_set_clipping(int tfd, bool clipped);
+
+int mus_file_set_header_type(int tfd, int type);
+int mus_file_header_type(int tfd);
+char *mus_file_fd_name(int tfd);
+int mus_file_set_chans(int tfd, int chans);
+
+Float mus_file_prescaler(int tfd);
+Float mus_file_set_prescaler(int tfd, Float val);
+Float mus_prescaler(void);
+Float mus_set_prescaler(Float new_value);
+
+void mus_bint_to_char(unsigned char *j, int x);
+int mus_char_to_bint(const unsigned char *inp);
+void mus_lint_to_char(unsigned char *j, int x);
+int mus_char_to_lint(const unsigned char *inp);
+int mus_char_to_uninterpreted_int(const unsigned char *inp);
+void mus_bfloat_to_char(unsigned char *j, float x);
+float mus_char_to_bfloat(const unsigned char *inp);
+void mus_lfloat_to_char(unsigned char *j, float x);
+float mus_char_to_lfloat(const unsigned char *inp);
+void mus_bshort_to_char(unsigned char *j, short x);
+short mus_char_to_bshort(const unsigned char *inp);
+void mus_lshort_to_char(unsigned char *j, short x);
+short mus_char_to_lshort(const unsigned char *inp);
+void mus_ubshort_to_char(unsigned char *j, unsigned short x);
+unsigned short mus_char_to_ubshort(const unsigned char *inp);
+void mus_ulshort_to_char(unsigned char *j, unsigned short x);
+unsigned short mus_char_to_ulshort(const unsigned char *inp);
+double mus_char_to_ldouble(const unsigned char *inp);
+double mus_char_to_bdouble(const unsigned char *inp);
+void mus_bdouble_to_char(unsigned char *j, double x);
+void mus_ldouble_to_char(unsigned char *j, double x);
+unsigned int mus_char_to_ubint(const unsigned char *inp);
+unsigned int mus_char_to_ulint(const unsigned char *inp);
+
+int mus_iclamp(int lo, int val, int hi);
+off_t mus_oclamp(off_t lo, off_t val, off_t hi);
+Float mus_fclamp(Float lo, Float val, Float hi);
+
+/* for CLM */
+/* these are needed to clear a saved lisp image to the just-initialized state */
+void mus_reset_io_c(void);
+void mus_reset_headers_c(void);
+void mus_reset_audio_c(void);
+
+
+
+/* -------- headers.c -------- */
+
+off_t mus_header_samples(void);
+off_t mus_header_data_location(void);
+int mus_header_chans(void);
+int mus_header_srate(void);
+int mus_header_type(void);
+int mus_header_format(void);
+off_t mus_header_comment_start(void);
+off_t mus_header_comment_end(void);
+int mus_header_type_specifier(void);
+int mus_header_bits_per_sample(void);
+int mus_header_fact_samples(void);
+int mus_header_block_align(void);
+int mus_header_loop_mode(int which);
+int mus_header_loop_start(int which);
+int mus_header_loop_end(int which);
+int mus_header_mark_position(int id);
+int mus_header_base_note(void);
+int mus_header_base_detune(void);
+void mus_header_set_raw_defaults(int sr, int chn, int frm);
+void mus_header_raw_defaults(int *sr, int *chn, int *frm);
+off_t mus_header_true_length(void);
+int mus_header_original_format(void);
+off_t mus_samples_to_bytes(int format, off_t size);
+off_t mus_bytes_to_samples(int format, off_t size);
+int mus_header_write_next_header(int chan, int srate, int chans, int loc, int siz, int format, const char *comment, int len);
+int mus_header_read(const char *name);
+int mus_header_write(const char *name, int type, int srate, int chans, off_t loc, off_t size_in_samples, int format, const char *comment, int len);
+off_t mus_header_aux_comment_start(int n);
+off_t mus_header_aux_comment_end(int n);
+int mus_header_initialize(void);
+bool mus_header_writable(int type, int format);
+void mus_header_set_aiff_loop_info(int *data);
+int mus_header_sf2_entries(void);
+char *mus_header_sf2_name(int n);
+int mus_header_sf2_start(int n);
+int mus_header_sf2_end(int n);
+int mus_header_sf2_loop_start(int n);
+int mus_header_sf2_loop_end(int n);
+const char *mus_header_original_format_name(int format, int type);
+bool mus_header_no_header(const char *name);
+
+char *mus_header_riff_aux_comment(const char *name, off_t *starts, off_t *ends);
+char *mus_header_aiff_aux_comment(const char *name, off_t *starts, off_t *ends);
+
+int mus_header_change_chans(const char *filename, int type, int new_chans);
+int mus_header_change_srate(const char *filename, int type, int new_srate);
+int mus_header_change_type(const char *filename, int new_type, int new_format);
+int mus_header_change_format(const char *filename, int type, int new_format);
+int mus_header_change_location(const char *filename, int type, off_t new_location);
+int mus_header_change_comment(const char *filename, int type, char *new_comment);
+int mus_header_change_data_size(const char *filename, int type, off_t bytes);
+
+typedef void mus_header_write_hook_t(const char *filename);
+mus_header_write_hook_t *mus_header_write_set_hook(mus_header_write_hook_t *new_hook);
+
+
+/* -------- midi.c -------- */
+int mus_midi_open_read(const char *name);
+int mus_midi_open_write(const char *name);
+int mus_midi_close(int line);
+int mus_midi_read(int line, unsigned char *buffer, int bytes);
+int mus_midi_write(int line, unsigned char *buffer, int bytes);
+char *mus_midi_device_name(int sysdev);
+char *mus_midi_describe(void);
+void mus_midi_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/third_party/resample/sndlib-20/sound.c b/third_party/resample/sndlib-20/sound.c
new file mode 100644
index 00000000..8443dcaa
--- /dev/null
+++ b/third_party/resample/sndlib-20/sound.c
@@ -0,0 +1,1072 @@
+/* sound.c */
+
+#include <mus-config.h>
+
+#if USE_SND
+ #include "snd.h"
+#endif
+
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <stdarg.h>
+
+#if (defined(HAVE_LIBC_H) && (!defined(HAVE_UNISTD_H)))
+ #include <libc.h>
+#else
+ #if (!(defined(_MSC_VER)))
+ #include <unistd.h>
+ #endif
+ #if HAVE_STRING_H
+ #include <string.h>
+ #endif
+#endif
+
+#include "_sndlib.h"
+#include "sndlib-strings.h"
+
+static mus_error_handler_t *mus_error_handler = NULL;
+
+mus_error_handler_t *mus_error_set_handler(mus_error_handler_t *new_error_handler)
+{
+ mus_error_handler_t *old_handler;
+ old_handler = mus_error_handler;
+ mus_error_handler = new_error_handler;
+ return(old_handler);
+}
+
+#define MUS_ERROR_BUFFER_SIZE 1024
+static char *mus_error_buffer = NULL;
+
+int mus_error(int error, const char *format, ...)
+{
+ va_list ap;
+ if (format == NULL) return(MUS_ERROR); /* else bus error in Mac OSX */
+ if (mus_error_buffer == NULL)
+ mus_error_buffer = (char *)CALLOC(MUS_ERROR_BUFFER_SIZE, sizeof(char));
+ va_start(ap, format);
+#if HAVE_VSNPRINTF
+ vsnprintf(mus_error_buffer, MUS_ERROR_BUFFER_SIZE, format, ap);
+#else
+ vsprintf(mus_error_buffer, format, ap);
+#endif
+ va_end(ap);
+ if (mus_error_handler)
+ (*mus_error_handler)(error, mus_error_buffer);
+ else
+ {
+ fprintf(stderr, mus_error_buffer);
+ fputc('\n', stderr);
+ }
+ return(MUS_ERROR);
+}
+
+static mus_print_handler_t *mus_print_handler = NULL;
+
+mus_print_handler_t *mus_print_set_handler(mus_print_handler_t *new_print_handler)
+{
+ mus_print_handler_t *old_handler;
+ old_handler = mus_print_handler;
+ mus_print_handler = new_print_handler;
+ return(old_handler);
+}
+
+void mus_print(const char *format, ...)
+{
+ va_list ap;
+ if (mus_error_buffer == NULL)
+ mus_error_buffer = (char *)CALLOC(MUS_ERROR_BUFFER_SIZE, sizeof(char));
+ if (mus_print_handler)
+ {
+ va_start(ap, format);
+#if HAVE_VSNPRINTF
+ vsnprintf(mus_error_buffer, MUS_ERROR_BUFFER_SIZE, format, ap);
+#else
+ vsprintf(mus_error_buffer, format, ap);
+#endif
+ va_end(ap);
+ (*mus_print_handler)(mus_error_buffer);
+ }
+ else
+ {
+ va_start(ap, format);
+ vfprintf(stdout, format, ap);
+ va_end(ap);
+ }
+}
+
+static const char *mus_initial_error_names[] = {
+ "no error", "no frequency method", "no phase method", "null gen arg to method", "no length method",
+ "no free method", "no describe method", "no data method", "no scaler method",
+ "memory allocation failed", "unstable two pole error",
+ "can't open file", "no sample input", "no sample output",
+ "no such channel", "no file name provided", "no location method", "no channel method",
+ "no such fft window", "unsupported data format", "header read failed",
+ "unsupported header type", "file descriptors not initialized", "not a sound file", "file closed", "write error",
+ "header write failed", "can't open temp file", "interrupted", "bad envelope",
+
+ "audio channels not available", "audio srate not available", "audio format not available",
+ "no audio input available", "audio configuration not available",
+ "no audio lines available", "audio write error", "audio size not available", "audio device not available",
+ "can't close audio", "can't open audio", "audio read error", "audio amp not available",
+ "can't write audio", "can't read audio", "no audio read permission",
+ "can't close file", "arg out of range",
+
+ "midi open error", "midi read error", "midi write error", "midi close error", "midi init error", "midi misc error",
+
+ "no channels method", "no hop method", "no width method", "no file-name method", "no ramp method", "no run method",
+ "no increment method", "no offset method",
+ "no xcoeff method", "no ycoeff method", "no xcoeffs method", "no ycoeffs method",
+};
+
+static char **mus_error_names = NULL;
+static int mus_error_names_size = 0;
+
+static int mus_error_tag = MUS_INITIAL_ERROR_TAG;
+int mus_make_error(char *error_name)
+{
+ int new_error, err, len, i;
+ new_error = mus_error_tag++;
+ err = new_error - MUS_INITIAL_ERROR_TAG;
+ if (error_name)
+ {
+ if (err >= mus_error_names_size)
+ {
+ if (mus_error_names_size == 0)
+ {
+ mus_error_names_size = 8;
+ mus_error_names = (char **)CALLOC(mus_error_names_size, sizeof(char *));
+ }
+ else
+ {
+ len = mus_error_names_size;
+ mus_error_names_size += 8;
+ mus_error_names = (char **)REALLOC(mus_error_names, mus_error_names_size * sizeof(char *));
+ for (i = len; i < mus_error_names_size; i++) mus_error_names[i] = NULL;
+ }
+ }
+ len = strlen(error_name);
+ mus_error_names[err] = (char *)CALLOC(len + 1, sizeof(char));
+ strcpy(mus_error_names[err], error_name);
+ }
+ return(new_error);
+}
+
+const char *mus_error_type_to_string(int err)
+{
+ if (err >= 0)
+ {
+ if (err < MUS_INITIAL_ERROR_TAG)
+ return(mus_initial_error_names[err]);
+ else
+ {
+ err -= MUS_INITIAL_ERROR_TAG;
+ if ((mus_error_names) && (err < mus_error_names_size))
+ return(mus_error_names[err]);
+ }
+ }
+ return("unknown mus error");
+}
+
+static void default_mus_error(int ignore, char *msg)
+{
+ /* default error handler simply prints the error message */
+ fprintf(stderr, msg);
+}
+
+static time_t local_file_write_date(const char *filename)
+{
+ struct stat statbuf;
+ int err;
+ err = stat(filename, &statbuf);
+ if (err < 0) return((time_t)0);
+ return((time_t)(statbuf.st_mtime));
+}
+
+static bool sndlib_initialized = false;
+
+int mus_sound_initialize(void)
+{
+ int err = MUS_NO_ERROR;
+ if (!sndlib_initialized)
+ {
+ sndlib_initialized = true;
+ mus_error_handler = default_mus_error;
+ err = mus_header_initialize();
+ if (err == MUS_NO_ERROR)
+ err = mus_audio_initialize();
+ return(err);
+ }
+ return(MUS_NO_ERROR);
+}
+
+int mus_sample_bits(void)
+{
+ /* this to check for inconsistent loads */
+#if SNDLIB_USE_FLOATS
+ return(sizeof(Float));
+#else
+ return(MUS_SAMPLE_BITS);
+#endif
+}
+
+typedef struct {
+ char *file_name; /* full path -- everything is keyed to this name */
+ int table_pos;
+ off_t *aux_comment_start, *aux_comment_end;
+ int *loop_modes, *loop_starts, *loop_ends;
+ int markers, base_detune, base_note;
+ int *marker_ids, *marker_positions;
+ off_t samples, true_file_length;
+ off_t data_location;
+ int srate, chans, header_type, data_format, original_sound_format, datum_size;
+ off_t comment_start, comment_end;
+ int type_specifier, bits_per_sample, block_align, fact_samples;
+ time_t write_date;
+ mus_sample_t *maxamps;
+ off_t *maxtimes;
+} sound_file;
+
+static int sound_table_size = 0;
+static sound_file **sound_table = NULL;
+static sound_file *previous_sf = NULL; /* memoized search */
+static int previous_freed_sf = -1;
+
+static void free_sound_file(sound_file *sf)
+{
+ previous_sf = NULL;
+ if (sf)
+ {
+ sound_table[sf->table_pos] = NULL;
+ previous_freed_sf = sf->table_pos;
+ if (sf->aux_comment_start) FREE(sf->aux_comment_start);
+ if (sf->aux_comment_end) FREE(sf->aux_comment_end);
+ if (sf->file_name) FREE(sf->file_name);
+ if (sf->loop_modes) FREE(sf->loop_modes);
+ if (sf->loop_starts) FREE(sf->loop_starts);
+ if (sf->loop_ends) FREE(sf->loop_ends);
+ if (sf->marker_ids) FREE(sf->marker_ids);
+ if (sf->marker_positions) FREE(sf->marker_positions);
+ if (sf->maxamps) FREE(sf->maxamps);
+ if (sf->maxtimes) FREE(sf->maxtimes);
+ FREE(sf);
+ }
+}
+
+static sound_file *add_to_sound_table(const char *name)
+{
+ int i, pos;
+ pos = previous_freed_sf;
+ if (pos == -1)
+ {
+ for (i = 0; i < sound_table_size; i++)
+ if (sound_table[i] == NULL)
+ {
+ pos = i;
+ break;
+ }
+ if (pos == -1)
+ {
+ pos = sound_table_size;
+ sound_table_size += 16;
+ if (sound_table == NULL)
+ sound_table = (sound_file **)CALLOC(sound_table_size, sizeof(sound_file *));
+ else
+ {
+ sound_table = (sound_file **)REALLOC(sound_table, sound_table_size * sizeof(sound_file *));
+ for (i = pos; i < sound_table_size; i++) sound_table[i] = NULL;
+ }
+ }
+ }
+ else previous_freed_sf = -1;
+ sound_table[pos] = (sound_file *)CALLOC(1, sizeof(sound_file));
+ sound_table[pos]->table_pos = pos;
+ sound_table[pos]->file_name = (char *)CALLOC(strlen(name) + 1, sizeof(char));
+ strcpy(sound_table[pos]->file_name, name);
+ return(sound_table[pos]);
+}
+
+int mus_sound_prune(void)
+{
+ int i, pruned = 0;
+ for (i = 0; i < sound_table_size; i++)
+ if ((sound_table[i]) &&
+ (!(mus_file_probe(sound_table[i]->file_name))))
+ {
+ free_sound_file(sound_table[i]);
+ sound_table[i] = NULL;
+ pruned++;
+ }
+ return(pruned);
+}
+
+int mus_sound_forget(const char *name)
+{
+ int i, len;
+ bool free_name = false;
+ char *short_name = NULL;
+ if (name == NULL) return(MUS_ERROR);
+ if (name[0] == '/')
+ {
+ len = strlen(name);
+ for (i = 0; i < len; i++)
+ if (name[i] == '/')
+ short_name = (char *)(name + i + 1);
+ }
+ else
+ {
+ short_name = mus_expand_filename(name);
+ free_name = true;
+ }
+ previous_sf = NULL;
+ if (name)
+ for (i = 0; i < sound_table_size; i++)
+ if ((sound_table[i]) &&
+ ((strcmp(name, sound_table[i]->file_name) == 0) ||
+ ((short_name) &&
+ (strcmp(short_name, sound_table[i]->file_name) == 0))))
+ {
+ free_sound_file(sound_table[i]);
+ sound_table[i] = NULL;
+ }
+ if (free_name) FREE(short_name);
+ return(MUS_NO_ERROR);
+}
+
+static sound_file *check_write_date(const char *name, sound_file *sf)
+{
+ if (sf)
+ {
+ time_t date;
+ date = local_file_write_date(name);
+ if (date == sf->write_date)
+ return(sf);
+ else
+ {
+ if ((sf->header_type == MUS_RAW) && (mus_header_no_header(name)))
+ {
+ int chan;
+ off_t data_size;
+ /* sound has changed since we last read it, but it has no header, so
+ * the only sensible thing to check is the new length (i.e. caller
+ * has set other fields by hand)
+ */
+ sf->write_date = date;
+ chan = mus_file_open_read(name);
+ data_size = lseek(chan, 0L, SEEK_END);
+ sf->true_file_length = data_size;
+ sf->samples = mus_bytes_to_samples(sf->data_format, data_size);
+ CLOSE(chan, name);
+ return(sf);
+ }
+ /* otherwise our data base is out-of-date, so clear it out */
+ free_sound_file(sf);
+ }
+ }
+ return(NULL);
+}
+
+static sound_file *find_sound_file(const char *name)
+{
+ int i;
+ /* perhaps we already have the needed data... (90% hit rate here) */
+ if ((previous_sf) &&
+ (strcmp(previous_sf->file_name, name) == 0) &&
+ (previous_sf->write_date == local_file_write_date(name)))
+ return(previous_sf);
+ if (name)
+ for (i = 0; i < sound_table_size; i++)
+ if ((sound_table[i]) &&
+ (strcmp(name, sound_table[i]->file_name) == 0))
+ {
+ previous_sf = check_write_date(name, sound_table[i]);
+ return(previous_sf);
+ }
+ return(NULL);
+}
+
+static void display_sound_file_entry(FILE *fp, const char *name, sound_file *sf)
+{
+ int i, lim;
+ time_t date;
+ char timestr[64];
+ char *comment;
+ date = sf->write_date;
+ if (date != 0)
+ {
+#if HAVE_STRFTIME
+ strftime(timestr, 64, "%a %d-%b-%Y %H:%M:%S", localtime(&date));
+#else
+ sprintf(timestr, "%d", (int)date);
+#endif
+ }
+ else sprintf(timestr, "(date cleared)");
+ fprintf(fp, " %s: %s, chans: %d, srate: %d, type: %s, format: %s, samps: " OFF_TD,
+ name,
+ timestr,
+ sf->chans,
+ sf->srate,
+ mus_header_type_name(sf->header_type),
+ mus_data_format_name(sf->data_format),
+ sf->samples);
+ if (sf->loop_modes)
+ {
+ if (sf->loop_modes[0] != 0)
+ fprintf(fp, ", loop mode %d: %d to %d", sf->loop_modes[0], sf->loop_starts[0], sf->loop_ends[0]);
+ if (sf->loop_modes[1] != 0)
+ fprintf(fp, ", loop mode %d: %d to %d, ", sf->loop_modes[1], sf->loop_starts[1], sf->loop_ends[1]);
+ fprintf(fp, ", base: %d, detune: %d", sf->base_note, sf->base_detune);
+ }
+ if (sf->maxamps)
+ {
+ lim = sf->chans;
+ if (lim > 0)
+ {
+ if (lim > 64)
+ lim = 64;
+ for (i = 0; i < lim; i++)
+ {
+ if (i > 1) fprintf(fp, ", ");
+ fprintf(fp, " %.3f at %.3f ",
+ MUS_SAMPLE_TO_FLOAT(sf->maxamps[i]),
+ (sf->srate > 0.0) ? (float)((double)(sf->maxtimes[i]) / (double)(sf->srate)) : (float)(sf->maxtimes[i]));
+ }
+ }
+ }
+ if (mus_file_probe(name))
+ {
+ comment = mus_sound_comment(name);
+ if (comment)
+ {
+ fprintf(fp, "\n comment: %s", comment);
+ FREE(comment);
+ }
+ }
+ else fprintf(fp, " [defunct]");
+ fprintf(fp, "\n");
+}
+
+void mus_sound_report_cache(FILE *fp)
+{
+ sound_file *sf;
+ int entries = 0;
+ int i;
+ fprintf(fp, "sound table:\n");
+ for (i = 0; i < sound_table_size; i++)
+ {
+ sf = sound_table[i];
+ if (sf)
+ {
+ display_sound_file_entry(fp, sf->file_name, sf);
+ entries++;
+ }
+ }
+ fprintf(fp, "\nentries: %d\n", entries);
+ fflush(fp);
+}
+
+static sound_file *fill_sf_record(const char *name, sound_file *sf)
+{
+ int i;
+ sf->data_location = mus_header_data_location();
+ sf->samples = mus_header_samples();
+ sf->data_format = mus_header_format();
+ sf->srate = mus_header_srate();
+ /* if (sf->srate < 0) sf->srate = 0; */
+ sf->chans = mus_header_chans();
+ /* if (sf->chans < 0) sf->chans = 0; */
+ sf->datum_size = mus_bytes_per_sample(sf->data_format);
+ sf->header_type = mus_header_type();
+ sf->original_sound_format = mus_header_original_format();
+ sf->true_file_length = mus_header_true_length();
+ sf->comment_start = mus_header_comment_start();
+ sf->comment_end = mus_header_comment_end();
+ if (((sf->header_type == MUS_AIFC) ||
+ (sf->header_type == MUS_AIFF) ||
+ (sf->header_type == MUS_RIFF)) &&
+ (mus_header_aux_comment_start(0) != 0))
+
+ {
+ sf->aux_comment_start = (off_t *)CALLOC(4, sizeof(off_t));
+ sf->aux_comment_end = (off_t *)CALLOC(4, sizeof(off_t));
+ for (i = 0; i < 4; i++)
+ {
+ sf->aux_comment_start[i] = mus_header_aux_comment_start(i);
+ sf->aux_comment_end[i] = mus_header_aux_comment_end(i);
+ }
+ }
+ sf->type_specifier = mus_header_type_specifier();
+ sf->bits_per_sample = mus_header_bits_per_sample();
+ sf->fact_samples = mus_header_fact_samples();
+ sf->block_align = mus_header_block_align();
+ sf->write_date = local_file_write_date(name);
+ if (mus_header_loop_mode(0) > 0)
+ {
+ sf->loop_modes = (int *)CALLOC(2, sizeof(int));
+ sf->loop_starts = (int *)CALLOC(2, sizeof(int));
+ sf->loop_ends = (int *)CALLOC(2, sizeof(int));
+ for (i = 0; i < 2; i++)
+ {
+ sf->loop_modes[i] = mus_header_loop_mode(i);
+ if ((sf->header_type == MUS_AIFF) ||
+ (sf->header_type == MUS_AIFC))
+ {
+ sf->loop_starts[i] = mus_header_mark_position(mus_header_loop_start(i));
+ sf->loop_ends[i] = mus_header_mark_position(mus_header_loop_end(i));
+ }
+ else
+ {
+ sf->loop_starts[i] = mus_header_loop_start(i);
+ sf->loop_ends[i] = mus_header_loop_end(i);
+ }
+ }
+ sf->base_detune = mus_header_base_detune();
+ sf->base_note = mus_header_base_note();
+ }
+ previous_sf = sf;
+ return(sf);
+}
+
+static sound_file *read_sound_file_header(const char *name)
+{
+ mus_sound_initialize();
+ if (mus_header_read(name) != MUS_ERROR)
+ return(fill_sf_record(name, add_to_sound_table(name)));
+ return(NULL);
+}
+
+static sound_file *getsf(const char *arg)
+{
+ sound_file *sf = NULL;
+ if (arg == NULL) return(NULL);
+ sf = find_sound_file(arg);
+ if (sf) return(sf);
+ return(read_sound_file_header(arg));
+}
+
+#define MUS_SF(Filename, Expression) \
+ sound_file *sf; \
+ sf = getsf(Filename); \
+ if (sf) return(Expression); \
+ return(MUS_ERROR)
+
+off_t mus_sound_samples(const char *arg) {MUS_SF(arg, sf->samples);}
+off_t mus_sound_frames(const char *arg) {MUS_SF(arg, (sf->chans > 0) ? (sf->samples / sf->chans) : 0);}
+int mus_sound_datum_size(const char *arg) {MUS_SF(arg, sf->datum_size);}
+off_t mus_sound_data_location(const char *arg) {MUS_SF(arg, sf->data_location);}
+int mus_sound_chans(const char *arg) {MUS_SF(arg, sf->chans);}
+int mus_sound_srate(const char *arg) {MUS_SF(arg, sf->srate);}
+int mus_sound_header_type(const char *arg) {MUS_SF(arg, sf->header_type);}
+int mus_sound_data_format(const char *arg) {MUS_SF(arg, sf->data_format);}
+int mus_sound_original_format(const char *arg) {MUS_SF(arg, sf->original_sound_format);}
+off_t mus_sound_comment_start(const char *arg) {MUS_SF(arg, sf->comment_start);}
+off_t mus_sound_comment_end(const char *arg) {MUS_SF(arg, sf->comment_end);}
+off_t mus_sound_length(const char *arg) {MUS_SF(arg, sf->true_file_length);}
+int mus_sound_fact_samples(const char *arg) {MUS_SF(arg, sf->fact_samples);}
+time_t mus_sound_write_date(const char *arg) {MUS_SF(arg, sf->write_date);}
+int mus_sound_type_specifier(const char *arg) {MUS_SF(arg, sf->type_specifier);}
+int mus_sound_block_align(const char *arg) {MUS_SF(arg, sf->block_align);}
+int mus_sound_bits_per_sample(const char *arg) {MUS_SF(arg, sf->bits_per_sample);}
+
+float mus_sound_duration(const char *arg)
+{
+ float val = -1.0;
+ sound_file *sf;
+ sf = getsf(arg);
+ if (sf)
+ {
+ if ((sf->chans > 0) && (sf->srate > 0))
+ val = (float)((double)(sf->samples) / ((float)(sf->chans) * (float)(sf->srate)));
+ else val = 0.0;
+ }
+ return(val);
+}
+
+int *mus_sound_loop_info(const char *arg)
+{
+ sound_file *sf;
+ int *info;
+ sf = getsf(arg);
+ if ((sf) && (sf->loop_modes))
+ {
+ info = (int *)CALLOC(MUS_LOOP_INFO_SIZE, sizeof(int));
+ if (sf->loop_modes[0] != 0)
+ {
+ info[0] = sf->loop_starts[0];
+ info[1] = sf->loop_ends[0];
+ info[6] = sf->loop_modes[0];
+ }
+ if (sf->loop_modes[1] != 0)
+ {
+ info[2] = sf->loop_starts[1];
+ info[3] = sf->loop_ends[1];
+ info[7] = sf->loop_modes[1];
+ }
+ info[4] = sf->base_note;
+ info[5] = sf->base_detune;
+ return(info);
+ }
+ else return(NULL);
+}
+
+void mus_sound_set_loop_info(const char *arg, int *loop)
+{
+ sound_file *sf;
+ sf = getsf(arg);
+ if (sf)
+ {
+ if (sf->loop_modes == NULL)
+ {
+ sf->loop_modes = (int *)CALLOC(2, sizeof(int));
+ sf->loop_starts = (int *)CALLOC(2, sizeof(int));
+ sf->loop_ends = (int *)CALLOC(2, sizeof(int));
+ }
+ sf->loop_modes[0] = loop[6];
+ if (loop[6] != 0)
+ {
+ sf->loop_starts[0] = loop[0];
+ sf->loop_ends[0] = loop[1];
+ }
+ else
+ {
+ sf->loop_starts[0] = 0;
+ sf->loop_ends[0] = 0;
+ }
+ sf->loop_modes[1] = loop[7];
+ if (loop[7] != 0)
+ {
+ sf->loop_starts[1] = loop[2];
+ sf->loop_ends[1] = loop[3];
+ }
+ else
+ {
+ sf->loop_starts[1] = 0;
+ sf->loop_ends[1] = 0;
+ }
+ sf->base_note = loop[4];
+ sf->base_detune = loop[5];
+ }
+}
+
+char *mus_sound_comment(const char *name)
+{
+ off_t start, end, len;
+ int fd, full_len; /* comment string lengths */
+ char *sc = NULL, *auxcom;
+ sound_file *sf = NULL;
+ sf = getsf(name);
+ if (sf == NULL) return(NULL);
+ start = mus_sound_comment_start(name);
+ end = mus_sound_comment_end(name);
+ if (end == 0)
+ {
+ if (sf->aux_comment_start)
+ {
+ if (mus_sound_header_type(name) == MUS_RIFF)
+ return(mus_header_riff_aux_comment(name,
+ sf->aux_comment_start,
+ sf->aux_comment_end));
+ if ((mus_sound_header_type(name) == MUS_AIFF) ||
+ (mus_sound_header_type(name) == MUS_AIFC))
+ return(mus_header_aiff_aux_comment(name,
+ sf->aux_comment_start,
+ sf->aux_comment_end));
+ }
+ return(NULL);
+ }
+ if (end > mus_sound_length(name)) return(NULL);
+ len = end - start + 1;
+ if (len > 0)
+ {
+ /* open and get the comment */
+ size_t bytes;
+ fd = mus_file_open_read(name);
+ if (fd == -1) return(NULL);
+ lseek(fd, start, SEEK_SET);
+ sc = (char *)CALLOC(len + 1, sizeof(char));
+ bytes = read(fd, sc, len);
+ CLOSE(fd, name);
+ if (((mus_sound_header_type(name) == MUS_AIFF) ||
+ (mus_sound_header_type(name) == MUS_AIFC)) &&
+ (sf->aux_comment_start) &&
+ (bytes != 0))
+ {
+ auxcom = mus_header_aiff_aux_comment(name,
+ sf->aux_comment_start,
+ sf->aux_comment_end);
+ if (auxcom)
+ {
+ full_len = strlen(auxcom) + strlen(sc) + 2;
+ sc = (char *)REALLOC(sc, full_len * sizeof(char));
+ strcat(sc, "\n");
+ strcat(sc, auxcom);
+ }
+ }
+ }
+ return(sc);
+}
+
+int mus_sound_open_input(const char *arg)
+{
+ int fd = -1;
+ if (!(mus_file_probe(arg)))
+ mus_error(MUS_CANT_OPEN_FILE, S_mus_sound_open_input " can't open %s: %s", arg, STRERROR(errno));
+ else
+ {
+ sound_file *sf = NULL;
+ mus_sound_initialize();
+ sf = find_sound_file(arg);
+ if (!sf)
+ sf = read_sound_file_header(arg);
+ if (sf)
+ {
+ fd = mus_file_open_read(arg);
+ mus_file_open_descriptors(fd, arg, sf->data_format, sf->datum_size, sf->data_location, sf->chans, sf->header_type);
+ lseek(fd, sf->data_location, SEEK_SET);
+ }
+ }
+ return(fd);
+}
+
+int mus_sound_open_output(const char *arg, int srate, int chans, int data_format, int header_type, const char *comment)
+{
+ int fd = MUS_ERROR, err, comlen = 0;
+ if (comment) comlen = strlen(comment);
+ mus_sound_initialize();
+ mus_sound_forget(arg);
+ err = mus_header_write(arg, header_type, srate, chans, 0, 0, data_format, comment, comlen);
+ if (err != MUS_ERROR)
+ {
+ fd = mus_file_open_write(arg);
+ if (fd != -1)
+ mus_file_open_descriptors(fd,
+ arg,
+ data_format,
+ mus_bytes_per_sample(data_format),
+ mus_header_data_location(),
+ chans,
+ header_type);
+ }
+ return(fd);
+}
+
+int mus_sound_reopen_output(const char *arg, int chans, int format, int type, off_t data_loc)
+{
+ int fd;
+ mus_sound_initialize();
+ fd = mus_file_reopen_write(arg);
+ if (fd != -1)
+ mus_file_open_descriptors(fd, arg, format, mus_bytes_per_sample(format), data_loc, chans, type);
+ return(fd);
+}
+
+int mus_sound_close_input(int fd)
+{
+ return(mus_file_close(fd)); /* this closes the clm file descriptors */
+}
+
+int mus_sound_close_output(int fd, off_t bytes_of_data)
+{
+ char *name;
+ name = mus_file_fd_name(fd);
+ if (name)
+ {
+ int err = MUS_ERROR, old_type;
+ char *fname;
+ fname = strdup(name); /* strdup defined, if necessary, in io.c */
+ old_type = mus_file_header_type(fd);
+ err = mus_file_close(fd); /* this frees the original fd->name, so we copied above */
+ /* fd is NULL now */
+ mus_sound_forget(fname);
+ mus_header_change_data_size(fname, old_type, bytes_of_data);
+ free(fname);
+ return(err);
+ }
+ return(MUS_ERROR);
+}
+
+typedef enum {SF_CHANS, SF_SRATE, SF_TYPE, SF_FORMAT, SF_LOCATION, SF_SIZE} sf_field_t;
+
+static int mus_sound_set_field(const char *arg, sf_field_t field, int val)
+{
+ sound_file *sf;
+ sf = getsf(arg);
+ if (sf)
+ {
+ switch (field)
+ {
+ case SF_CHANS: sf->chans = val; break;
+ case SF_SRATE: sf->srate = val; break;
+ case SF_TYPE: sf->header_type = val; break;
+ case SF_FORMAT: sf->data_format = val; sf->datum_size = mus_bytes_per_sample(val); break;
+ default: return(MUS_ERROR); break;
+ }
+ return(MUS_NO_ERROR);
+ }
+ return(MUS_ERROR);
+}
+
+static int mus_sound_set_off_t_field(const char *arg, sf_field_t field, off_t val)
+{
+ sound_file *sf;
+ sf = getsf(arg);
+ if (sf)
+ {
+ switch (field)
+ {
+ case SF_SIZE: sf->samples = val; break;
+ case SF_LOCATION: sf->data_location = val; break;
+ default: return(MUS_ERROR); break;
+ }
+ return(MUS_NO_ERROR);
+ }
+ return(MUS_ERROR);
+}
+
+int mus_sound_set_chans(const char *arg, int val) {return(mus_sound_set_field(arg, SF_CHANS, val));}
+int mus_sound_set_srate(const char *arg, int val) {return(mus_sound_set_field(arg, SF_SRATE, val));}
+int mus_sound_set_header_type(const char *arg, int val) {return(mus_sound_set_field(arg, SF_TYPE, val));}
+int mus_sound_set_data_format(const char *arg, int val) {return(mus_sound_set_field(arg, SF_FORMAT, val));}
+int mus_sound_set_data_location(const char *arg, off_t val) {return(mus_sound_set_off_t_field(arg, SF_LOCATION, val));}
+int mus_sound_set_samples(const char *arg, off_t val) {return(mus_sound_set_off_t_field(arg, SF_SIZE, val));}
+
+int mus_sound_override_header(const char *arg, int srate, int chans, int format, int type, off_t location, off_t size)
+{
+ sound_file *sf;
+ /* perhaps once a header has been over-ridden, we should not reset the relevant fields upon re-read? */
+ sf = getsf(arg);
+ if (sf)
+ {
+ if (location != -1) sf->data_location = location;
+ if (size != -1) sf->samples = size;
+ if (format != -1)
+ {
+ sf->data_format = format;
+ sf->datum_size = mus_bytes_per_sample(format);
+ }
+ if (srate != -1) sf->srate = srate;
+ if (chans != -1) sf->chans = chans;
+ if (type != -1) sf->header_type = type;
+ return(MUS_NO_ERROR);
+ }
+ return(MUS_ERROR);
+}
+
+bool mus_sound_maxamp_exists(const char *ifile)
+{
+ sound_file *sf;
+ bool val = false;
+ sf = getsf(ifile);
+ val = ((sf) && (sf->maxamps));
+ return(val);
+}
+
+off_t mus_sound_maxamps(const char *ifile, int chans, mus_sample_t *vals, off_t *times)
+{
+ int ifd, ichans, chn, j;
+ int i, bufnum;
+ off_t n, frames, curframes;
+ mus_sample_t abs_samp;
+ mus_sample_t *buffer, *samp;
+ off_t *time;
+ mus_sample_t **ibufs;
+ sound_file *sf;
+ sf = getsf(ifile);
+ if (sf->chans <= 0) return(MUS_ERROR);
+ if ((sf) && (sf->maxamps))
+ {
+ if (chans > sf->chans) ichans = sf->chans; else ichans = chans;
+ for (chn = 0; chn < ichans; chn++)
+ {
+ times[chn] = sf->maxtimes[chn];
+ vals[chn] = sf->maxamps[chn];
+ }
+ frames = sf->samples / sf->chans;
+ return(frames);
+ }
+ ifd = mus_sound_open_input(ifile);
+ if (ifd == MUS_ERROR) return(MUS_ERROR);
+ ichans = mus_sound_chans(ifile);
+ frames = mus_sound_frames(ifile);
+ if (frames == 0)
+ {
+ mus_sound_close_input(ifd);
+ return(0);
+ }
+ mus_file_seek_frame(ifd, 0);
+ ibufs = (mus_sample_t **)CALLOC(ichans, sizeof(mus_sample_t *));
+ bufnum = 8192;
+ for (j = 0; j < ichans; j++)
+ ibufs[j] = (mus_sample_t *)CALLOC(bufnum, sizeof(mus_sample_t));
+ time = (off_t *)CALLOC(ichans, sizeof(off_t));
+ samp = (mus_sample_t *)CALLOC(ichans, sizeof(mus_sample_t));
+ for (n = 0; n < frames; n += bufnum)
+ {
+ if ((n + bufnum) < frames)
+ curframes = bufnum;
+ else curframes = (frames - n);
+ mus_file_read(ifd, 0, curframes - 1, ichans, ibufs);
+ for (chn = 0; chn < ichans; chn++)
+ {
+ buffer = (mus_sample_t *)(ibufs[chn]);
+ for (i = 0; i < curframes; i++)
+ {
+ abs_samp = mus_sample_abs(buffer[i]);
+ if (abs_samp > samp[chn])
+ {
+ time[chn] = i + n;
+ samp[chn] = abs_samp;
+ }
+ }
+ }
+ }
+ mus_sound_close_input(ifd);
+ mus_sound_set_maxamps(ifile, ichans, samp, time); /* save the complete set */
+ if (ichans > chans) ichans = chans;
+ for (chn = 0; chn < ichans; chn++)
+ {
+ times[chn] = time[chn];
+ vals[chn] = samp[chn];
+ }
+ FREE(time);
+ FREE(samp);
+ for (j = 0; j < ichans; j++) FREE(ibufs[j]);
+ FREE(ibufs);
+ return(frames);
+}
+
+int mus_sound_set_maxamps(const char *ifile, int chans, mus_sample_t *vals, off_t *times)
+{
+ sound_file *sf;
+ sf = getsf(ifile);
+ if (sf)
+ {
+ int i, ichans = 0;
+ if (sf->maxamps)
+ {
+ if (chans > sf->chans) ichans = sf->chans; else ichans = chans;
+ for (i = 0; i < ichans; i++)
+ {
+ sf->maxtimes[i] = times[i];
+ sf->maxamps[i] = vals[i];
+ }
+ }
+ else
+ {
+ ichans = mus_sound_chans(ifile);
+ if (sf->maxamps == NULL)
+ {
+ sf->maxamps = (mus_sample_t *)CALLOC(ichans, sizeof(mus_sample_t));
+ sf->maxtimes = (off_t *)CALLOC(ichans, sizeof(off_t));
+ }
+ if (ichans > chans) ichans = chans;
+ for (i = 0; i < ichans; i++)
+ {
+ sf->maxtimes[i] = times[i];
+ sf->maxamps[i] = vals[i];
+ }
+ }
+ return(MUS_NO_ERROR);
+ }
+ return(MUS_ERROR);
+}
+
+int mus_file_to_array(const char *filename, int chan, int start, int samples, mus_sample_t *array)
+{
+ int ifd, chans, total_read;
+ mus_sample_t **bufs;
+ ifd = mus_sound_open_input(filename);
+ if (ifd == MUS_ERROR) return(MUS_ERROR);
+ chans = mus_sound_chans(filename);
+ if (chan >= chans)
+ {
+ mus_sound_close_input(ifd);
+ return(mus_error(MUS_NO_SUCH_CHANNEL, "mus_file_to_array can't read %s channel %d (file has %d chans)", filename, chan, chans));
+ }
+ bufs = (mus_sample_t **)CALLOC(chans, sizeof(mus_sample_t *));
+ bufs[chan] = array;
+ mus_file_seek_frame(ifd, start);
+ total_read = mus_file_read_any(ifd, 0, chans, samples, bufs, bufs);
+ mus_sound_close_input(ifd);
+ FREE(bufs);
+ return(total_read);
+}
+
+char *mus_array_to_file_with_error(const char *filename, mus_sample_t *ddata, int len, int srate, int channels)
+{
+ /* put ddata into a sound file, taking byte order into account */
+ /* assume ddata is interleaved already if more than one channel */
+ int fd, err = MUS_NO_ERROR;
+ mus_sample_t *bufs[1];
+ mus_sound_forget(filename);
+ fd = mus_file_create(filename);
+ if (fd == -1)
+ return("mus_array_to_file can't create output file");
+ err = mus_file_open_descriptors(fd, filename,
+ MUS_OUT_FORMAT,
+ mus_bytes_per_sample(MUS_OUT_FORMAT),
+ 28, channels, MUS_NEXT);
+ if (err != MUS_ERROR)
+ {
+ err = mus_header_write_next_header(fd, srate, channels, 28, len /* out chans = 1?? */, MUS_OUT_FORMAT, NULL, 0);
+ if (err != MUS_ERROR)
+ {
+ bufs[0] = ddata;
+ err = mus_file_write(fd, 0, len - 1, 1, bufs); /* 1 = chans?? */
+ }
+ }
+ mus_file_close(fd);
+ if (err == MUS_ERROR)
+ return("mus_array_to_file write error");
+ return(NULL);
+}
+
+int mus_array_to_file(const char *filename, mus_sample_t *ddata, int len, int srate, int channels)
+{
+ char *errmsg;
+ errmsg = mus_array_to_file_with_error(filename, ddata, len, srate, channels);
+ if (errmsg)
+ return(mus_error(MUS_CANT_OPEN_FILE, errmsg));
+ return(MUS_NO_ERROR);
+}
+
+int mus_file_to_float_array(const char *filename, int chan, off_t start, int samples, Float *array)
+{
+#if SNDLIB_USE_FLOATS
+ return(mus_file_to_array(filename, chan, start, samples, array));
+#else
+ mus_sample_t *idata;
+ int i, len;
+ idata = (mus_sample_t *)CALLOC(samples, sizeof(mus_sample_t));
+ len = mus_file_to_array(filename, chan, start, samples, idata);
+ if (len != -1)
+ for (i = 0; i < samples; i++)
+ array[i] = MUS_SAMPLE_TO_FLOAT(idata[i]);
+ FREE(idata);
+ return(len);
+#endif
+}
+
+int mus_float_array_to_file(const char *filename, Float *ddata, int len, int srate, int channels)
+{
+ char *errmsg;
+#if SNDLIB_USE_FLOATS
+ errmsg = mus_array_to_file_with_error(filename, ddata, len, srate, channels);
+#else
+ mus_sample_t *idata;
+ int i;
+ idata = (mus_sample_t *)CALLOC(len, sizeof(mus_sample_t));
+ for (i = 0; i < len; i++)
+ idata[i] = MUS_FLOAT_TO_SAMPLE(ddata[i]);
+ errmsg = mus_array_to_file_with_error(filename, idata, len, srate, channels);
+ FREE(idata);
+#endif
+ if (errmsg)
+ return(mus_error(MUS_CANT_OPEN_FILE, errmsg));
+ return(MUS_NO_ERROR);
+}
diff --git a/third_party/resample/src/Makefile.am b/third_party/resample/src/Makefile.am
new file mode 100644
index 00000000..bd3ce51a
--- /dev/null
+++ b/third_party/resample/src/Makefile.am
@@ -0,0 +1,22 @@
+## Process this file with automake to produce Makefile.in
+
+SNDLIB = ../sndlib-20
+
+INCLUDES = -I$(SNDLIB)
+
+bin_PROGRAMS = resample windowfilter
+
+resample_SOURCES = resample.c resamplesubs.c sndlibextra.c filterkit.c \
+ $(SNDLIB)/audio.c $(SNDLIB)/io.c $(SNDLIB)/headers.c $(SNDLIB)/sound.c \
+ resample.h stdefs.h sndlibextra.h filterkit.h smallfilter.h largefilter.h \
+ $(SNDLIB)/sndlib.h $(SNDLIB)/mus-config.h $(SNDLIB)/_sndlib.h $(SNDLIB)/sndlib-strings.h $(SNDLIB)/configure
+
+resample_LDADD = -lm
+
+windowfilter_SOURCES = windowfilter.c resamplesubs.c sndlibextra.c filterkit.c \
+ $(SNDLIB)/audio.c $(SNDLIB)/io.c $(SNDLIB)/headers.c $(SNDLIB)/sound.c
+
+windowfilter_LDADD = -lm
+
+EXTRA_DIST = $(man_MANS)
+
diff --git a/third_party/resample/src/Makefile.in b/third_party/resample/src/Makefile.in
new file mode 100644
index 00000000..56da85f2
--- /dev/null
+++ b/third_party/resample/src/Makefile.in
@@ -0,0 +1,478 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = :
+bin_PROGRAMS = resample$(EXEEXT) windowfilter$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_resample_OBJECTS = resample.$(OBJEXT) resamplesubs.$(OBJEXT) \
+ sndlibextra.$(OBJEXT) filterkit.$(OBJEXT) audio.$(OBJEXT) \
+ io.$(OBJEXT) headers.$(OBJEXT) sound.$(OBJEXT)
+resample_OBJECTS = $(am_resample_OBJECTS)
+resample_DEPENDENCIES =
+am_windowfilter_OBJECTS = windowfilter.$(OBJEXT) \
+ resamplesubs.$(OBJEXT) sndlibextra.$(OBJEXT) \
+ filterkit.$(OBJEXT) audio.$(OBJEXT) io.$(OBJEXT) \
+ headers.$(OBJEXT) sound.$(OBJEXT)
+windowfilter_OBJECTS = $(am_windowfilter_OBJECTS)
+windowfilter_DEPENDENCIES =
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(resample_SOURCES) $(windowfilter_SOURCES)
+DIST_SOURCES = $(resample_SOURCES) $(windowfilter_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+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_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SNDLIB = ../sndlib-20
+INCLUDES = -I$(SNDLIB)
+resample_SOURCES = resample.c resamplesubs.c sndlibextra.c filterkit.c \
+ $(SNDLIB)/audio.c $(SNDLIB)/io.c $(SNDLIB)/headers.c $(SNDLIB)/sound.c \
+ resample.h stdefs.h sndlibextra.h filterkit.h smallfilter.h largefilter.h \
+ $(SNDLIB)/sndlib.h $(SNDLIB)/mus-config.h $(SNDLIB)/_sndlib.h $(SNDLIB)/sndlib-strings.h $(SNDLIB)/configure
+
+resample_LDADD = -lm
+windowfilter_SOURCES = windowfilter.c resamplesubs.c sndlibextra.c filterkit.c \
+ $(SNDLIB)/audio.c $(SNDLIB)/io.c $(SNDLIB)/headers.c $(SNDLIB)/sound.c
+
+windowfilter_LDADD = -lm
+EXTRA_DIST = $(man_MANS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .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 \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ 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;
+
+$(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
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+resample$(EXEEXT): $(resample_OBJECTS) $(resample_DEPENDENCIES)
+ @rm -f resample$(EXEEXT)
+ $(LINK) $(resample_LDFLAGS) $(resample_OBJECTS) $(resample_LDADD) $(LIBS)
+windowfilter$(EXEEXT): $(windowfilter_OBJECTS) $(windowfilter_DEPENDENCIES)
+ @rm -f windowfilter$(EXEEXT)
+ $(LINK) $(windowfilter_LDFLAGS) $(windowfilter_OBJECTS) $(windowfilter_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filterkit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/headers.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resample.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resamplesubs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndlibextra.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowfilter.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+audio.o: $(SNDLIB)/audio.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio.o -MD -MP -MF "$(DEPDIR)/audio.Tpo" -c -o audio.o `test -f '$(SNDLIB)/audio.c' || echo '$(srcdir)/'`$(SNDLIB)/audio.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio.Tpo" "$(DEPDIR)/audio.Po"; else rm -f "$(DEPDIR)/audio.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(SNDLIB)/audio.c' object='audio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio.o `test -f '$(SNDLIB)/audio.c' || echo '$(srcdir)/'`$(SNDLIB)/audio.c
+
+audio.obj: $(SNDLIB)/audio.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT audio.obj -MD -MP -MF "$(DEPDIR)/audio.Tpo" -c -o audio.obj `if test -f '$(SNDLIB)/audio.c'; then $(CYGPATH_W) '$(SNDLIB)/audio.c'; else $(CYGPATH_W) '$(srcdir)/$(SNDLIB)/audio.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/audio.Tpo" "$(DEPDIR)/audio.Po"; else rm -f "$(DEPDIR)/audio.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(SNDLIB)/audio.c' object='audio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o audio.obj `if test -f '$(SNDLIB)/audio.c'; then $(CYGPATH_W) '$(SNDLIB)/audio.c'; else $(CYGPATH_W) '$(srcdir)/$(SNDLIB)/audio.c'; fi`
+
+io.o: $(SNDLIB)/io.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT io.o -MD -MP -MF "$(DEPDIR)/io.Tpo" -c -o io.o `test -f '$(SNDLIB)/io.c' || echo '$(srcdir)/'`$(SNDLIB)/io.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/io.Tpo" "$(DEPDIR)/io.Po"; else rm -f "$(DEPDIR)/io.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(SNDLIB)/io.c' object='io.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o io.o `test -f '$(SNDLIB)/io.c' || echo '$(srcdir)/'`$(SNDLIB)/io.c
+
+io.obj: $(SNDLIB)/io.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT io.obj -MD -MP -MF "$(DEPDIR)/io.Tpo" -c -o io.obj `if test -f '$(SNDLIB)/io.c'; then $(CYGPATH_W) '$(SNDLIB)/io.c'; else $(CYGPATH_W) '$(srcdir)/$(SNDLIB)/io.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/io.Tpo" "$(DEPDIR)/io.Po"; else rm -f "$(DEPDIR)/io.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(SNDLIB)/io.c' object='io.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o io.obj `if test -f '$(SNDLIB)/io.c'; then $(CYGPATH_W) '$(SNDLIB)/io.c'; else $(CYGPATH_W) '$(srcdir)/$(SNDLIB)/io.c'; fi`
+
+headers.o: $(SNDLIB)/headers.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT headers.o -MD -MP -MF "$(DEPDIR)/headers.Tpo" -c -o headers.o `test -f '$(SNDLIB)/headers.c' || echo '$(srcdir)/'`$(SNDLIB)/headers.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/headers.Tpo" "$(DEPDIR)/headers.Po"; else rm -f "$(DEPDIR)/headers.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(SNDLIB)/headers.c' object='headers.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o headers.o `test -f '$(SNDLIB)/headers.c' || echo '$(srcdir)/'`$(SNDLIB)/headers.c
+
+headers.obj: $(SNDLIB)/headers.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT headers.obj -MD -MP -MF "$(DEPDIR)/headers.Tpo" -c -o headers.obj `if test -f '$(SNDLIB)/headers.c'; then $(CYGPATH_W) '$(SNDLIB)/headers.c'; else $(CYGPATH_W) '$(srcdir)/$(SNDLIB)/headers.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/headers.Tpo" "$(DEPDIR)/headers.Po"; else rm -f "$(DEPDIR)/headers.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(SNDLIB)/headers.c' object='headers.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o headers.obj `if test -f '$(SNDLIB)/headers.c'; then $(CYGPATH_W) '$(SNDLIB)/headers.c'; else $(CYGPATH_W) '$(srcdir)/$(SNDLIB)/headers.c'; fi`
+
+sound.o: $(SNDLIB)/sound.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sound.o -MD -MP -MF "$(DEPDIR)/sound.Tpo" -c -o sound.o `test -f '$(SNDLIB)/sound.c' || echo '$(srcdir)/'`$(SNDLIB)/sound.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sound.Tpo" "$(DEPDIR)/sound.Po"; else rm -f "$(DEPDIR)/sound.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(SNDLIB)/sound.c' object='sound.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sound.o `test -f '$(SNDLIB)/sound.c' || echo '$(srcdir)/'`$(SNDLIB)/sound.c
+
+sound.obj: $(SNDLIB)/sound.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sound.obj -MD -MP -MF "$(DEPDIR)/sound.Tpo" -c -o sound.obj `if test -f '$(SNDLIB)/sound.c'; then $(CYGPATH_W) '$(SNDLIB)/sound.c'; else $(CYGPATH_W) '$(srcdir)/$(SNDLIB)/sound.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sound.Tpo" "$(DEPDIR)/sound.Po"; else rm -f "$(DEPDIR)/sound.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(SNDLIB)/sound.c' object='sound.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sound.obj `if test -f '$(SNDLIB)/sound.c'; then $(CYGPATH_W) '$(SNDLIB)/sound.c'; else $(CYGPATH_W) '$(srcdir)/$(SNDLIB)/sound.c'; fi`
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+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)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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 $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; 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
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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 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
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+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
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-info-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/third_party/resample/src/filterkit.c b/third_party/resample/src/filterkit.c
new file mode 100644
index 00000000..5171b5ea
--- /dev/null
+++ b/third_party/resample/src/filterkit.c
@@ -0,0 +1,631 @@
+/*
+ * filterkit.c (library "filterkit.a"): Kaiser-windowed low-pass filter support.
+ */
+
+/* filterkit.c
+ *
+ * LpFilter() - Calculates the filter coeffs for a Kaiser-windowed low-pass
+ * filter with a given roll-off frequency. These coeffs
+ * are stored into a array of doubles.
+ * writeFilter() - Writes a filter to a file.
+ * makeFilter() - Calls LpFilter() to create a filter, then scales the double
+ * coeffs into an array of half words.
+ * readFilter() - Reads a filter from a file.
+ * FilterUp() - Applies a filter to a given sample when up-converting.
+ * FilterUD() - Applies a filter to a given sample when up- or down-
+ * converting.
+ * initZerox() - Initialization routine for the zerox() function. Must
+ * be called before zerox() is called. This routine loads
+ * the correct filter so zerox() can use it.
+ * zerox() - Given a pointer into a sample, finds a zero-crossing on the
+ * interval [pointer-1:pointer+2] by iteration.
+ * Query() - Ask the user for a yes/no question with prompt, default,
+ * and optional help.
+ * GetUShort() - Ask the user for a unsigned short with prompt, default,
+ * and optional help.
+ * GetDouble() - Ask the user for a double with prompt, default, and
+ * optional help.
+ * GetString() - Ask the user for a string with prompt, default, and
+ * optional help.
+ */
+
+#include "resample.h"
+#include "filterkit.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
+/*
+ * Getstr() will print the passed "prompt" as a message to the user, and
+ * wait for the user to type an input string. The string is
+ * then copied into "answer". If the user types just a carriage
+ * return, then the string "defaultAnswer" is copied into "answer".
+ * ???
+ * "Answer" and "defaultAnswer" may be the same string, in which case,
+ * the defaultAnswer value will be the original contents of "answer".
+ * ???
+ */
+static void getstr(char *prompt, char *defaultAnswer, char *answer)
+{
+ char *p,s[200];
+
+ printf("%s (defaultAnswer = %s):",prompt,defaultAnswer);
+ strcpy(s, prompt);
+ if (!(*s))
+ strcpy(s, "input:");
+ p = s;
+ while (*p && *p != '(')
+ p++;
+ p--;
+ while (*p == ' ')
+ p--;
+ *(++p) = '\0';
+
+ /* gets(answer); */
+ fgets(answer,sizeof(answer),stdin);
+ answer[strlen(answer)-1] = '\0';
+
+ if (answer[0] == '\0') {
+ strcpy(answer, defaultAnswer);
+ printf("\t%s = %s\n",s,answer);
+ } else {
+ printf("\t%s set to %s\n",s,answer);
+ }
+}
+
+
+/* LpFilter()
+ *
+ * reference: "Digital Filters, 2nd edition"
+ * R.W. Hamming, pp. 178-179
+ *
+ * Izero() computes the 0th order modified bessel function of the first kind.
+ * (Needed to compute Kaiser window).
+ *
+ * LpFilter() computes the coeffs of a Kaiser-windowed low pass filter with
+ * the following characteristics:
+ *
+ * c[] = array in which to store computed coeffs
+ * frq = roll-off frequency of filter
+ * N = Half the window length in number of coeffs
+ * Beta = parameter of Kaiser window
+ * Num = number of coeffs before 1/frq
+ *
+ * Beta trades the rejection of the lowpass filter against the transition
+ * width from passband to stopband. Larger Beta means a slower
+ * transition and greater stopband rejection. See Rabiner and Gold
+ * (Theory and Application of DSP) under Kaiser windows for more about
+ * Beta. The following table from Rabiner and Gold gives some feel
+ * for the effect of Beta:
+ *
+ * All ripples in dB, width of transition band = D*N where N = window length
+ *
+ * BETA D PB RIP SB RIP
+ * 2.120 1.50 +-0.27 -30
+ * 3.384 2.23 0.0864 -40
+ * 4.538 2.93 0.0274 -50
+ * 5.658 3.62 0.00868 -60
+ * 6.764 4.32 0.00275 -70
+ * 7.865 5.0 0.000868 -80
+ * 8.960 5.7 0.000275 -90
+ * 10.056 6.4 0.000087 -100
+ */
+
+
+#define IzeroEPSILON 1E-21 /* Max error acceptable in Izero */
+
+static double Izero(double x)
+{
+ double sum, u, halfx, temp;
+ int n;
+
+ sum = u = n = 1;
+ halfx = x/2.0;
+ do {
+ temp = halfx/(double)n;
+ n += 1;
+ temp *= temp;
+ u *= temp;
+ sum += u;
+ } while (u >= IzeroEPSILON*sum);
+ return(sum);
+}
+
+
+void LpFilter(double c[], int N, double frq, double Beta, int Num)
+{
+ double IBeta, temp, inm1;
+ int i;
+
+ /* Calculate ideal lowpass filter impulse response coefficients: */
+ c[0] = 2.0*frq;
+ for (i=1; i<N; i++) {
+ temp = PI*(double)i/(double)Num;
+ c[i] = sin(2.0*temp*frq)/temp; /* Analog sinc function, cutoff = frq */
+ }
+
+ /*
+ * Calculate and Apply Kaiser window to ideal lowpass filter.
+ * Note: last window value is IBeta which is NOT zero.
+ * You're supposed to really truncate the window here, not ramp
+ * it to zero. This helps reduce the first sidelobe.
+ */
+ IBeta = 1.0/Izero(Beta);
+ inm1 = 1.0/((double)(N-1));
+ for (i=1; i<N; i++) {
+ temp = (double)i * inm1;
+ c[i] *= Izero(Beta*sqrt(1.0-temp*temp)) * IBeta;
+ }
+}
+
+
+/* Write a filter to a file
+ * Filter file format:
+ * file name: "F" Nmult "T" Nhc ".filter"
+ * 1st line: the string "ScaleFactor" followed by its value.
+ * 2nd line: the string "Length" followed by Nwing's value.
+ * 3rd line: the string "Nmult" followed by Nmult's value.
+ * 4th line: the string "Coeffs:" on a separate line.
+ * following lines: Nwing number of 16-bit impulse response values
+ * in the right wing of the impulse response (the Imp[] array).
+ * (Nwing is equal to Npc*(Nmult+1)/2+1, where Npc is defined in the
+ * file "resample.h".) Each coefficient is on a separate line.
+ * next line: the string "Differences:" on a separate line.
+ * following lines: Nwing number of 16-bit impulse-response
+ * successive differences: ImpD[i] = Imp[i+1] - Imp[i].
+ * ERROR codes:
+ * 0 - no error
+ * 1 - could not open file
+ */
+
+int writeFilter(HWORD Imp[], HWORD ImpD[], UHWORD LpScl, UHWORD Nmult,
+ UHWORD Nwing)
+{
+ char fname[30];
+ FILE *fp;
+ int i;
+
+ sprintf(fname, "F%dT%d.filter", Nmult, Nhc);
+ fp = fopen(fname, "w");
+ if (!fp)
+ return(1);
+ fprintf(fp, "ScaleFactor %d\n", LpScl);
+ fprintf(fp, "Length %d\n", Nwing);
+ fprintf(fp, "Nmult %d\n", Nmult);
+ fprintf(fp, "Coeffs:\n");
+ for (i=0; i<Nwing; i++) /* Put array of 16-bit filter coefficients */
+ fprintf(fp, "%d\n", Imp[i]);
+ fprintf(fp, "Differences:\n");
+ for (i=0; i<Nwing; i++) /* Put array of 16-bit filter coeff differences */
+ fprintf(fp, "%d\n", ImpD[i]);
+ fclose(fp);
+ printf("Wrote filter file '%s' in current directory.\n",fname);
+ return(0);
+}
+
+
+/* ERROR return codes:
+ * 0 - no error
+ * 1 - Nwing too large (Nwing is > MAXNWING)
+ * 2 - Froll is not in interval [0:1)
+ * 3 - Beta is < 1.0
+ * 4 - LpScl will not fit in 16-bits
+ *
+ * Made following global to avoid stack problems in Sun3 compilation: */
+
+#define MAXNWING 8192
+static double ImpR[MAXNWING];
+
+int makeFilter(HWORD Imp[], HWORD ImpD[], UHWORD *LpScl, UHWORD Nwing,
+ double Froll, double Beta)
+{
+ double DCgain, Scl, Maxh;
+ HWORD Dh;
+ int i, temp;
+
+ if (Nwing > MAXNWING) /* Check for valid parameters */
+ return(1);
+ if ((Froll<=0) || (Froll>1))
+ return(2);
+ if (Beta < 1)
+ return(3);
+
+ /*
+ * Design Kaiser-windowed sinc-function low-pass filter
+ */
+ LpFilter(ImpR, (int)Nwing, 0.5*Froll, Beta, Npc);
+
+ /* Compute the DC gain of the lowpass filter, and its maximum coefficient
+ * magnitude. Scale the coefficients so that the maximum coeffiecient just
+ * fits in Nh-bit fixed-point, and compute LpScl as the NLpScl-bit (signed)
+ * scale factor which when multiplied by the output of the lowpass filter
+ * gives unity gain. */
+ DCgain = 0;
+ Dh = Npc; /* Filter sampling period for factors>=1 */
+ for (i=Dh; i<Nwing; i+=Dh)
+ DCgain += ImpR[i];
+ DCgain = 2*DCgain + ImpR[0]; /* DC gain of real coefficients */
+
+ for (Maxh=i=0; i<Nwing; i++)
+ Maxh = MAX(Maxh, fabs(ImpR[i]));
+
+ Scl = ((1<<(Nh-1))-1)/Maxh; /* Map largest coeff to 16-bit maximum */
+ temp = fabs((1<<(NLpScl+Nh))/(DCgain*Scl));
+ if (temp >= 1<<16)
+ return(4); /* Filter scale factor overflows UHWORD */
+ *LpScl = temp;
+
+ /* Scale filter coefficients for Nh bits and convert to integer */
+ if (ImpR[0] < 0) /* Need pos 1st value for LpScl storage */
+ Scl = -Scl;
+ for (i=0; i<Nwing; i++) /* Scale them */
+ ImpR[i] *= Scl;
+ for (i=0; i<Nwing; i++) /* Round them */
+ Imp[i] = ImpR[i] + 0.5;
+
+ /* ImpD makes linear interpolation of the filter coefficients faster */
+ for (i=0; i<Nwing-1; i++)
+ ImpD[i] = Imp[i+1] - Imp[i];
+ ImpD[Nwing-1] = - Imp[Nwing-1]; /* Last coeff. not interpolated */
+
+ return(0);
+}
+
+
+/* Read-in a filter
+ * Filter file format:
+ * file name: "F" Nmult "T" Nhc ".filter"
+ * 1st line: the string "ScaleFactor" followed by its value.
+ * 2nd line: the string "Length" followed by Nwing's value.
+ * 3rd line: the string "Coeffs:" on separate line.
+ * Nwing number of 16-bit impulse response values in the right
+ * wing of the impulse response. (Length=Npc*(Nmult+1)/2+1,
+ * where originally Npc=2^9, and Nmult=13.) Each on separate line.
+ * The string "Differences:" on separate line.
+ * Nwing number of 16-bit impulse-response successive differences:
+ * ImpDiff[i] = Imp[i+1] - Imp[i].
+ *
+ * ERROR return codes:
+ * 0 - no error
+ * 1 - file not found
+ * 2 - invalid ScaleFactor in file
+ * 3 - invalid Length in file
+ * 4 - invalid Nmult in file
+ */
+int readFilter(char *filterFile, HWORD **ImpP, HWORD **ImpDP, UHWORD *LpScl,
+ UHWORD *Nmult, UHWORD *Nwing)
+{
+ char *fname;
+ FILE *fp;
+ int i, temp;
+ HWORD *Imp,*ImpD;
+
+ if (!filterFile || !(*filterFile)) {
+ fname = (char *) malloc(32);
+ if ((*Nmult)>0 && ((*Nmult)&1))
+ sprintf(fname, "F%dT%d.filter", *Nmult, Nhc);
+ else
+ sprintf(fname, "F65dT%d.filter", Nhc);
+ } else
+ fname = filterFile;
+
+ fp = fopen(fname, "r");
+ if (fp == NULL)
+ return(1);
+
+ fscanf(fp, "ScaleFactor ");
+ if (1 != fscanf(fp,"%d",&temp))
+ return(2);
+ *LpScl = temp;
+
+ fscanf(fp, "\nLength ");
+ if (1 != fscanf(fp,"%d",&temp))
+ return(3);
+ *Nwing = temp;
+
+ fscanf(fp, "\nNmult ");
+ if (1 != fscanf(fp,"%d",&temp))
+ return(4);
+ *Nmult = temp;
+
+ Imp = (HWORD *) malloc(*Nwing * sizeof(HWORD));
+
+ fscanf(fp, "\nCoeffs:\n");
+ for (i=0; i<*Nwing; i++) { /* Get array of 16-bit filter coefficients */
+ fscanf(fp, "%d\n", &temp);
+ Imp[i] = temp;
+ }
+
+ ImpD = (HWORD *) malloc(*Nwing * sizeof(HWORD));
+
+ fscanf(fp, "\nDifferences:\n");
+ for (i=0; i<*Nwing; i++) { /* Get array of 16bit filter coeff differences */
+ fscanf(fp, "%d\n", &temp);
+ ImpD[i] = temp;
+ }
+
+ fclose(fp);
+ if (!filterFile || !(*filterFile))
+ free(fname);
+ *ImpP = Imp;
+ *ImpDP = ImpD;
+ return(0);
+}
+
+
+WORD FilterUp(HWORD Imp[], HWORD ImpD[],
+ UHWORD Nwing, BOOL Interp,
+ HWORD *Xp, HWORD Ph, HWORD Inc)
+{
+ HWORD *Hp, *Hdp = NULL, *End;
+ HWORD a = 0;
+ WORD v, t;
+
+ v=0;
+ Hp = &Imp[Ph>>Na];
+ End = &Imp[Nwing];
+ if (Interp) {
+ Hdp = &ImpD[Ph>>Na];
+ a = Ph & Amask;
+ }
+ if (Inc == 1) /* If doing right wing... */
+ { /* ...drop extra coeff, so when Ph is */
+ End--; /* 0.5, we don't do too many mult's */
+ if (Ph == 0) /* If the phase is zero... */
+ { /* ...then we've already skipped the */
+ Hp += Npc; /* first sample, so we must also */
+ Hdp += Npc; /* skip ahead in Imp[] and ImpD[] */
+ }
+ }
+ if (Interp)
+ while (Hp < End) {
+ t = *Hp; /* Get filter coeff */
+ t += (((WORD)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */
+ Hdp += Npc; /* Filter coeff differences step */
+ t *= *Xp; /* Mult coeff by input sample */
+ if (t & (1<<(Nhxn-1))) /* Round, if needed */
+ t += (1<<(Nhxn-1));
+ t >>= Nhxn; /* Leave some guard bits, but come back some */
+ v += t; /* The filter output */
+ Hp += Npc; /* Filter coeff step */
+ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */
+ }
+ else
+ while (Hp < End) {
+ t = *Hp; /* Get filter coeff */
+ t *= *Xp; /* Mult coeff by input sample */
+ if (t & (1<<(Nhxn-1))) /* Round, if needed */
+ t += (1<<(Nhxn-1));
+ t >>= Nhxn; /* Leave some guard bits, but come back some */
+ v += t; /* The filter output */
+ Hp += Npc; /* Filter coeff step */
+ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */
+ }
+ return(v);
+}
+
+WORD FilterUD( HWORD Imp[], HWORD ImpD[],
+ UHWORD Nwing, BOOL Interp,
+ HWORD *Xp, HWORD Ph, HWORD Inc, UHWORD dhb)
+{
+ HWORD a;
+ HWORD *Hp, *Hdp, *End;
+ WORD v, t;
+ UWORD Ho;
+
+ v=0;
+ Ho = (Ph*(UWORD)dhb)>>Np;
+ End = &Imp[Nwing];
+ if (Inc == 1) /* If doing right wing... */
+ { /* ...drop extra coeff, so when Ph is */
+ End--; /* 0.5, we don't do too many mult's */
+ if (Ph == 0) /* If the phase is zero... */
+ Ho += dhb; /* ...then we've already skipped the */
+ } /* first sample, so we must also */
+ /* skip ahead in Imp[] and ImpD[] */
+ if (Interp)
+ while ((Hp = &Imp[Ho>>Na]) < End) {
+ t = *Hp; /* Get IR sample */
+ Hdp = &ImpD[Ho>>Na]; /* get interp (lower Na) bits from diff table*/
+ a = Ho & Amask; /* a is logically between 0 and 1 */
+ t += (((WORD)*Hdp)*a)>>Na; /* t is now interp'd filter coeff */
+ t *= *Xp; /* Mult coeff by input sample */
+ if (t & 1<<(Nhxn-1)) /* Round, if needed */
+ t += 1<<(Nhxn-1);
+ t >>= Nhxn; /* Leave some guard bits, but come back some */
+ v += t; /* The filter output */
+ Ho += dhb; /* IR step */
+ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */
+ }
+ else
+ while ((Hp = &Imp[Ho>>Na]) < End) {
+ t = *Hp; /* Get IR sample */
+ t *= *Xp; /* Mult coeff by input sample */
+ if (t & 1<<(Nhxn-1)) /* Round, if needed */
+ t += 1<<(Nhxn-1);
+ t >>= Nhxn; /* Leave some guard bits, but come back some */
+ v += t; /* The filter output */
+ Ho += dhb; /* IR step */
+ Xp += Inc; /* Input signal step. NO CHECK ON BOUNDS */
+ }
+ return(v);
+}
+
+/*
+ * double zerox(Data, Factor)
+ * HWORD *Data;
+ * double Factor;
+ * Given a pointer into a sound sample, this function uses a low-pass
+ * filter to estimate the x coordinate of the zero-crossing which must ocurr
+ * between Data[0] and Data[1]. This value is returned as the value of the
+ * function. A return value of -100 indicates there was no zero-crossing in
+ * the x interval [-1,2]. Factor is the resampling factor: Rate(out) /
+ * Rate(in). Nmult (which determines which filter is used) is passed the
+ * zerox's initialization routine: initZerox(Nmult)
+ * UHWORD Nmult;
+ */
+
+static UHWORD LpScl, Nmult, Nwing;
+static HWORD *Imp;
+static HWORD *ImpD;
+
+/* ERROR return values:
+ * 0 - no error
+ * 1 - Nmult is even (should be odd)
+ * 2 - filter file not found
+ * 3 - invalid ScaleFactor in input file
+ * 4 - invalid Length in file
+ * 5 - invalid Nmult in file
+ */
+int initZerox(UHWORD tempNmult)
+{
+ int err;
+
+ /* Check for illegal input values */
+ if (!(tempNmult % 2))
+ return(1);
+ err = readFilter(NULL, (HWORD **)&Imp, (HWORD **)&ImpD,
+ &LpScl, &tempNmult, &Nwing);
+ if (err)
+ return(1+err);
+
+ Nmult = tempNmult;
+ return(0);
+}
+
+#define MAXITER 64
+#define ZeroxEPSILON (1E-4)
+#define ZeroxMAXERROR (5.0)
+
+double zerox(HWORD *Data, double Factor)
+{
+ double x, out;
+ double lo, hi;
+ double dh;
+ UWORD dhb;
+ WORD v;
+ int i;
+
+ if (!Data[0])
+ return (0.0);
+ if (!Data[1])
+ return (1.0);
+
+ if (Data[0] < Data[1])
+ {
+ lo = -1.0;
+ hi = 2.0;
+ }
+ else
+ {
+ lo = 2.0;
+ hi = -1.0;
+ }
+ dh = (Factor<1) ? (Factor*Npc) : (Npc);
+ dhb = dh * (1<<Na) + 0.5;
+
+ for (i=0; i<MAXITER; i++)
+ {
+ x = (hi+lo)/2.0;
+ v = FilterUD(Imp,ImpD,Nwing,TRUE,Data, (HWORD)(x*Pmask), -1,dhb);
+ v += FilterUD(Imp,ImpD,Nwing,TRUE,Data+1,(HWORD)((1-x)*Pmask), 1,dhb);
+ v >>= Nhg;
+ v *= LpScl;
+ out = (double)v / (double)(1<<NLpScl);
+ if (out < 0.0)
+ lo = x;
+ else
+ hi = x;
+ if (ABS(out) <= ZeroxEPSILON)
+ return(x);
+ }
+ printf("|ZeroX Error| x:%g, \t Data[x]:%d, \t Data[x+1]:%d\n",
+ x, *Data, *(Data+1));
+ printf("|\tABS(out):%g \t EPSILON:%g\n", ABS(out),ZeroxEPSILON);
+ if (ABS(out) <= ZeroxMAXERROR)
+ return(x);
+ return(-100.0);
+}
+
+
+BOOL Query(char *prompt, BOOL deflt, char *help)
+{
+ char s[80];
+
+ while (TRUE)
+ {
+ sprintf(s,"\n%s%s", prompt, (*help) ? " (Type ? for help)" : "");
+ getstr(s,(deflt)?"yes":"no",s);
+ if (*s=='?' && *help)
+ printf(help);
+ if (*s=='Y' || *s=='y')
+ return(TRUE);
+ if (*s=='N' || *s=='n')
+ return(FALSE);
+ }
+}
+
+
+char *GetString(char *prompt, char *deflt, char *help)
+{
+ static char s[200];
+
+ while (TRUE)
+ {
+ sprintf(s,"\n%s%s",prompt, (*help) ? " (Type ? for Help)" : "");
+ getstr(s,deflt,s);
+ if (*s=='?' && *help)
+ printf(help);
+ else
+ return(s);
+ }
+}
+
+
+double GetDouble(char *title, double deflt, char *help)
+{
+ char s[80],sdeflt[80];
+ double newval;
+
+ while (TRUE)
+ {
+ sprintf(s,"\n%s:%s",title, (*help) ? " (Type ? for Help)" : "");
+ sprintf(sdeflt,"%g",deflt);
+ getstr(s,sdeflt,s);
+ if (*s=='?' && *help)
+ printf(help);
+ else
+ {
+ if (!sscanf(s,"%lf",&newval))
+ return(deflt);
+ return(newval);
+ }
+ }
+}
+
+
+unsigned short GetUShort(char *title, unsigned short deflt, char *help)
+{
+ char s[80],sdeflt[80];
+ int newval;
+
+ while (TRUE)
+ {
+ sprintf(s,"\n%s:%s",title, (*help) ? " (Type ? for Help)" : "");
+ sprintf(sdeflt,"%d",deflt);
+ getstr(s,sdeflt,s);
+ if (*s=='?' && *help)
+ printf(help);
+ else
+ {
+ if (!sscanf(s,"%d",&newval))
+ printf("unchanged (%d)\n",(newval=deflt));
+ if (newval < 0)
+ printf("Error: value must be >= zero\n");
+ else
+ return(newval);
+ }
+ }
+}
diff --git a/third_party/resample/src/filterkit.h b/third_party/resample/src/filterkit.h
new file mode 100644
index 00000000..c0d5e97c
--- /dev/null
+++ b/third_party/resample/src/filterkit.h
@@ -0,0 +1,159 @@
+/*:filterkit.h */
+
+#include "stdefs.h"
+
+/*
+ * LpFilter() - Calculates the filter coeffs for a Kaiser-windowed low-pass
+ * filter with a given roll-off frequency. These coeffs
+ * are stored into a array of doubles.
+ * writeFilter() - Writes a filter to a file.
+ * makeFilter() - Calls LpFilter() to create a filter, then scales the double
+ * coeffs into an array of half words.
+ * readFilter() - Reads a filter from a file.
+ * FilterUp() - Applies a filter to a given sample when up-converting.
+ * FilterUD() - Applies a filter to a given sample when up- or down-
+ * converting.
+ * initZerox() - Initialization routine for the zerox() function. Must
+ * be called before zerox() is called. This routine loads
+ * the correct filter so zerox() can use it.
+ * zerox() - Given a pointer into a sample, finds a zero-crossing on the
+ * interval [pointer-1:pointer+2] by iteration.
+ * Query() - Ask the user for a yes/no question with prompt, default,
+ * and optional help.
+ * GetUShort() - Ask the user for a unsigned short with prompt, default,
+ * and optional help.
+ * GetDouble() - Ask the user for a double with prompt, default, and
+ * optional help.
+ * GetString() - Ask the user for a string with prompt, default, and
+ * optional help.
+ */
+
+void LpFilter(double c[], int N, double frq, double Beta, int Num);
+/*
+ * reference: "Digital Filters, 2nd edition"
+ * R.W. Hamming, pp. 178-179
+ *
+ * LpFilter() computes the coeffs of a Kaiser-windowed low pass filter with
+ * the following characteristics:
+ *
+ * c[] = array in which to store computed coeffs
+ * frq = roll-off frequency of filter
+ * N = Half the window length in number of coeffs
+ * Beta = parameter of Kaiser window
+ * Num = number of coeffs before 1/frq
+ *
+ * Beta trades the rejection of the lowpass filter against the transition
+ * width from passband to stopband. Larger Beta means a slower
+ * transition and greater stopband rejection. See Rabiner and Gold
+ * (Theory and Application of DSP) under Kaiser windows for more about
+ * Beta. The following table from Rabiner and Gold gives some feel
+ * for the effect of Beta:
+ *
+ * All ripples in dB, width of transition band = D*N where N = window length
+ *
+ * BETA D PB RIP SB RIP
+ * 2.120 1.50 +-0.27 -30
+ * 3.384 2.23 0.0864 -40
+ * 4.538 2.93 0.0274 -50
+ * 5.658 3.62 0.00868 -60
+ * 6.764 4.32 0.00275 -70
+ * 7.865 5.0 0.000868 -80
+ * 8.960 5.7 0.000275 -90
+ * 10.056 6.4 0.000087 -100
+ */
+
+int writeFilter(HWORD Imp[], HWORD ImpD[], UHWORD LpScl, UHWORD Nmult, UHWORD Nwing);
+/*
+ * Write a filter to a file
+ * Filter file format:
+ * file name: "F" Nmult "T" Nhc ".filter"
+ * 1st line: the string "ScaleFactor" followed by its value.
+ * 2nd line: the string "Length" followed by Nwing's value.
+ * 3rd line: the string "Coeffs:" on a separate line.
+ * following lines: Nwing number of 16-bit impulse response values
+ * in the right wing of the impulse response (the Imp[] array).
+ * (Nwing is equal to Npc*(Nmult+1)/2+1, where Npc is defined in the
+ * file "resample.h".) Each coefficient is on a separate line.
+ * next line: the string "Differences:" on a separate line.
+ * following lines: Nwing number of 16-bit impulse-response
+ * successive differences: ImpD[i] = Imp[i+1] - Imp[i].
+ * ERROR codes:
+ * 0 - no error
+ * 1 - could not open file
+ */
+
+int makeFilter(HWORD Imp[], HWORD ImpD[], UHWORD *LpScl, UHWORD Nwing,
+ double Froll, double Beta);
+/*
+ * makeFilter
+ * ERROR return codes:
+ * 0 - no error
+ * 1 - Nwing too large (Nwing is > MAXNWING)
+ * 2 - Froll is not in interval [0:1)
+ * 3 - Beta is < 1.0
+ * 4 - LpScl will not fit in 16-bits
+ */
+
+int readFilter(char *filterFile,
+ HWORD **ImpP, HWORD **ImpDP, UHWORD *LpScl,
+ UHWORD *Nmult, UHWORD *Nwing);
+/*
+ * Read-in a filter
+ * Filter file format:
+ * Default file name: "F" Nmult "T" Nhc ".filter"
+ * 1st line: the string "ScaleFactor" followed by its value.
+ * 2nd line: the string "Length" followed by Nwing's value.
+ * 3rd line: the string "Coeffs:" on separate line.
+ * Nwing number of 16-bit impulse response values in the right
+ * wing of the impulse response. (Length=Npc*(Nmult+1)/2+1,
+ * where originally Npc=2^9, and Nmult=13.) Each on separate line.
+ * The string "Differences:" on separate line.
+ * Nwing number of 16-bit impulse-response successive differences:
+ * ImpDiff[i] = Imp[i+1] - Imp[i].
+ *
+ * ERROR return codes:
+ * 0 - no error
+ * 1 - file not found
+ * 2 - invalid ScaleFactor in file
+ * 3 - invalid Length in file
+ */
+
+WORD FilterUp(HWORD Imp[], HWORD ImpD[], UHWORD Nwing, BOOL Interp,
+ HWORD *Xp, HWORD Inc, HWORD Ph);
+
+WORD FilterUD(HWORD Imp[], HWORD ImpD[], UHWORD Nwing, BOOL Interp,
+ HWORD *Xp, HWORD Ph, HWORD Inc, UHWORD dhb);
+
+int initZerox(UHWORD tempNmult);
+/*
+ * initZerox
+ * ERROR return values:
+ * 0 - no error
+ * 1 - Nmult is even (should be odd)
+ * 2 - filter file not found
+ * 3 - invalid ScaleFactor in input file
+ * 4 - invalid Length in file
+ */
+
+/*
+ * zerox
+ * Given a pointer into a sound sample, this function uses a low-pass
+ * filter to estimate the x coordinate of the zero-crossing which must ocurr
+ * between Data[0] and Data[1]. This value is returned as the value of the
+ * function. A return value of -100 indicates there was no zero-crossing in
+ * the x interval [-1,2]. Factor is the resampling factor: Rate(out) /
+ * Rate(in). Nmult (which determines which filter is used) is passed the
+ * zerox's initialization routine: initZerox(Nmult)
+ */
+double zerox(HWORD *Data, double Factor);
+
+BOOL Query(char *prompt, BOOL deflt, char *help);
+
+unsigned short GetUShort(char *title, unsigned short deflt, char *help);
+
+double GetDouble(char *title, double deflt, char *help);
+
+char *GetString(char *prompt, char *deflt, char *help);
+
+#define GetUHWORD(x,y,z) GetUShort(x,y,z)
+
diff --git a/third_party/resample/src/largefilter.h b/third_party/resample/src/largefilter.h
new file mode 100644
index 00000000..7a86dd40
--- /dev/null
+++ b/third_party/resample/src/largefilter.h
@@ -0,0 +1,16411 @@
+/* Included by resamplesubs.c */
+
+/*
+
+ USAGE: resample -expensiveFilter ...
+
+The -expensiveFilter option (-e) for resample selects the 'expensive'
+preloaded resampling filter. The default filter requires an
+oversampling factor of around 20% to avoid aliasing. The expensive
+filter is five times more computationally expensive and requires only
+about a 5-10% oversampling factor. Both filters have comparable
+stop-band attenuations (approximately 80 dB). If both options -f and
+-e are present, the last one on the command line takes effect. The
+expensive filter is not yet documented because its cut-off frequency
+should be retuned slightly for optimal performance. Also, we plan to
+compute truly optimized resampling filters sometime in the future. In
+the meantime, the default filter is fast, well tuned, and works very
+well for its level of computational expense.
+
+*/
+
+#define LARGE_FILTER_NMULT ((HWORD)65)
+#define LARGE_FILTER_SCALE 14746 /* Unity-gain scale factor */
+#define LARGE_FILTER_NWING 8192 /* Filter table length */
+static HWORD LARGE_FILTER_IMP[] /* Impulse response */ = {
+32767,
+32766,
+32764,
+32761,
+32756,
+32750,
+32743,
+32734,
+32724,
+32713,
+32700,
+32686,
+32671,
+32654,
+32636,
+32617,
+32596,
+32574,
+32551,
+32526,
+32500,
+32473,
+32445,
+32415,
+32383,
+32351,
+32317,
+32282,
+32246,
+32208,
+32169,
+32129,
+32087,
+32044,
+32000,
+31955,
+31908,
+31860,
+31811,
+31760,
+31708,
+31655,
+31601,
+31545,
+31489,
+31431,
+31371,
+31311,
+31249,
+31186,
+31122,
+31056,
+30990,
+30922,
+30853,
+30783,
+30711,
+30639,
+30565,
+30490,
+30414,
+30337,
+30258,
+30179,
+30098,
+30016,
+29933,
+29849,
+29764,
+29677,
+29590,
+29501,
+29411,
+29321,
+29229,
+29136,
+29042,
+28947,
+28851,
+28753,
+28655,
+28556,
+28456,
+28354,
+28252,
+28149,
+28044,
+27939,
+27833,
+27725,
+27617,
+27508,
+27398,
+27287,
+27175,
+27062,
+26948,
+26833,
+26717,
+26601,
+26483,
+26365,
+26246,
+26125,
+26005,
+25883,
+25760,
+25637,
+25512,
+25387,
+25261,
+25135,
+25007,
+24879,
+24750,
+24620,
+24490,
+24358,
+24226,
+24094,
+23960,
+23826,
+23691,
+23556,
+23420,
+23283,
+23146,
+23008,
+22869,
+22730,
+22590,
+22449,
+22308,
+22166,
+22024,
+21881,
+21738,
+21594,
+21449,
+21304,
+21159,
+21013,
+20866,
+20719,
+20572,
+20424,
+20275,
+20127,
+19977,
+19828,
+19678,
+19527,
+19376,
+19225,
+19073,
+18921,
+18769,
+18616,
+18463,
+18310,
+18157,
+18003,
+17849,
+17694,
+17539,
+17384,
+17229,
+17074,
+16918,
+16762,
+16606,
+16450,
+16294,
+16137,
+15980,
+15823,
+15666,
+15509,
+15352,
+15195,
+15037,
+14880,
+14722,
+14564,
+14407,
+14249,
+14091,
+13933,
+13775,
+13618,
+13460,
+13302,
+13144,
+12987,
+12829,
+12671,
+12514,
+12356,
+12199,
+12042,
+11885,
+11728,
+11571,
+11414,
+11257,
+11101,
+10945,
+10789,
+10633,
+10477,
+10322,
+10167,
+10012,
+9857,
+9702,
+9548,
+9394,
+9241,
+9087,
+8934,
+8781,
+8629,
+8477,
+8325,
+8174,
+8023,
+7872,
+7722,
+7572,
+7422,
+7273,
+7124,
+6976,
+6828,
+6681,
+6534,
+6387,
+6241,
+6096,
+5951,
+5806,
+5662,
+5518,
+5375,
+5233,
+5091,
+4949,
+4808,
+4668,
+4528,
+4389,
+4250,
+4112,
+3975,
+3838,
+3702,
+3566,
+3431,
+3297,
+3163,
+3030,
+2898,
+2766,
+2635,
+2505,
+2375,
+2246,
+2118,
+1990,
+1864,
+1738,
+1612,
+1487,
+1364,
+1240,
+1118,
+996,
+875,
+755,
+636,
+517,
+400,
+283,
+166,
+51,
+-63,
+-176,
+-289,
+-401,
+-513,
+-623,
+-733,
+-841,
+-949,
+-1056,
+-1162,
+-1268,
+-1372,
+-1476,
+-1578,
+-1680,
+-1781,
+-1881,
+-1980,
+-2078,
+-2176,
+-2272,
+-2367,
+-2462,
+-2556,
+-2648,
+-2740,
+-2831,
+-2921,
+-3010,
+-3098,
+-3185,
+-3271,
+-3356,
+-3441,
+-3524,
+-3606,
+-3688,
+-3768,
+-3848,
+-3926,
+-4004,
+-4080,
+-4156,
+-4231,
+-4304,
+-4377,
+-4449,
+-4519,
+-4589,
+-4658,
+-4726,
+-4792,
+-4858,
+-4923,
+-4987,
+-5050,
+-5111,
+-5172,
+-5232,
+-5291,
+-5349,
+-5406,
+-5462,
+-5517,
+-5571,
+-5624,
+-5675,
+-5726,
+-5776,
+-5825,
+-5873,
+-5920,
+-5966,
+-6011,
+-6055,
+-6098,
+-6140,
+-6181,
+-6222,
+-6261,
+-6299,
+-6336,
+-6372,
+-6407,
+-6441,
+-6475,
+-6507,
+-6538,
+-6569,
+-6598,
+-6626,
+-6654,
+-6680,
+-6706,
+-6730,
+-6754,
+-6777,
+-6798,
+-6819,
+-6839,
+-6858,
+-6876,
+-6893,
+-6909,
+-6924,
+-6938,
+-6951,
+-6964,
+-6975,
+-6986,
+-6995,
+-7004,
+-7012,
+-7019,
+-7025,
+-7030,
+-7035,
+-7038,
+-7040,
+-7042,
+-7043,
+-7043,
+-7042,
+-7040,
+-7038,
+-7034,
+-7030,
+-7025,
+-7019,
+-7012,
+-7004,
+-6996,
+-6986,
+-6976,
+-6965,
+-6954,
+-6941,
+-6928,
+-6914,
+-6899,
+-6884,
+-6867,
+-6850,
+-6832,
+-6814,
+-6794,
+-6774,
+-6753,
+-6732,
+-6709,
+-6686,
+-6663,
+-6638,
+-6613,
+-6587,
+-6561,
+-6534,
+-6506,
+-6478,
+-6448,
+-6419,
+-6388,
+-6357,
+-6325,
+-6293,
+-6260,
+-6226,
+-6192,
+-6157,
+-6122,
+-6086,
+-6049,
+-6012,
+-5975,
+-5936,
+-5897,
+-5858,
+-5818,
+-5778,
+-5737,
+-5695,
+-5653,
+-5611,
+-5568,
+-5524,
+-5480,
+-5436,
+-5391,
+-5345,
+-5300,
+-5253,
+-5207,
+-5159,
+-5112,
+-5064,
+-5015,
+-4966,
+-4917,
+-4868,
+-4818,
+-4767,
+-4716,
+-4665,
+-4614,
+-4562,
+-4510,
+-4457,
+-4404,
+-4351,
+-4298,
+-4244,
+-4190,
+-4136,
+-4081,
+-4026,
+-3971,
+-3916,
+-3860,
+-3804,
+-3748,
+-3692,
+-3635,
+-3578,
+-3521,
+-3464,
+-3406,
+-3349,
+-3291,
+-3233,
+-3175,
+-3117,
+-3058,
+-3000,
+-2941,
+-2882,
+-2823,
+-2764,
+-2705,
+-2646,
+-2587,
+-2527,
+-2468,
+-2408,
+-2349,
+-2289,
+-2229,
+-2169,
+-2110,
+-2050,
+-1990,
+-1930,
+-1870,
+-1811,
+-1751,
+-1691,
+-1631,
+-1571,
+-1512,
+-1452,
+-1392,
+-1333,
+-1273,
+-1214,
+-1154,
+-1095,
+-1036,
+-977,
+-918,
+-859,
+-800,
+-741,
+-683,
+-624,
+-566,
+-508,
+-450,
+-392,
+-335,
+-277,
+-220,
+-163,
+-106,
+-49,
+6,
+63,
+119,
+175,
+230,
+286,
+341,
+396,
+450,
+505,
+559,
+613,
+667,
+720,
+773,
+826,
+878,
+931,
+983,
+1034,
+1086,
+1137,
+1187,
+1238,
+1288,
+1337,
+1387,
+1436,
+1484,
+1533,
+1581,
+1628,
+1675,
+1722,
+1769,
+1815,
+1861,
+1906,
+1951,
+1996,
+2040,
+2084,
+2127,
+2170,
+2212,
+2255,
+2296,
+2338,
+2378,
+2419,
+2459,
+2498,
+2538,
+2576,
+2615,
+2652,
+2690,
+2727,
+2763,
+2799,
+2834,
+2870,
+2904,
+2938,
+2972,
+3005,
+3038,
+3070,
+3102,
+3133,
+3164,
+3194,
+3224,
+3253,
+3282,
+3310,
+3338,
+3365,
+3392,
+3418,
+3444,
+3469,
+3494,
+3518,
+3542,
+3566,
+3588,
+3611,
+3632,
+3653,
+3674,
+3694,
+3714,
+3733,
+3752,
+3770,
+3788,
+3805,
+3821,
+3837,
+3853,
+3868,
+3882,
+3896,
+3910,
+3923,
+3935,
+3947,
+3958,
+3969,
+3980,
+3989,
+3999,
+4007,
+4016,
+4023,
+4031,
+4037,
+4044,
+4049,
+4054,
+4059,
+4063,
+4067,
+4070,
+4073,
+4075,
+4076,
+4077,
+4078,
+4078,
+4078,
+4077,
+4076,
+4074,
+4071,
+4068,
+4065,
+4061,
+4057,
+4052,
+4047,
+4041,
+4035,
+4028,
+4021,
+4013,
+4005,
+3997,
+3988,
+3978,
+3968,
+3958,
+3947,
+3936,
+3924,
+3912,
+3899,
+3886,
+3872,
+3858,
+3844,
+3829,
+3814,
+3798,
+3782,
+3766,
+3749,
+3731,
+3714,
+3696,
+3677,
+3658,
+3639,
+3619,
+3599,
+3578,
+3558,
+3536,
+3515,
+3493,
+3470,
+3448,
+3425,
+3401,
+3378,
+3353,
+3329,
+3304,
+3279,
+3254,
+3228,
+3202,
+3175,
+3149,
+3122,
+3094,
+3067,
+3039,
+3011,
+2982,
+2953,
+2924,
+2895,
+2865,
+2835,
+2805,
+2775,
+2744,
+2713,
+2682,
+2651,
+2619,
+2587,
+2555,
+2523,
+2490,
+2457,
+2424,
+2391,
+2358,
+2324,
+2290,
+2256,
+2222,
+2188,
+2153,
+2119,
+2084,
+2049,
+2014,
+1978,
+1943,
+1907,
+1872,
+1836,
+1800,
+1764,
+1727,
+1691,
+1655,
+1618,
+1581,
+1545,
+1508,
+1471,
+1434,
+1397,
+1360,
+1322,
+1285,
+1248,
+1210,
+1173,
+1135,
+1098,
+1060,
+1023,
+985,
+947,
+910,
+872,
+834,
+797,
+759,
+721,
+684,
+646,
+608,
+571,
+533,
+496,
+458,
+421,
+383,
+346,
+308,
+271,
+234,
+197,
+160,
+123,
+86,
+49,
+12,
+-23,
+-60,
+-96,
+-133,
+-169,
+-205,
+-241,
+-277,
+-313,
+-348,
+-384,
+-419,
+-455,
+-490,
+-525,
+-559,
+-594,
+-628,
+-663,
+-697,
+-731,
+-765,
+-798,
+-832,
+-865,
+-898,
+-931,
+-963,
+-996,
+-1028,
+-1060,
+-1092,
+-1124,
+-1155,
+-1186,
+-1217,
+-1248,
+-1279,
+-1309,
+-1339,
+-1369,
+-1398,
+-1428,
+-1457,
+-1486,
+-1514,
+-1542,
+-1571,
+-1598,
+-1626,
+-1653,
+-1680,
+-1707,
+-1733,
+-1760,
+-1785,
+-1811,
+-1836,
+-1862,
+-1886,
+-1911,
+-1935,
+-1959,
+-1982,
+-2006,
+-2029,
+-2051,
+-2074,
+-2096,
+-2118,
+-2139,
+-2160,
+-2181,
+-2202,
+-2222,
+-2242,
+-2261,
+-2280,
+-2299,
+-2318,
+-2336,
+-2354,
+-2372,
+-2389,
+-2406,
+-2423,
+-2439,
+-2455,
+-2470,
+-2486,
+-2500,
+-2515,
+-2529,
+-2543,
+-2557,
+-2570,
+-2583,
+-2595,
+-2607,
+-2619,
+-2631,
+-2642,
+-2652,
+-2663,
+-2673,
+-2683,
+-2692,
+-2701,
+-2710,
+-2718,
+-2726,
+-2734,
+-2741,
+-2748,
+-2754,
+-2760,
+-2766,
+-2772,
+-2777,
+-2782,
+-2786,
+-2790,
+-2794,
+-2797,
+-2800,
+-2803,
+-2805,
+-2807,
+-2809,
+-2810,
+-2811,
+-2812,
+-2812,
+-2812,
+-2812,
+-2811,
+-2810,
+-2808,
+-2807,
+-2804,
+-2802,
+-2799,
+-2796,
+-2792,
+-2789,
+-2785,
+-2780,
+-2775,
+-2770,
+-2765,
+-2759,
+-2753,
+-2746,
+-2740,
+-2732,
+-2725,
+-2717,
+-2709,
+-2701,
+-2692,
+-2683,
+-2674,
+-2664,
+-2655,
+-2644,
+-2634,
+-2623,
+-2612,
+-2601,
+-2589,
+-2577,
+-2565,
+-2552,
+-2539,
+-2526,
+-2513,
+-2499,
+-2485,
+-2471,
+-2457,
+-2442,
+-2427,
+-2412,
+-2396,
+-2380,
+-2364,
+-2348,
+-2331,
+-2315,
+-2297,
+-2280,
+-2263,
+-2245,
+-2227,
+-2209,
+-2190,
+-2171,
+-2152,
+-2133,
+-2114,
+-2094,
+-2075,
+-2055,
+-2034,
+-2014,
+-1993,
+-1972,
+-1951,
+-1930,
+-1909,
+-1887,
+-1865,
+-1843,
+-1821,
+-1799,
+-1776,
+-1754,
+-1731,
+-1708,
+-1685,
+-1662,
+-1638,
+-1614,
+-1591,
+-1567,
+-1543,
+-1519,
+-1494,
+-1470,
+-1445,
+-1421,
+-1396,
+-1371,
+-1346,
+-1321,
+-1295,
+-1270,
+-1244,
+-1219,
+-1193,
+-1167,
+-1142,
+-1116,
+-1090,
+-1064,
+-1037,
+-1011,
+-985,
+-958,
+-932,
+-905,
+-879,
+-852,
+-826,
+-799,
+-772,
+-745,
+-719,
+-692,
+-665,
+-638,
+-611,
+-584,
+-557,
+-530,
+-503,
+-476,
+-449,
+-422,
+-395,
+-368,
+-341,
+-314,
+-287,
+-260,
+-234,
+-207,
+-180,
+-153,
+-126,
+-100,
+-73,
+-46,
+-20,
+6,
+32,
+59,
+85,
+111,
+138,
+164,
+190,
+216,
+242,
+268,
+294,
+319,
+345,
+370,
+396,
+421,
+446,
+471,
+496,
+521,
+546,
+571,
+595,
+619,
+644,
+668,
+692,
+716,
+739,
+763,
+787,
+810,
+833,
+856,
+879,
+902,
+924,
+947,
+969,
+991,
+1013,
+1035,
+1056,
+1078,
+1099,
+1120,
+1141,
+1162,
+1182,
+1202,
+1223,
+1243,
+1262,
+1282,
+1301,
+1320,
+1339,
+1358,
+1377,
+1395,
+1413,
+1431,
+1449,
+1467,
+1484,
+1501,
+1518,
+1535,
+1551,
+1567,
+1583,
+1599,
+1615,
+1630,
+1645,
+1660,
+1674,
+1689,
+1703,
+1717,
+1731,
+1744,
+1757,
+1770,
+1783,
+1795,
+1808,
+1820,
+1831,
+1843,
+1854,
+1865,
+1876,
+1886,
+1897,
+1907,
+1916,
+1926,
+1935,
+1944,
+1953,
+1961,
+1970,
+1978,
+1985,
+1993,
+2000,
+2007,
+2014,
+2020,
+2026,
+2032,
+2038,
+2043,
+2048,
+2053,
+2058,
+2062,
+2066,
+2070,
+2073,
+2077,
+2080,
+2083,
+2085,
+2087,
+2089,
+2091,
+2093,
+2094,
+2095,
+2095,
+2096,
+2096,
+2096,
+2096,
+2095,
+2094,
+2093,
+2092,
+2090,
+2088,
+2086,
+2084,
+2081,
+2079,
+2075,
+2072,
+2069,
+2065,
+2061,
+2056,
+2052,
+2047,
+2042,
+2037,
+2031,
+2025,
+2019,
+2013,
+2006,
+2000,
+1993,
+1986,
+1978,
+1971,
+1963,
+1955,
+1946,
+1938,
+1929,
+1920,
+1911,
+1901,
+1892,
+1882,
+1872,
+1862,
+1851,
+1841,
+1830,
+1819,
+1807,
+1796,
+1784,
+1772,
+1760,
+1748,
+1735,
+1723,
+1710,
+1697,
+1684,
+1670,
+1657,
+1643,
+1629,
+1615,
+1601,
+1586,
+1572,
+1557,
+1542,
+1527,
+1512,
+1496,
+1481,
+1465,
+1449,
+1433,
+1417,
+1401,
+1384,
+1368,
+1351,
+1334,
+1317,
+1300,
+1283,
+1265,
+1248,
+1230,
+1212,
+1195,
+1177,
+1159,
+1140,
+1122,
+1104,
+1085,
+1067,
+1048,
+1029,
+1010,
+991,
+972,
+953,
+934,
+915,
+895,
+876,
+856,
+837,
+817,
+797,
+777,
+758,
+738,
+718,
+698,
+678,
+658,
+637,
+617,
+597,
+577,
+556,
+536,
+516,
+495,
+475,
+454,
+434,
+414,
+393,
+373,
+352,
+332,
+311,
+291,
+270,
+250,
+229,
+208,
+188,
+168,
+147,
+127,
+106,
+86,
+65,
+45,
+25,
+5,
+-15,
+-35,
+-55,
+-75,
+-95,
+-115,
+-135,
+-155,
+-175,
+-195,
+-215,
+-234,
+-254,
+-274,
+-293,
+-313,
+-332,
+-351,
+-370,
+-390,
+-409,
+-428,
+-446,
+-465,
+-484,
+-503,
+-521,
+-539,
+-558,
+-576,
+-594,
+-612,
+-630,
+-648,
+-666,
+-683,
+-701,
+-718,
+-735,
+-752,
+-769,
+-786,
+-803,
+-819,
+-836,
+-852,
+-868,
+-885,
+-900,
+-916,
+-932,
+-947,
+-963,
+-978,
+-993,
+-1008,
+-1023,
+-1038,
+-1052,
+-1066,
+-1081,
+-1095,
+-1108,
+-1122,
+-1136,
+-1149,
+-1162,
+-1175,
+-1188,
+-1201,
+-1214,
+-1226,
+-1238,
+-1250,
+-1262,
+-1274,
+-1285,
+-1297,
+-1308,
+-1319,
+-1330,
+-1340,
+-1351,
+-1361,
+-1371,
+-1381,
+-1390,
+-1400,
+-1409,
+-1418,
+-1427,
+-1436,
+-1445,
+-1453,
+-1461,
+-1469,
+-1477,
+-1485,
+-1492,
+-1499,
+-1506,
+-1513,
+-1520,
+-1526,
+-1532,
+-1538,
+-1544,
+-1550,
+-1555,
+-1560,
+-1566,
+-1570,
+-1575,
+-1579,
+-1584,
+-1588,
+-1592,
+-1595,
+-1599,
+-1602,
+-1605,
+-1608,
+-1610,
+-1613,
+-1615,
+-1617,
+-1619,
+-1620,
+-1622,
+-1623,
+-1624,
+-1625,
+-1625,
+-1626,
+-1626,
+-1626,
+-1626,
+-1625,
+-1625,
+-1624,
+-1623,
+-1622,
+-1621,
+-1619,
+-1617,
+-1615,
+-1613,
+-1611,
+-1608,
+-1605,
+-1603,
+-1599,
+-1596,
+-1593,
+-1589,
+-1585,
+-1581,
+-1577,
+-1572,
+-1568,
+-1563,
+-1558,
+-1553,
+-1547,
+-1542,
+-1536,
+-1530,
+-1524,
+-1518,
+-1511,
+-1505,
+-1498,
+-1491,
+-1484,
+-1477,
+-1469,
+-1462,
+-1454,
+-1446,
+-1438,
+-1430,
+-1421,
+-1413,
+-1404,
+-1395,
+-1386,
+-1377,
+-1367,
+-1358,
+-1348,
+-1338,
+-1328,
+-1318,
+-1308,
+-1297,
+-1287,
+-1276,
+-1265,
+-1254,
+-1243,
+-1232,
+-1221,
+-1209,
+-1198,
+-1186,
+-1174,
+-1162,
+-1150,
+-1138,
+-1125,
+-1113,
+-1100,
+-1087,
+-1075,
+-1062,
+-1049,
+-1035,
+-1022,
+-1009,
+-995,
+-982,
+-968,
+-954,
+-941,
+-927,
+-913,
+-898,
+-884,
+-870,
+-856,
+-841,
+-827,
+-812,
+-797,
+-783,
+-768,
+-753,
+-738,
+-723,
+-708,
+-692,
+-677,
+-662,
+-647,
+-631,
+-616,
+-600,
+-585,
+-569,
+-554,
+-538,
+-522,
+-506,
+-491,
+-475,
+-459,
+-443,
+-427,
+-411,
+-395,
+-379,
+-363,
+-347,
+-331,
+-315,
+-299,
+-283,
+-267,
+-251,
+-235,
+-218,
+-202,
+-186,
+-170,
+-154,
+-138,
+-122,
+-106,
+-90,
+-74,
+-58,
+-42,
+-26,
+-10,
+5,
+21,
+37,
+53,
+69,
+85,
+100,
+116,
+132,
+147,
+163,
+179,
+194,
+209,
+225,
+240,
+256,
+271,
+286,
+301,
+316,
+331,
+346,
+361,
+376,
+391,
+405,
+420,
+434,
+449,
+463,
+477,
+492,
+506,
+520,
+534,
+548,
+561,
+575,
+589,
+602,
+615,
+629,
+642,
+655,
+668,
+681,
+694,
+706,
+719,
+731,
+744,
+756,
+768,
+780,
+792,
+804,
+816,
+827,
+839,
+850,
+861,
+872,
+883,
+894,
+905,
+915,
+926,
+936,
+946,
+956,
+966,
+976,
+986,
+995,
+1005,
+1014,
+1023,
+1032,
+1041,
+1049,
+1058,
+1066,
+1075,
+1083,
+1091,
+1099,
+1106,
+1114,
+1121,
+1128,
+1135,
+1142,
+1149,
+1156,
+1162,
+1169,
+1175,
+1181,
+1187,
+1192,
+1198,
+1203,
+1208,
+1214,
+1218,
+1223,
+1228,
+1232,
+1237,
+1241,
+1245,
+1249,
+1252,
+1256,
+1259,
+1262,
+1265,
+1268,
+1271,
+1273,
+1276,
+1278,
+1280,
+1282,
+1284,
+1285,
+1287,
+1288,
+1289,
+1290,
+1291,
+1292,
+1292,
+1292,
+1293,
+1293,
+1292,
+1292,
+1292,
+1291,
+1290,
+1289,
+1288,
+1287,
+1285,
+1284,
+1282,
+1280,
+1278,
+1276,
+1274,
+1271,
+1269,
+1266,
+1263,
+1260,
+1257,
+1253,
+1250,
+1246,
+1242,
+1238,
+1234,
+1230,
+1225,
+1221,
+1216,
+1211,
+1206,
+1201,
+1196,
+1190,
+1185,
+1179,
+1173,
+1167,
+1161,
+1155,
+1149,
+1142,
+1136,
+1129,
+1122,
+1115,
+1108,
+1101,
+1094,
+1086,
+1078,
+1071,
+1063,
+1055,
+1047,
+1039,
+1030,
+1022,
+1013,
+1005,
+996,
+987,
+978,
+969,
+960,
+951,
+941,
+932,
+922,
+913,
+903,
+893,
+883,
+873,
+863,
+853,
+842,
+832,
+821,
+811,
+800,
+789,
+778,
+768,
+757,
+746,
+734,
+723,
+712,
+701,
+689,
+678,
+666,
+654,
+643,
+631,
+619,
+607,
+596,
+584,
+572,
+559,
+547,
+535,
+523,
+511,
+498,
+486,
+474,
+461,
+449,
+436,
+424,
+411,
+399,
+386,
+373,
+361,
+348,
+335,
+322,
+310,
+297,
+284,
+271,
+258,
+246,
+233,
+220,
+207,
+194,
+181,
+168,
+156,
+143,
+130,
+117,
+104,
+91,
+78,
+65,
+53,
+40,
+27,
+14,
+1,
+-10,
+-23,
+-36,
+-48,
+-61,
+-74,
+-86,
+-99,
+-111,
+-124,
+-136,
+-149,
+-161,
+-174,
+-186,
+-198,
+-211,
+-223,
+-235,
+-247,
+-259,
+-271,
+-283,
+-295,
+-307,
+-319,
+-330,
+-342,
+-354,
+-365,
+-377,
+-388,
+-399,
+-411,
+-422,
+-433,
+-444,
+-455,
+-466,
+-477,
+-488,
+-499,
+-509,
+-520,
+-530,
+-541,
+-551,
+-561,
+-571,
+-581,
+-591,
+-601,
+-611,
+-621,
+-631,
+-640,
+-650,
+-659,
+-668,
+-677,
+-686,
+-695,
+-704,
+-713,
+-722,
+-730,
+-739,
+-747,
+-755,
+-763,
+-771,
+-779,
+-787,
+-795,
+-803,
+-810,
+-817,
+-825,
+-832,
+-839,
+-846,
+-853,
+-859,
+-866,
+-873,
+-879,
+-885,
+-891,
+-897,
+-903,
+-909,
+-915,
+-920,
+-926,
+-931,
+-936,
+-941,
+-946,
+-951,
+-955,
+-960,
+-964,
+-969,
+-973,
+-977,
+-981,
+-985,
+-988,
+-992,
+-995,
+-999,
+-1002,
+-1005,
+-1008,
+-1011,
+-1013,
+-1016,
+-1018,
+-1020,
+-1023,
+-1025,
+-1026,
+-1028,
+-1030,
+-1031,
+-1033,
+-1034,
+-1035,
+-1036,
+-1037,
+-1038,
+-1038,
+-1039,
+-1039,
+-1039,
+-1039,
+-1039,
+-1039,
+-1039,
+-1038,
+-1038,
+-1037,
+-1036,
+-1036,
+-1034,
+-1033,
+-1032,
+-1031,
+-1029,
+-1027,
+-1026,
+-1024,
+-1022,
+-1019,
+-1017,
+-1015,
+-1012,
+-1010,
+-1007,
+-1004,
+-1001,
+-998,
+-995,
+-991,
+-988,
+-984,
+-980,
+-977,
+-973,
+-969,
+-965,
+-960,
+-956,
+-951,
+-947,
+-942,
+-937,
+-932,
+-927,
+-922,
+-917,
+-912,
+-906,
+-901,
+-895,
+-889,
+-883,
+-877,
+-871,
+-865,
+-859,
+-853,
+-846,
+-840,
+-833,
+-826,
+-819,
+-812,
+-805,
+-798,
+-791,
+-784,
+-777,
+-769,
+-762,
+-754,
+-746,
+-739,
+-731,
+-723,
+-715,
+-707,
+-699,
+-691,
+-682,
+-674,
+-665,
+-657,
+-648,
+-640,
+-631,
+-622,
+-614,
+-605,
+-596,
+-587,
+-578,
+-569,
+-559,
+-550,
+-541,
+-532,
+-522,
+-513,
+-503,
+-494,
+-484,
+-474,
+-465,
+-455,
+-445,
+-436,
+-426,
+-416,
+-406,
+-396,
+-386,
+-376,
+-366,
+-356,
+-346,
+-336,
+-325,
+-315,
+-305,
+-295,
+-285,
+-274,
+-264,
+-254,
+-243,
+-233,
+-223,
+-212,
+-202,
+-192,
+-181,
+-171,
+-161,
+-150,
+-140,
+-129,
+-119,
+-108,
+-98,
+-88,
+-77,
+-67,
+-57,
+-46,
+-36,
+-25,
+-15,
+-5,
+5,
+15,
+25,
+35,
+46,
+56,
+66,
+76,
+86,
+97,
+107,
+117,
+127,
+137,
+147,
+157,
+167,
+177,
+186,
+196,
+206,
+216,
+225,
+235,
+245,
+254,
+264,
+273,
+283,
+292,
+301,
+311,
+320,
+329,
+338,
+347,
+356,
+365,
+374,
+383,
+392,
+400,
+409,
+418,
+426,
+435,
+443,
+451,
+460,
+468,
+476,
+484,
+492,
+500,
+508,
+515,
+523,
+531,
+538,
+546,
+553,
+560,
+568,
+575,
+582,
+589,
+596,
+602,
+609,
+616,
+622,
+629,
+635,
+642,
+648,
+654,
+660,
+666,
+672,
+678,
+683,
+689,
+694,
+700,
+705,
+710,
+715,
+720,
+725,
+730,
+735,
+739,
+744,
+748,
+753,
+757,
+761,
+765,
+769,
+773,
+777,
+780,
+784,
+787,
+791,
+794,
+797,
+800,
+803,
+806,
+809,
+811,
+814,
+816,
+818,
+821,
+823,
+825,
+827,
+828,
+830,
+832,
+833,
+835,
+836,
+837,
+838,
+839,
+840,
+841,
+841,
+842,
+842,
+843,
+843,
+843,
+843,
+843,
+843,
+843,
+842,
+842,
+841,
+840,
+840,
+839,
+838,
+837,
+835,
+834,
+833,
+831,
+830,
+828,
+826,
+824,
+822,
+820,
+818,
+816,
+813,
+811,
+808,
+806,
+803,
+800,
+797,
+794,
+791,
+788,
+784,
+781,
+777,
+774,
+770,
+766,
+763,
+759,
+755,
+750,
+746,
+742,
+738,
+733,
+729,
+724,
+719,
+714,
+710,
+705,
+700,
+694,
+689,
+684,
+679,
+673,
+668,
+662,
+657,
+651,
+645,
+639,
+633,
+627,
+621,
+615,
+609,
+603,
+596,
+590,
+584,
+577,
+571,
+564,
+557,
+551,
+544,
+537,
+530,
+523,
+516,
+509,
+502,
+495,
+487,
+480,
+473,
+465,
+458,
+450,
+443,
+435,
+428,
+420,
+413,
+405,
+397,
+389,
+381,
+374,
+366,
+358,
+350,
+342,
+334,
+326,
+318,
+310,
+301,
+293,
+285,
+277,
+269,
+260,
+252,
+244,
+236,
+227,
+219,
+211,
+202,
+194,
+185,
+177,
+169,
+160,
+152,
+143,
+135,
+126,
+118,
+110,
+101,
+93,
+84,
+76,
+67,
+59,
+50,
+42,
+34,
+25,
+17,
+8,
+0,
+-7,
+-16,
+-24,
+-32,
+-41,
+-49,
+-57,
+-66,
+-74,
+-82,
+-90,
+-98,
+-106,
+-115,
+-123,
+-131,
+-139,
+-147,
+-155,
+-163,
+-171,
+-179,
+-186,
+-194,
+-202,
+-210,
+-217,
+-225,
+-233,
+-240,
+-248,
+-255,
+-263,
+-270,
+-278,
+-285,
+-292,
+-299,
+-307,
+-314,
+-321,
+-328,
+-335,
+-342,
+-349,
+-356,
+-362,
+-369,
+-376,
+-382,
+-389,
+-396,
+-402,
+-408,
+-415,
+-421,
+-427,
+-433,
+-439,
+-445,
+-451,
+-457,
+-463,
+-469,
+-475,
+-480,
+-486,
+-491,
+-497,
+-502,
+-507,
+-513,
+-518,
+-523,
+-528,
+-533,
+-538,
+-542,
+-547,
+-552,
+-556,
+-561,
+-565,
+-570,
+-574,
+-578,
+-582,
+-586,
+-590,
+-594,
+-598,
+-602,
+-605,
+-609,
+-612,
+-616,
+-619,
+-622,
+-625,
+-629,
+-632,
+-634,
+-637,
+-640,
+-643,
+-645,
+-648,
+-650,
+-653,
+-655,
+-657,
+-659,
+-661,
+-663,
+-665,
+-667,
+-668,
+-670,
+-671,
+-673,
+-674,
+-675,
+-676,
+-678,
+-679,
+-679,
+-680,
+-681,
+-682,
+-682,
+-683,
+-683,
+-683,
+-684,
+-684,
+-684,
+-684,
+-684,
+-684,
+-683,
+-683,
+-682,
+-682,
+-681,
+-681,
+-680,
+-679,
+-678,
+-677,
+-676,
+-675,
+-674,
+-672,
+-671,
+-669,
+-668,
+-666,
+-664,
+-662,
+-661,
+-659,
+-657,
+-654,
+-652,
+-650,
+-648,
+-645,
+-643,
+-640,
+-637,
+-635,
+-632,
+-629,
+-626,
+-623,
+-620,
+-617,
+-613,
+-610,
+-607,
+-603,
+-600,
+-596,
+-593,
+-589,
+-585,
+-581,
+-577,
+-573,
+-569,
+-565,
+-561,
+-557,
+-552,
+-548,
+-544,
+-539,
+-534,
+-530,
+-525,
+-520,
+-516,
+-511,
+-506,
+-501,
+-496,
+-491,
+-486,
+-481,
+-475,
+-470,
+-465,
+-460,
+-454,
+-449,
+-443,
+-438,
+-432,
+-426,
+-421,
+-415,
+-409,
+-403,
+-398,
+-392,
+-386,
+-380,
+-374,
+-368,
+-362,
+-355,
+-349,
+-343,
+-337,
+-331,
+-324,
+-318,
+-312,
+-305,
+-299,
+-292,
+-286,
+-280,
+-273,
+-266,
+-260,
+-253,
+-247,
+-240,
+-234,
+-227,
+-220,
+-213,
+-207,
+-200,
+-193,
+-187,
+-180,
+-173,
+-166,
+-159,
+-153,
+-146,
+-139,
+-132,
+-125,
+-118,
+-112,
+-105,
+-98,
+-91,
+-84,
+-77,
+-70,
+-64,
+-57,
+-50,
+-43,
+-36,
+-29,
+-22,
+-16,
+-9,
+-2,
+4,
+11,
+17,
+24,
+31,
+38,
+44,
+51,
+58,
+64,
+71,
+78,
+84,
+91,
+98,
+104,
+111,
+117,
+124,
+130,
+137,
+143,
+149,
+156,
+162,
+168,
+175,
+181,
+187,
+193,
+199,
+205,
+212,
+218,
+224,
+230,
+236,
+241,
+247,
+253,
+259,
+265,
+270,
+276,
+282,
+287,
+293,
+298,
+304,
+309,
+314,
+320,
+325,
+330,
+335,
+340,
+345,
+350,
+355,
+360,
+365,
+370,
+375,
+380,
+384,
+389,
+393,
+398,
+402,
+407,
+411,
+415,
+419,
+424,
+428,
+432,
+436,
+440,
+443,
+447,
+451,
+455,
+458,
+462,
+465,
+469,
+472,
+475,
+479,
+482,
+485,
+488,
+491,
+494,
+497,
+499,
+502,
+505,
+507,
+510,
+512,
+515,
+517,
+519,
+522,
+524,
+526,
+528,
+530,
+532,
+533,
+535,
+537,
+538,
+540,
+541,
+543,
+544,
+545,
+546,
+548,
+549,
+550,
+550,
+551,
+552,
+553,
+553,
+554,
+554,
+555,
+555,
+555,
+556,
+556,
+556,
+556,
+556,
+556,
+555,
+555,
+555,
+554,
+554,
+553,
+553,
+552,
+551,
+551,
+550,
+549,
+548,
+547,
+546,
+545,
+543,
+542,
+541,
+539,
+538,
+536,
+534,
+533,
+531,
+529,
+527,
+525,
+523,
+521,
+519,
+517,
+514,
+512,
+510,
+507,
+505,
+502,
+500,
+497,
+494,
+492,
+489,
+486,
+483,
+480,
+477,
+474,
+471,
+467,
+464,
+461,
+457,
+454,
+450,
+447,
+443,
+440,
+436,
+432,
+429,
+425,
+421,
+417,
+413,
+409,
+405,
+401,
+397,
+393,
+388,
+384,
+380,
+375,
+371,
+367,
+362,
+358,
+353,
+349,
+344,
+339,
+335,
+330,
+325,
+321,
+316,
+311,
+306,
+301,
+296,
+291,
+286,
+281,
+276,
+271,
+266,
+261,
+256,
+251,
+245,
+240,
+235,
+230,
+225,
+219,
+214,
+209,
+203,
+198,
+193,
+187,
+182,
+176,
+171,
+165,
+160,
+154,
+149,
+144,
+138,
+132,
+127,
+121,
+116,
+110,
+105,
+99,
+94,
+88,
+83,
+77,
+71,
+66,
+60,
+55,
+49,
+44,
+38,
+33,
+27,
+21,
+16,
+10,
+5,
+0,
+-5,
+-11,
+-16,
+-22,
+-27,
+-33,
+-38,
+-43,
+-49,
+-54,
+-60,
+-65,
+-70,
+-76,
+-81,
+-86,
+-92,
+-97,
+-102,
+-107,
+-113,
+-118,
+-123,
+-128,
+-133,
+-138,
+-143,
+-148,
+-153,
+-158,
+-163,
+-168,
+-173,
+-178,
+-183,
+-188,
+-192,
+-197,
+-202,
+-207,
+-211,
+-216,
+-221,
+-225,
+-230,
+-234,
+-239,
+-243,
+-247,
+-252,
+-256,
+-260,
+-265,
+-269,
+-273,
+-277,
+-281,
+-285,
+-289,
+-293,
+-297,
+-301,
+-305,
+-308,
+-312,
+-316,
+-319,
+-323,
+-327,
+-330,
+-334,
+-337,
+-340,
+-344,
+-347,
+-350,
+-353,
+-357,
+-360,
+-363,
+-366,
+-369,
+-372,
+-374,
+-377,
+-380,
+-383,
+-385,
+-388,
+-390,
+-393,
+-395,
+-398,
+-400,
+-402,
+-405,
+-407,
+-409,
+-411,
+-413,
+-415,
+-417,
+-419,
+-420,
+-422,
+-424,
+-425,
+-427,
+-429,
+-430,
+-431,
+-433,
+-434,
+-435,
+-436,
+-438,
+-439,
+-440,
+-441,
+-442,
+-442,
+-443,
+-444,
+-445,
+-445,
+-446,
+-446,
+-447,
+-447,
+-448,
+-448,
+-448,
+-448,
+-449,
+-449,
+-449,
+-449,
+-449,
+-448,
+-448,
+-448,
+-448,
+-447,
+-447,
+-446,
+-446,
+-445,
+-445,
+-444,
+-443,
+-442,
+-442,
+-441,
+-440,
+-439,
+-438,
+-437,
+-435,
+-434,
+-433,
+-432,
+-430,
+-429,
+-427,
+-426,
+-424,
+-423,
+-421,
+-419,
+-418,
+-416,
+-414,
+-412,
+-410,
+-408,
+-406,
+-404,
+-402,
+-400,
+-397,
+-395,
+-393,
+-390,
+-388,
+-385,
+-383,
+-380,
+-378,
+-375,
+-373,
+-370,
+-367,
+-364,
+-361,
+-359,
+-356,
+-353,
+-350,
+-347,
+-344,
+-340,
+-337,
+-334,
+-331,
+-328,
+-324,
+-321,
+-318,
+-314,
+-311,
+-307,
+-304,
+-300,
+-297,
+-293,
+-290,
+-286,
+-282,
+-279,
+-275,
+-271,
+-267,
+-263,
+-260,
+-256,
+-252,
+-248,
+-244,
+-240,
+-236,
+-232,
+-228,
+-224,
+-220,
+-216,
+-212,
+-207,
+-203,
+-199,
+-195,
+-191,
+-186,
+-182,
+-178,
+-174,
+-169,
+-165,
+-161,
+-156,
+-152,
+-148,
+-143,
+-139,
+-134,
+-130,
+-126,
+-121,
+-117,
+-112,
+-108,
+-103,
+-99,
+-95,
+-90,
+-86,
+-81,
+-77,
+-72,
+-68,
+-63,
+-59,
+-54,
+-50,
+-45,
+-41,
+-36,
+-32,
+-27,
+-23,
+-18,
+-14,
+-9,
+-5,
+0,
+3,
+7,
+12,
+16,
+21,
+25,
+29,
+34,
+38,
+43,
+47,
+51,
+56,
+60,
+64,
+69,
+73,
+77,
+81,
+85,
+90,
+94,
+98,
+102,
+106,
+110,
+115,
+119,
+123,
+127,
+131,
+135,
+139,
+143,
+146,
+150,
+154,
+158,
+162,
+166,
+169,
+173,
+177,
+181,
+184,
+188,
+192,
+195,
+199,
+202,
+206,
+209,
+212,
+216,
+219,
+223,
+226,
+229,
+232,
+236,
+239,
+242,
+245,
+248,
+251,
+254,
+257,
+260,
+263,
+266,
+268,
+271,
+274,
+277,
+279,
+282,
+284,
+287,
+289,
+292,
+294,
+297,
+299,
+301,
+304,
+306,
+308,
+310,
+312,
+314,
+316,
+318,
+320,
+322,
+324,
+326,
+328,
+329,
+331,
+333,
+334,
+336,
+337,
+339,
+340,
+341,
+343,
+344,
+345,
+346,
+348,
+349,
+350,
+351,
+352,
+353,
+354,
+354,
+355,
+356,
+357,
+357,
+358,
+358,
+359,
+359,
+360,
+360,
+361,
+361,
+361,
+361,
+362,
+362,
+362,
+362,
+362,
+362,
+362,
+361,
+361,
+361,
+361,
+360,
+360,
+360,
+359,
+359,
+358,
+358,
+357,
+356,
+356,
+355,
+354,
+353,
+352,
+351,
+350,
+349,
+348,
+347,
+346,
+345,
+344,
+343,
+341,
+340,
+339,
+337,
+336,
+334,
+333,
+331,
+330,
+328,
+326,
+324,
+323,
+321,
+319,
+317,
+315,
+313,
+311,
+309,
+307,
+305,
+303,
+301,
+299,
+297,
+294,
+292,
+290,
+288,
+285,
+283,
+280,
+278,
+275,
+273,
+270,
+268,
+265,
+263,
+260,
+257,
+254,
+252,
+249,
+246,
+243,
+240,
+238,
+235,
+232,
+229,
+226,
+223,
+220,
+217,
+214,
+211,
+208,
+204,
+201,
+198,
+195,
+192,
+188,
+185,
+182,
+179,
+175,
+172,
+169,
+165,
+162,
+159,
+155,
+152,
+149,
+145,
+142,
+138,
+135,
+131,
+128,
+124,
+121,
+117,
+114,
+110,
+107,
+103,
+100,
+96,
+93,
+89,
+85,
+82,
+78,
+75,
+71,
+67,
+64,
+60,
+57,
+53,
+49,
+46,
+42,
+39,
+35,
+31,
+28,
+24,
+21,
+17,
+14,
+10,
+6,
+3,
+0,
+-3,
+-7,
+-10,
+-14,
+-18,
+-21,
+-25,
+-28,
+-32,
+-35,
+-39,
+-42,
+-45,
+-49,
+-52,
+-56,
+-59,
+-63,
+-66,
+-69,
+-73,
+-76,
+-79,
+-83,
+-86,
+-89,
+-93,
+-96,
+-99,
+-102,
+-105,
+-109,
+-112,
+-115,
+-118,
+-121,
+-124,
+-127,
+-130,
+-133,
+-136,
+-139,
+-142,
+-145,
+-148,
+-151,
+-154,
+-157,
+-160,
+-162,
+-165,
+-168,
+-171,
+-173,
+-176,
+-179,
+-181,
+-184,
+-186,
+-189,
+-191,
+-194,
+-196,
+-199,
+-201,
+-204,
+-206,
+-208,
+-211,
+-213,
+-215,
+-217,
+-219,
+-221,
+-224,
+-226,
+-228,
+-230,
+-232,
+-234,
+-236,
+-237,
+-239,
+-241,
+-243,
+-245,
+-246,
+-248,
+-250,
+-251,
+-253,
+-254,
+-256,
+-257,
+-259,
+-260,
+-262,
+-263,
+-264,
+-266,
+-267,
+-268,
+-269,
+-270,
+-271,
+-273,
+-274,
+-275,
+-275,
+-276,
+-277,
+-278,
+-279,
+-280,
+-281,
+-281,
+-282,
+-283,
+-283,
+-284,
+-284,
+-285,
+-285,
+-286,
+-286,
+-286,
+-287,
+-287,
+-287,
+-287,
+-288,
+-288,
+-288,
+-288,
+-288,
+-288,
+-288,
+-288,
+-288,
+-288,
+-287,
+-287,
+-287,
+-287,
+-286,
+-286,
+-286,
+-285,
+-285,
+-284,
+-284,
+-283,
+-283,
+-282,
+-281,
+-281,
+-280,
+-279,
+-278,
+-277,
+-277,
+-276,
+-275,
+-274,
+-273,
+-272,
+-271,
+-270,
+-269,
+-267,
+-266,
+-265,
+-264,
+-262,
+-261,
+-260,
+-258,
+-257,
+-256,
+-254,
+-253,
+-251,
+-250,
+-248,
+-247,
+-245,
+-243,
+-242,
+-240,
+-238,
+-236,
+-235,
+-233,
+-231,
+-229,
+-227,
+-225,
+-223,
+-221,
+-219,
+-217,
+-215,
+-213,
+-211,
+-209,
+-207,
+-205,
+-203,
+-201,
+-198,
+-196,
+-194,
+-192,
+-189,
+-187,
+-185,
+-182,
+-180,
+-178,
+-175,
+-173,
+-170,
+-168,
+-165,
+-163,
+-160,
+-158,
+-155,
+-153,
+-150,
+-148,
+-145,
+-142,
+-140,
+-137,
+-135,
+-132,
+-129,
+-127,
+-124,
+-121,
+-118,
+-116,
+-113,
+-110,
+-108,
+-105,
+-102,
+-99,
+-96,
+-94,
+-91,
+-88,
+-85,
+-82,
+-80,
+-77,
+-74,
+-71,
+-68,
+-65,
+-63,
+-60,
+-57,
+-54,
+-51,
+-48,
+-45,
+-42,
+-40,
+-37,
+-34,
+-31,
+-28,
+-25,
+-22,
+-20,
+-17,
+-14,
+-11,
+-8,
+-5,
+-2,
+0,
+2,
+5,
+8,
+11,
+13,
+16,
+19,
+22,
+25,
+27,
+30,
+33,
+36,
+38,
+41,
+44,
+47,
+49,
+52,
+55,
+57,
+60,
+63,
+65,
+68,
+71,
+73,
+76,
+78,
+81,
+83,
+86,
+88,
+91,
+93,
+96,
+98,
+101,
+103,
+106,
+108,
+110,
+113,
+115,
+117,
+120,
+122,
+124,
+127,
+129,
+131,
+133,
+135,
+137,
+140,
+142,
+144,
+146,
+148,
+150,
+152,
+154,
+156,
+158,
+160,
+161,
+163,
+165,
+167,
+169,
+171,
+172,
+174,
+176,
+177,
+179,
+181,
+182,
+184,
+185,
+187,
+188,
+190,
+191,
+193,
+194,
+195,
+197,
+198,
+199,
+201,
+202,
+203,
+204,
+205,
+207,
+208,
+209,
+210,
+211,
+212,
+213,
+214,
+215,
+216,
+216,
+217,
+218,
+219,
+219,
+220,
+221,
+222,
+222,
+223,
+223,
+224,
+224,
+225,
+225,
+226,
+226,
+227,
+227,
+227,
+227,
+228,
+228,
+228,
+228,
+228,
+229,
+229,
+229,
+229,
+229,
+229,
+229,
+229,
+228,
+228,
+228,
+228,
+228,
+228,
+227,
+227,
+227,
+226,
+226,
+225,
+225,
+225,
+224,
+224,
+223,
+222,
+222,
+221,
+221,
+220,
+219,
+218,
+218,
+217,
+216,
+215,
+214,
+214,
+213,
+212,
+211,
+210,
+209,
+208,
+207,
+206,
+205,
+203,
+202,
+201,
+200,
+199,
+197,
+196,
+195,
+194,
+192,
+191,
+190,
+188,
+187,
+185,
+184,
+182,
+181,
+179,
+178,
+176,
+175,
+173,
+172,
+170,
+168,
+167,
+165,
+163,
+162,
+160,
+158,
+156,
+155,
+153,
+151,
+149,
+147,
+146,
+144,
+142,
+140,
+138,
+136,
+134,
+132,
+130,
+128,
+126,
+124,
+122,
+120,
+118,
+116,
+114,
+112,
+110,
+108,
+106,
+104,
+102,
+99,
+97,
+95,
+93,
+91,
+89,
+87,
+84,
+82,
+80,
+78,
+76,
+73,
+71,
+69,
+67,
+64,
+62,
+60,
+58,
+56,
+53,
+51,
+49,
+47,
+44,
+42,
+40,
+38,
+35,
+33,
+31,
+28,
+26,
+24,
+22,
+19,
+17,
+15,
+13,
+10,
+8,
+6,
+4,
+1,
+0,
+-2,
+-4,
+-6,
+-9,
+-11,
+-13,
+-15,
+-17,
+-20,
+-22,
+-24,
+-26,
+-28,
+-30,
+-33,
+-35,
+-37,
+-39,
+-41,
+-43,
+-45,
+-47,
+-49,
+-52,
+-54,
+-56,
+-58,
+-60,
+-62,
+-64,
+-66,
+-68,
+-70,
+-72,
+-74,
+-76,
+-77,
+-79,
+-81,
+-83,
+-85,
+-87,
+-89,
+-90,
+-92,
+-94,
+-96,
+-98,
+-99,
+-101,
+-103,
+-105,
+-106,
+-108,
+-110,
+-111,
+-113,
+-114,
+-116,
+-118,
+-119,
+-121,
+-122,
+-124,
+-125,
+-127,
+-128,
+-130,
+-131,
+-132,
+-134,
+-135,
+-136,
+-138,
+-139,
+-140,
+-142,
+-143,
+-144,
+-145,
+-146,
+-148,
+-149,
+-150,
+-151,
+-152,
+-153,
+-154,
+-155,
+-156,
+-157,
+-158,
+-159,
+-160,
+-161,
+-162,
+-162,
+-163,
+-164,
+-165,
+-166,
+-166,
+-167,
+-168,
+-168,
+-169,
+-170,
+-170,
+-171,
+-171,
+-172,
+-172,
+-173,
+-173,
+-174,
+-174,
+-175,
+-175,
+-175,
+-176,
+-176,
+-176,
+-177,
+-177,
+-177,
+-177,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-178,
+-177,
+-177,
+-177,
+-177,
+-177,
+-176,
+-176,
+-176,
+-175,
+-175,
+-175,
+-174,
+-174,
+-173,
+-173,
+-172,
+-172,
+-171,
+-171,
+-170,
+-170,
+-169,
+-168,
+-168,
+-167,
+-166,
+-166,
+-165,
+-164,
+-163,
+-163,
+-162,
+-161,
+-160,
+-159,
+-158,
+-158,
+-157,
+-156,
+-155,
+-154,
+-153,
+-152,
+-151,
+-150,
+-149,
+-148,
+-147,
+-145,
+-144,
+-143,
+-142,
+-141,
+-140,
+-139,
+-137,
+-136,
+-135,
+-134,
+-132,
+-131,
+-130,
+-128,
+-127,
+-126,
+-124,
+-123,
+-122,
+-120,
+-119,
+-118,
+-116,
+-115,
+-113,
+-112,
+-110,
+-109,
+-107,
+-106,
+-104,
+-103,
+-101,
+-100,
+-98,
+-97,
+-95,
+-94,
+-92,
+-90,
+-89,
+-87,
+-86,
+-84,
+-82,
+-81,
+-79,
+-77,
+-76,
+-74,
+-72,
+-71,
+-69,
+-67,
+-66,
+-64,
+-62,
+-60,
+-59,
+-57,
+-55,
+-54,
+-52,
+-50,
+-48,
+-47,
+-45,
+-43,
+-41,
+-40,
+-38,
+-36,
+-34,
+-33,
+-31,
+-29,
+-27,
+-25,
+-24,
+-22,
+-20,
+-18,
+-17,
+-15,
+-13,
+-11,
+-10,
+-8,
+-6,
+-4,
+-3,
+-1,
+0,
+2,
+3,
+5,
+7,
+8,
+10,
+12,
+14,
+15,
+17,
+19,
+20,
+22,
+24,
+25,
+27,
+29,
+30,
+32,
+34,
+35,
+37,
+39,
+40,
+42,
+43,
+45,
+47,
+48,
+50,
+51,
+53,
+54,
+56,
+57,
+59,
+60,
+62,
+63,
+65,
+66,
+68,
+69,
+70,
+72,
+73,
+75,
+76,
+77,
+79,
+80,
+81,
+83,
+84,
+85,
+87,
+88,
+89,
+90,
+92,
+93,
+94,
+95,
+96,
+97,
+99,
+100,
+101,
+102,
+103,
+104,
+105,
+106,
+107,
+108,
+109,
+110,
+111,
+112,
+113,
+114,
+115,
+116,
+117,
+117,
+118,
+119,
+120,
+121,
+121,
+122,
+123,
+124,
+124,
+125,
+126,
+126,
+127,
+128,
+128,
+129,
+129,
+130,
+130,
+131,
+131,
+132,
+132,
+133,
+133,
+134,
+134,
+135,
+135,
+135,
+136,
+136,
+136,
+136,
+137,
+137,
+137,
+137,
+138,
+138,
+138,
+138,
+138,
+138,
+138,
+138,
+139,
+139,
+139,
+139,
+139,
+139,
+139,
+138,
+138,
+138,
+138,
+138,
+138,
+138,
+138,
+137,
+137,
+137,
+137,
+136,
+136,
+136,
+136,
+135,
+135,
+134,
+134,
+134,
+133,
+133,
+132,
+132,
+132,
+131,
+131,
+130,
+129,
+129,
+128,
+128,
+127,
+127,
+126,
+125,
+125,
+124,
+123,
+123,
+122,
+121,
+121,
+120,
+119,
+118,
+117,
+117,
+116,
+115,
+114,
+113,
+113,
+112,
+111,
+110,
+109,
+108,
+107,
+106,
+105,
+104,
+103,
+102,
+101,
+100,
+99,
+98,
+97,
+96,
+95,
+94,
+93,
+92,
+91,
+90,
+89,
+87,
+86,
+85,
+84,
+83,
+82,
+81,
+79,
+78,
+77,
+76,
+75,
+73,
+72,
+71,
+70,
+68,
+67,
+66,
+65,
+63,
+62,
+61,
+60,
+58,
+57,
+56,
+54,
+53,
+52,
+50,
+49,
+48,
+47,
+45,
+44,
+43,
+41,
+40,
+39,
+37,
+36,
+34,
+33,
+32,
+30,
+29,
+28,
+26,
+25,
+24,
+22,
+21,
+20,
+18,
+17,
+16,
+14,
+13,
+11,
+10,
+9,
+7,
+6,
+5,
+3,
+2,
+1,
+0,
+-1,
+-2,
+-4,
+-5,
+-6,
+-8,
+-9,
+-10,
+-11,
+-13,
+-14,
+-15,
+-17,
+-18,
+-19,
+-20,
+-22,
+-23,
+-24,
+-26,
+-27,
+-28,
+-29,
+-30,
+-32,
+-33,
+-34,
+-35,
+-37,
+-38,
+-39,
+-40,
+-41,
+-42,
+-44,
+-45,
+-46,
+-47,
+-48,
+-49,
+-50,
+-51,
+-53,
+-54,
+-55,
+-56,
+-57,
+-58,
+-59,
+-60,
+-61,
+-62,
+-63,
+-64,
+-65,
+-66,
+-67,
+-68,
+-69,
+-70,
+-71,
+-71,
+-72,
+-73,
+-74,
+-75,
+-76,
+-77,
+-77,
+-78,
+-79,
+-80,
+-81,
+-81,
+-82,
+-83,
+-84,
+-84,
+-85,
+-86,
+-87,
+-87,
+-88,
+-89,
+-89,
+-90,
+-90,
+-91,
+-92,
+-92,
+-93,
+-93,
+-94,
+-94,
+-95,
+-95,
+-96,
+-96,
+-97,
+-97,
+-98,
+-98,
+-99,
+-99,
+-99,
+-100,
+-100,
+-100,
+-101,
+-101,
+-101,
+-102,
+-102,
+-102,
+-102,
+-103,
+-103,
+-103,
+-103,
+-103,
+-104,
+-104,
+-104,
+-104,
+-104,
+-104,
+-104,
+-105,
+-105,
+-105,
+-105,
+-105,
+-105,
+-105,
+-105,
+-105,
+-105,
+-105,
+-105,
+-104,
+-104,
+-104,
+-104,
+-104,
+-104,
+-104,
+-104,
+-103,
+-103,
+-103,
+-103,
+-103,
+-102,
+-102,
+-102,
+-102,
+-101,
+-101,
+-101,
+-100,
+-100,
+-100,
+-99,
+-99,
+-99,
+-98,
+-98,
+-97,
+-97,
+-97,
+-96,
+-96,
+-95,
+-95,
+-94,
+-94,
+-93,
+-93,
+-92,
+-92,
+-91,
+-90,
+-90,
+-89,
+-89,
+-88,
+-87,
+-87,
+-86,
+-86,
+-85,
+-84,
+-84,
+-83,
+-82,
+-81,
+-81,
+-80,
+-79,
+-79,
+-78,
+-77,
+-76,
+-76,
+-75,
+-74,
+-73,
+-72,
+-72,
+-71,
+-70,
+-69,
+-68,
+-67,
+-67,
+-66,
+-65,
+-64,
+-63,
+-62,
+-61,
+-61,
+-60,
+-59,
+-58,
+-57,
+-56,
+-55,
+-54,
+-53,
+-52,
+-51,
+-50,
+-49,
+-48,
+-48,
+-47,
+-46,
+-45,
+-44,
+-43,
+-42,
+-41,
+-40,
+-39,
+-38,
+-37,
+-36,
+-35,
+-34,
+-33,
+-32,
+-31,
+-30,
+-29,
+-28,
+-27,
+-26,
+-25,
+-24,
+-23,
+-21,
+-20,
+-19,
+-18,
+-17,
+-16,
+-15,
+-14,
+-13,
+-12,
+-11,
+-10,
+-9,
+-8,
+-7,
+-6,
+-5,
+-4,
+-3,
+-2,
+-1,
+0,
+0,
+1,
+2,
+3,
+4,
+5,
+6,
+7,
+8,
+9,
+10,
+11,
+12,
+13,
+14,
+15,
+16,
+17,
+18,
+19,
+20,
+21,
+22,
+22,
+23,
+24,
+25,
+26,
+27,
+28,
+29,
+30,
+31,
+32,
+32,
+33,
+34,
+35,
+36,
+37,
+38,
+38,
+39,
+40,
+41,
+42,
+42,
+43,
+44,
+45,
+46,
+46,
+47,
+48,
+49,
+49,
+50,
+51,
+52,
+52,
+53,
+54,
+54,
+55,
+56,
+56,
+57,
+58,
+58,
+59,
+59,
+60,
+61,
+61,
+62,
+62,
+63,
+64,
+64,
+65,
+65,
+66,
+66,
+67,
+67,
+68,
+68,
+69,
+69,
+69,
+70,
+70,
+71,
+71,
+72,
+72,
+72,
+73,
+73,
+73,
+74,
+74,
+74,
+75,
+75,
+75,
+76,
+76,
+76,
+76,
+77,
+77,
+77,
+77,
+77,
+78,
+78,
+78,
+78,
+78,
+78,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+79,
+78,
+78,
+78,
+78,
+78,
+78,
+77,
+77,
+77,
+77,
+77,
+76,
+76,
+76,
+76,
+75,
+75,
+75,
+74,
+74,
+74,
+74,
+73,
+73,
+72,
+72,
+72,
+71,
+71,
+71,
+70,
+70,
+69,
+69,
+69,
+68,
+68,
+67,
+67,
+66,
+66,
+65,
+65,
+64,
+64,
+63,
+63,
+62,
+62,
+61,
+61,
+60,
+60,
+59,
+59,
+58,
+57,
+57,
+56,
+56,
+55,
+55,
+54,
+53,
+53,
+52,
+51,
+51,
+50,
+50,
+49,
+48,
+48,
+47,
+46,
+46,
+45,
+44,
+44,
+43,
+42,
+41,
+41,
+40,
+39,
+39,
+38,
+37,
+37,
+36,
+35,
+34,
+34,
+33,
+32,
+31,
+31,
+30,
+29,
+28,
+28,
+27,
+26,
+25,
+25,
+24,
+23,
+22,
+22,
+21,
+20,
+19,
+19,
+18,
+17,
+16,
+16,
+15,
+14,
+13,
+12,
+12,
+11,
+10,
+9,
+9,
+8,
+7,
+6,
+6,
+5,
+4,
+3,
+3,
+2,
+1,
+0,
+0,
+0,
+-1,
+-2,
+-2,
+-3,
+-4,
+-5,
+-5,
+-6,
+-7,
+-8,
+-8,
+-9,
+-10,
+-10,
+-11,
+-12,
+-13,
+-13,
+-14,
+-15,
+-15,
+-16,
+-17,
+-17,
+-18,
+-19,
+-19,
+-20,
+-21,
+-21,
+-22,
+-23,
+-23,
+-24,
+-25,
+-25,
+-26,
+-27,
+-27,
+-28,
+-28,
+-29,
+-30,
+-30,
+-31,
+-31,
+-32,
+-33,
+-33,
+-34,
+-34,
+-35,
+-35,
+-36,
+-36,
+-37,
+-37,
+-38,
+-38,
+-39,
+-39,
+-40,
+-40,
+-41,
+-41,
+-42,
+-42,
+-43,
+-43,
+-44,
+-44,
+-45,
+-45,
+-45,
+-46,
+-46,
+-47,
+-47,
+-47,
+-48,
+-48,
+-49,
+-49,
+-49,
+-50,
+-50,
+-50,
+-51,
+-51,
+-51,
+-51,
+-52,
+-52,
+-52,
+-53,
+-53,
+-53,
+-53,
+-54,
+-54,
+-54,
+-54,
+-54,
+-55,
+-55,
+-55,
+-55,
+-55,
+-56,
+-56,
+-56,
+-56,
+-56,
+-56,
+-56,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-57,
+-56,
+-56,
+-56,
+-56,
+-56,
+-56,
+-56,
+-55,
+-55,
+-55,
+-55,
+-55,
+-54,
+-54,
+-54,
+-54,
+-54,
+-53,
+-53,
+-53,
+-53,
+-52,
+-52,
+-52,
+-52,
+-51,
+-51,
+-51,
+-50,
+-50,
+-50,
+-50,
+-49,
+-49,
+-49,
+-48,
+-48,
+-48,
+-47,
+-47,
+-46,
+-46,
+-46,
+-45,
+-45,
+-45,
+-44,
+-44,
+-43,
+-43,
+-43,
+-42,
+-42,
+-41,
+-41,
+-40,
+-40,
+-40,
+-39,
+-39,
+-38,
+-38,
+-37,
+-37,
+-36,
+-36,
+-35,
+-35,
+-35,
+-34,
+-34,
+-33,
+-33,
+-32,
+-32,
+-31,
+-31,
+-30,
+-30,
+-29,
+-29,
+-28,
+-28,
+-27,
+-26,
+-26,
+-25,
+-25,
+-24,
+-24,
+-23,
+-23,
+-22,
+-22,
+-21,
+-21,
+-20,
+-19,
+-19,
+-18,
+-18,
+-17,
+-17,
+-16,
+-16,
+-15,
+-15,
+-14,
+-13,
+-13,
+-12,
+-12,
+-11,
+-11,
+-10,
+-9,
+-9,
+-8,
+-8,
+-7,
+-7,
+-6,
+-6,
+-5,
+-4,
+-4,
+-3,
+-3,
+-2,
+-2,
+-1,
+-1,
+0,
+0,
+0,
+1,
+1,
+2,
+2,
+3,
+3,
+4,
+4,
+5,
+5,
+6,
+7,
+7,
+8,
+8,
+9,
+9,
+10,
+10,
+11,
+11,
+12,
+12,
+13,
+13,
+14,
+14,
+15,
+15,
+16,
+16,
+17,
+17,
+18,
+18,
+18,
+19,
+19,
+20,
+20,
+21,
+21,
+22,
+22,
+22,
+23,
+23,
+24,
+24,
+25,
+25,
+25,
+26,
+26,
+27,
+27,
+27,
+28,
+28,
+28,
+29,
+29,
+30,
+30,
+30,
+31,
+31,
+31,
+32,
+32,
+32,
+33,
+33,
+33,
+33,
+34,
+34,
+34,
+35,
+35,
+35,
+35,
+36,
+36,
+36,
+36,
+37,
+37,
+37,
+37,
+38,
+38,
+38,
+38,
+38,
+39,
+39,
+39,
+39,
+39,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+41,
+41,
+41,
+41,
+41,
+41,
+41,
+41,
+41,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+42,
+41,
+41,
+41,
+41,
+41,
+41,
+41,
+41,
+41,
+41,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+39,
+39,
+39,
+39,
+39,
+38,
+38,
+38,
+38,
+38,
+37,
+37,
+37,
+37,
+37,
+36,
+36,
+36,
+36,
+35,
+35,
+35,
+35,
+34,
+34,
+34,
+34,
+33,
+33,
+33,
+33,
+32,
+32,
+32,
+31,
+31,
+31,
+30,
+30,
+30,
+30,
+29,
+29,
+29,
+28,
+28,
+28,
+27,
+27,
+27,
+26,
+26,
+26,
+25,
+25,
+25,
+24,
+24,
+23,
+23,
+23,
+22,
+22,
+22,
+21,
+21,
+21,
+20,
+20,
+19,
+19,
+19,
+18,
+18,
+18,
+17,
+17,
+16,
+16,
+16,
+15,
+15,
+14,
+14,
+14,
+13,
+13,
+12,
+12,
+12,
+11,
+11,
+10,
+10,
+10,
+9,
+9,
+8,
+8,
+8,
+7,
+7,
+6,
+6,
+6,
+5,
+5,
+4,
+4,
+4,
+3,
+3,
+2,
+2,
+2,
+1,
+1,
+1,
+0,
+0,
+0,
+0,
+0,
+-1,
+-1,
+-2,
+-2,
+-2,
+-3,
+-3,
+-3,
+-4,
+-4,
+-5,
+-5,
+-5,
+-6,
+-6,
+-6,
+-7,
+-7,
+-7,
+-8,
+-8,
+-9,
+-9,
+-9,
+-10,
+-10,
+-10,
+-11,
+-11,
+-11,
+-12,
+-12,
+-12,
+-13,
+-13,
+-13,
+-14,
+-14,
+-14,
+-14,
+-15,
+-15,
+-15,
+-16,
+-16,
+-16,
+-17,
+-17,
+-17,
+-17,
+-18,
+-18,
+-18,
+-19,
+-19,
+-19,
+-19,
+-20,
+-20,
+-20,
+-20,
+-21,
+-21,
+-21,
+-21,
+-21,
+-22,
+-22,
+-22,
+-22,
+-23,
+-23,
+-23,
+-23,
+-23,
+-24,
+-24,
+-24,
+-24,
+-24,
+-25,
+-25,
+-25,
+-25,
+-25,
+-25,
+-26,
+-26,
+-26,
+-26,
+-26,
+-26,
+-26,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-29,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-28,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-27,
+-26,
+-26,
+-26,
+-26,
+-26,
+-26,
+-26,
+-25,
+-25,
+-25,
+-25,
+-25,
+-25,
+-25,
+-24,
+-24,
+-24,
+-24,
+-24,
+-24,
+-23,
+-23,
+-23,
+-23,
+-23,
+-22,
+-22,
+-22,
+-22,
+-22,
+-21,
+-21,
+-21,
+-21,
+-21,
+-20,
+-20,
+-20,
+-20,
+-20,
+-19,
+-19,
+-19,
+-19,
+-18,
+-18,
+-18,
+-18,
+-17,
+-17,
+-17,
+-17,
+-16,
+-16,
+-16,
+-16,
+-15,
+-15,
+-15,
+-15,
+-14,
+-14,
+-14,
+-14,
+-13,
+-13,
+-13,
+-13,
+-12,
+-12,
+-12,
+-12,
+-11,
+-11,
+-11,
+-11,
+-10,
+-10,
+-10,
+-9,
+-9,
+-9,
+-9,
+-8,
+-8,
+-8,
+-7,
+-7,
+-7,
+-7,
+-6,
+-6,
+-6,
+-6,
+-5,
+-5,
+-5,
+-4,
+-4,
+-4,
+-4,
+-3,
+-3,
+-3,
+-2,
+-2,
+-2,
+-2,
+-1,
+-1,
+-1,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+1,
+1,
+1,
+2,
+2,
+2,
+2,
+3,
+3,
+3,
+3,
+4,
+4,
+4,
+5,
+5,
+5,
+5,
+6,
+6,
+6,
+6,
+6,
+7,
+7,
+7,
+7,
+8,
+8,
+8,
+8,
+9,
+9,
+9,
+9,
+10,
+10,
+10,
+10,
+10,
+11,
+11,
+11,
+11,
+11,
+12,
+12,
+12,
+12,
+12,
+13,
+13,
+13,
+13,
+13,
+14,
+14,
+14,
+14,
+14,
+14,
+15,
+15,
+15,
+15,
+15,
+15,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+17,
+17,
+17,
+17,
+17,
+17,
+17,
+17,
+18,
+18,
+18,
+18,
+18,
+18,
+18,
+18,
+18,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+20,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+19,
+18,
+18,
+18,
+18,
+18,
+18,
+18,
+18,
+18,
+18,
+17,
+17,
+17,
+17,
+17,
+17,
+17,
+17,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+15,
+15,
+15,
+15,
+15,
+15,
+15,
+14,
+14,
+14,
+14,
+14,
+14,
+14,
+13,
+13,
+13,
+13,
+13,
+13,
+12,
+12,
+12,
+12,
+12,
+12,
+11,
+11,
+11,
+11,
+11,
+11,
+10,
+10,
+10,
+10,
+10,
+9,
+9,
+9,
+9,
+9,
+9,
+8,
+8,
+8,
+8,
+8,
+7,
+7,
+7,
+7,
+7,
+7,
+6,
+6,
+6,
+6,
+6,
+5,
+5,
+5,
+5,
+5,
+4,
+4,
+4,
+4,
+4,
+4,
+3,
+3,
+3,
+3,
+3,
+2,
+2,
+2,
+2,
+2,
+2,
+1,
+1,
+1,
+1,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-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,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+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,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+8,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+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,
+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,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-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,
+-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,
+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,
+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,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+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,
+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,
+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,
+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,
+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,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+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};
+
+static HWORD LARGE_FILTER_IMPD[] /* Impulse response differences */ = {
+-1,
+-2,
+-3,
+-5,
+-6,
+-7,
+-9,
+-10,
+-11,
+-13,
+-14,
+-15,
+-17,
+-18,
+-19,
+-21,
+-22,
+-23,
+-25,
+-26,
+-27,
+-28,
+-30,
+-32,
+-32,
+-34,
+-35,
+-36,
+-38,
+-39,
+-40,
+-42,
+-43,
+-44,
+-45,
+-47,
+-48,
+-49,
+-51,
+-52,
+-53,
+-54,
+-56,
+-56,
+-58,
+-60,
+-60,
+-62,
+-63,
+-64,
+-66,
+-66,
+-68,
+-69,
+-70,
+-72,
+-72,
+-74,
+-75,
+-76,
+-77,
+-79,
+-79,
+-81,
+-82,
+-83,
+-84,
+-85,
+-87,
+-87,
+-89,
+-90,
+-90,
+-92,
+-93,
+-94,
+-95,
+-96,
+-98,
+-98,
+-99,
+-100,
+-102,
+-102,
+-103,
+-105,
+-105,
+-106,
+-108,
+-108,
+-109,
+-110,
+-111,
+-112,
+-113,
+-114,
+-115,
+-116,
+-116,
+-118,
+-118,
+-119,
+-121,
+-120,
+-122,
+-123,
+-123,
+-125,
+-125,
+-126,
+-126,
+-128,
+-128,
+-129,
+-130,
+-130,
+-132,
+-132,
+-132,
+-134,
+-134,
+-135,
+-135,
+-136,
+-137,
+-137,
+-138,
+-139,
+-139,
+-140,
+-141,
+-141,
+-142,
+-142,
+-143,
+-143,
+-144,
+-145,
+-145,
+-145,
+-146,
+-147,
+-147,
+-147,
+-148,
+-149,
+-148,
+-150,
+-149,
+-150,
+-151,
+-151,
+-151,
+-152,
+-152,
+-152,
+-153,
+-153,
+-153,
+-153,
+-154,
+-154,
+-155,
+-155,
+-155,
+-155,
+-155,
+-156,
+-156,
+-156,
+-156,
+-156,
+-157,
+-157,
+-157,
+-157,
+-157,
+-157,
+-157,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-158,
+-158,
+-158,
+-157,
+-158,
+-158,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-157,
+-157,
+-157,
+-157,
+-157,
+-157,
+-157,
+-156,
+-156,
+-156,
+-156,
+-156,
+-155,
+-155,
+-155,
+-155,
+-155,
+-154,
+-154,
+-153,
+-154,
+-153,
+-153,
+-152,
+-152,
+-152,
+-151,
+-151,
+-151,
+-150,
+-150,
+-150,
+-149,
+-149,
+-148,
+-148,
+-147,
+-147,
+-147,
+-146,
+-145,
+-145,
+-145,
+-144,
+-144,
+-143,
+-142,
+-142,
+-142,
+-141,
+-140,
+-140,
+-139,
+-139,
+-138,
+-137,
+-137,
+-136,
+-136,
+-135,
+-134,
+-134,
+-133,
+-132,
+-132,
+-131,
+-130,
+-130,
+-129,
+-128,
+-128,
+-126,
+-126,
+-126,
+-125,
+-123,
+-124,
+-122,
+-122,
+-121,
+-120,
+-119,
+-119,
+-117,
+-117,
+-117,
+-115,
+-114,
+-113,
+-113,
+-112,
+-112,
+-110,
+-110,
+-108,
+-108,
+-107,
+-106,
+-106,
+-104,
+-104,
+-102,
+-102,
+-101,
+-100,
+-99,
+-98,
+-98,
+-96,
+-95,
+-95,
+-94,
+-92,
+-92,
+-91,
+-90,
+-89,
+-88,
+-87,
+-86,
+-85,
+-85,
+-83,
+-82,
+-82,
+-80,
+-80,
+-78,
+-78,
+-76,
+-76,
+-75,
+-73,
+-73,
+-72,
+-70,
+-70,
+-69,
+-68,
+-66,
+-66,
+-65,
+-64,
+-63,
+-61,
+-61,
+-60,
+-59,
+-58,
+-57,
+-56,
+-55,
+-54,
+-53,
+-51,
+-51,
+-50,
+-49,
+-48,
+-47,
+-46,
+-45,
+-44,
+-43,
+-42,
+-41,
+-41,
+-39,
+-38,
+-37,
+-36,
+-35,
+-34,
+-34,
+-32,
+-31,
+-31,
+-29,
+-28,
+-28,
+-26,
+-26,
+-24,
+-24,
+-23,
+-21,
+-21,
+-20,
+-19,
+-18,
+-17,
+-16,
+-15,
+-14,
+-13,
+-13,
+-11,
+-11,
+-9,
+-9,
+-8,
+-7,
+-6,
+-5,
+-5,
+-3,
+-2,
+-2,
+-1,
+0,
+1,
+2,
+2,
+4,
+4,
+5,
+6,
+7,
+8,
+8,
+10,
+10,
+11,
+11,
+13,
+13,
+14,
+15,
+15,
+17,
+17,
+18,
+18,
+20,
+20,
+21,
+21,
+23,
+23,
+23,
+25,
+25,
+26,
+26,
+27,
+28,
+28,
+30,
+29,
+31,
+31,
+32,
+32,
+33,
+34,
+34,
+35,
+35,
+36,
+37,
+37,
+37,
+39,
+39,
+39,
+40,
+40,
+41,
+42,
+42,
+42,
+43,
+44,
+44,
+44,
+45,
+46,
+45,
+47,
+46,
+48,
+47,
+48,
+49,
+49,
+49,
+49,
+50,
+51,
+51,
+51,
+51,
+52,
+52,
+53,
+53,
+53,
+53,
+54,
+54,
+54,
+55,
+55,
+55,
+55,
+56,
+56,
+56,
+56,
+57,
+57,
+57,
+57,
+58,
+57,
+58,
+58,
+58,
+58,
+59,
+58,
+59,
+59,
+59,
+59,
+59,
+59,
+59,
+60,
+59,
+60,
+59,
+60,
+60,
+60,
+59,
+60,
+60,
+60,
+60,
+59,
+60,
+60,
+60,
+60,
+59,
+60,
+60,
+59,
+60,
+59,
+60,
+59,
+59,
+59,
+59,
+59,
+59,
+59,
+58,
+59,
+58,
+58,
+58,
+58,
+57,
+58,
+57,
+57,
+57,
+57,
+55,
+57,
+56,
+56,
+55,
+56,
+55,
+55,
+54,
+55,
+54,
+54,
+54,
+53,
+53,
+53,
+52,
+53,
+52,
+51,
+52,
+51,
+50,
+51,
+50,
+49,
+50,
+49,
+48,
+49,
+48,
+47,
+47,
+47,
+47,
+46,
+46,
+45,
+45,
+45,
+44,
+44,
+43,
+43,
+42,
+43,
+41,
+42,
+40,
+41,
+40,
+39,
+40,
+38,
+39,
+37,
+38,
+37,
+36,
+36,
+35,
+36,
+34,
+34,
+34,
+33,
+33,
+32,
+32,
+31,
+31,
+30,
+30,
+29,
+29,
+28,
+28,
+27,
+27,
+26,
+26,
+25,
+25,
+24,
+24,
+24,
+22,
+23,
+21,
+21,
+21,
+20,
+20,
+19,
+19,
+18,
+18,
+17,
+16,
+16,
+16,
+15,
+14,
+14,
+14,
+13,
+12,
+12,
+11,
+11,
+11,
+9,
+10,
+8,
+9,
+7,
+8,
+6,
+7,
+5,
+5,
+5,
+4,
+4,
+3,
+3,
+2,
+1,
+1,
+1,
+0,
+0,
+-1,
+-1,
+-2,
+-3,
+-3,
+-3,
+-4,
+-4,
+-5,
+-5,
+-6,
+-6,
+-7,
+-7,
+-8,
+-8,
+-8,
+-9,
+-10,
+-10,
+-10,
+-11,
+-11,
+-12,
+-12,
+-13,
+-13,
+-14,
+-14,
+-14,
+-15,
+-15,
+-16,
+-16,
+-16,
+-17,
+-18,
+-17,
+-18,
+-19,
+-19,
+-19,
+-20,
+-20,
+-21,
+-20,
+-22,
+-21,
+-22,
+-23,
+-22,
+-23,
+-24,
+-23,
+-25,
+-24,
+-25,
+-25,
+-25,
+-26,
+-26,
+-27,
+-26,
+-27,
+-28,
+-27,
+-28,
+-28,
+-29,
+-29,
+-29,
+-29,
+-30,
+-30,
+-30,
+-30,
+-31,
+-31,
+-31,
+-31,
+-32,
+-32,
+-32,
+-32,
+-33,
+-33,
+-33,
+-33,
+-33,
+-34,
+-34,
+-34,
+-34,
+-34,
+-35,
+-34,
+-35,
+-35,
+-35,
+-36,
+-35,
+-36,
+-35,
+-36,
+-36,
+-36,
+-37,
+-36,
+-36,
+-37,
+-37,
+-36,
+-37,
+-37,
+-37,
+-37,
+-37,
+-38,
+-37,
+-37,
+-38,
+-37,
+-38,
+-37,
+-38,
+-37,
+-38,
+-38,
+-37,
+-38,
+-38,
+-37,
+-38,
+-38,
+-37,
+-38,
+-38,
+-37,
+-38,
+-37,
+-38,
+-37,
+-38,
+-37,
+-38,
+-37,
+-37,
+-37,
+-37,
+-37,
+-37,
+-37,
+-37,
+-35,
+-37,
+-36,
+-37,
+-36,
+-36,
+-36,
+-36,
+-36,
+-35,
+-36,
+-35,
+-36,
+-35,
+-35,
+-34,
+-35,
+-34,
+-35,
+-34,
+-34,
+-34,
+-33,
+-34,
+-33,
+-33,
+-33,
+-32,
+-33,
+-32,
+-32,
+-32,
+-32,
+-31,
+-31,
+-31,
+-31,
+-31,
+-30,
+-30,
+-30,
+-29,
+-30,
+-29,
+-29,
+-28,
+-28,
+-29,
+-27,
+-28,
+-27,
+-27,
+-27,
+-26,
+-27,
+-25,
+-26,
+-25,
+-26,
+-24,
+-25,
+-24,
+-24,
+-23,
+-24,
+-23,
+-22,
+-23,
+-22,
+-22,
+-21,
+-21,
+-21,
+-21,
+-20,
+-20,
+-19,
+-19,
+-19,
+-19,
+-18,
+-18,
+-18,
+-17,
+-17,
+-17,
+-16,
+-16,
+-15,
+-16,
+-14,
+-15,
+-14,
+-14,
+-14,
+-13,
+-13,
+-12,
+-12,
+-12,
+-12,
+-11,
+-10,
+-11,
+-10,
+-10,
+-9,
+-9,
+-9,
+-8,
+-8,
+-8,
+-7,
+-7,
+-6,
+-6,
+-6,
+-6,
+-5,
+-5,
+-4,
+-4,
+-4,
+-3,
+-3,
+-3,
+-2,
+-2,
+-2,
+-1,
+-1,
+-1,
+0,
+0,
+0,
+1,
+1,
+2,
+1,
+3,
+2,
+3,
+3,
+4,
+3,
+4,
+5,
+5,
+5,
+5,
+6,
+6,
+7,
+6,
+8,
+7,
+8,
+8,
+8,
+9,
+9,
+9,
+10,
+9,
+11,
+10,
+11,
+11,
+11,
+12,
+12,
+12,
+13,
+13,
+13,
+13,
+14,
+14,
+14,
+14,
+15,
+15,
+15,
+16,
+16,
+16,
+16,
+17,
+16,
+18,
+17,
+17,
+18,
+18,
+18,
+19,
+19,
+19,
+19,
+19,
+20,
+19,
+20,
+21,
+20,
+21,
+21,
+21,
+21,
+21,
+22,
+22,
+22,
+22,
+22,
+23,
+22,
+23,
+23,
+23,
+23,
+24,
+24,
+23,
+24,
+24,
+24,
+25,
+24,
+25,
+24,
+25,
+25,
+25,
+25,
+26,
+25,
+26,
+25,
+26,
+26,
+25,
+26,
+26,
+26,
+27,
+26,
+26,
+27,
+26,
+27,
+26,
+27,
+26,
+27,
+27,
+27,
+26,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+27,
+26,
+27,
+27,
+27,
+27,
+26,
+27,
+27,
+26,
+26,
+26,
+27,
+26,
+26,
+27,
+26,
+26,
+26,
+26,
+26,
+26,
+25,
+26,
+25,
+26,
+25,
+25,
+25,
+25,
+25,
+25,
+25,
+24,
+24,
+25,
+24,
+24,
+24,
+23,
+24,
+24,
+23,
+23,
+23,
+23,
+23,
+22,
+23,
+22,
+22,
+22,
+22,
+21,
+22,
+21,
+21,
+21,
+21,
+20,
+20,
+21,
+20,
+19,
+20,
+19,
+19,
+19,
+19,
+19,
+18,
+18,
+18,
+18,
+18,
+17,
+17,
+17,
+17,
+16,
+16,
+16,
+16,
+16,
+15,
+15,
+15,
+14,
+15,
+14,
+14,
+14,
+13,
+13,
+13,
+13,
+12,
+13,
+12,
+11,
+12,
+11,
+11,
+11,
+10,
+11,
+10,
+9,
+10,
+9,
+9,
+9,
+8,
+9,
+8,
+7,
+8,
+7,
+7,
+7,
+6,
+6,
+6,
+6,
+5,
+5,
+5,
+5,
+4,
+4,
+4,
+3,
+4,
+3,
+3,
+2,
+2,
+2,
+2,
+2,
+1,
+1,
+0,
+1,
+0,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-4,
+-3,
+-3,
+-4,
+-4,
+-5,
+-4,
+-5,
+-5,
+-5,
+-6,
+-6,
+-6,
+-6,
+-7,
+-6,
+-7,
+-7,
+-8,
+-7,
+-8,
+-8,
+-9,
+-8,
+-9,
+-9,
+-9,
+-10,
+-9,
+-10,
+-10,
+-10,
+-11,
+-10,
+-11,
+-11,
+-12,
+-11,
+-12,
+-12,
+-12,
+-12,
+-13,
+-12,
+-13,
+-13,
+-13,
+-14,
+-13,
+-14,
+-14,
+-14,
+-14,
+-15,
+-14,
+-15,
+-15,
+-15,
+-15,
+-16,
+-15,
+-16,
+-16,
+-16,
+-16,
+-16,
+-17,
+-16,
+-17,
+-17,
+-17,
+-17,
+-17,
+-18,
+-17,
+-18,
+-18,
+-17,
+-18,
+-18,
+-19,
+-18,
+-18,
+-19,
+-18,
+-19,
+-19,
+-19,
+-19,
+-19,
+-19,
+-19,
+-19,
+-20,
+-19,
+-20,
+-19,
+-20,
+-20,
+-20,
+-19,
+-20,
+-20,
+-20,
+-20,
+-20,
+-21,
+-20,
+-20,
+-20,
+-21,
+-20,
+-20,
+-21,
+-20,
+-21,
+-20,
+-20,
+-21,
+-20,
+-21,
+-20,
+-21,
+-20,
+-21,
+-20,
+-21,
+-21,
+-20,
+-20,
+-21,
+-20,
+-21,
+-20,
+-21,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-20,
+-19,
+-20,
+-20,
+-19,
+-20,
+-19,
+-19,
+-19,
+-20,
+-19,
+-19,
+-18,
+-19,
+-19,
+-19,
+-18,
+-18,
+-19,
+-18,
+-18,
+-18,
+-18,
+-18,
+-18,
+-17,
+-18,
+-17,
+-17,
+-17,
+-17,
+-17,
+-17,
+-16,
+-17,
+-16,
+-16,
+-17,
+-15,
+-16,
+-16,
+-15,
+-16,
+-15,
+-15,
+-15,
+-15,
+-15,
+-14,
+-14,
+-15,
+-14,
+-13,
+-14,
+-14,
+-13,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-12,
+-12,
+-12,
+-12,
+-11,
+-12,
+-11,
+-11,
+-11,
+-10,
+-11,
+-10,
+-10,
+-10,
+-9,
+-10,
+-9,
+-9,
+-9,
+-9,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-7,
+-7,
+-7,
+-7,
+-7,
+-6,
+-6,
+-6,
+-6,
+-6,
+-5,
+-5,
+-6,
+-4,
+-5,
+-4,
+-5,
+-4,
+-4,
+-3,
+-4,
+-3,
+-3,
+-3,
+-2,
+-3,
+-2,
+-2,
+-2,
+-1,
+-2,
+-1,
+-1,
+-1,
+0,
+-1,
+0,
+0,
+0,
+1,
+0,
+1,
+1,
+1,
+1,
+2,
+2,
+2,
+2,
+2,
+3,
+3,
+2,
+4,
+3,
+3,
+4,
+4,
+4,
+4,
+5,
+4,
+5,
+5,
+5,
+6,
+5,
+6,
+6,
+6,
+6,
+7,
+6,
+7,
+7,
+7,
+7,
+8,
+7,
+8,
+8,
+8,
+8,
+9,
+8,
+9,
+9,
+9,
+9,
+10,
+9,
+10,
+10,
+10,
+10,
+10,
+11,
+10,
+11,
+11,
+11,
+11,
+11,
+11,
+12,
+11,
+12,
+12,
+12,
+12,
+12,
+13,
+12,
+13,
+13,
+12,
+13,
+13,
+14,
+13,
+13,
+14,
+13,
+14,
+14,
+13,
+14,
+14,
+15,
+14,
+14,
+14,
+15,
+14,
+15,
+15,
+14,
+15,
+15,
+15,
+15,
+15,
+16,
+15,
+15,
+15,
+16,
+15,
+16,
+15,
+16,
+15,
+16,
+16,
+16,
+15,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+17,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+16,
+15,
+16,
+16,
+16,
+16,
+16,
+15,
+16,
+16,
+15,
+16,
+16,
+15,
+15,
+16,
+15,
+16,
+15,
+15,
+15,
+15,
+15,
+15,
+15,
+15,
+15,
+14,
+15,
+14,
+15,
+14,
+14,
+15,
+14,
+14,
+14,
+14,
+13,
+14,
+14,
+13,
+13,
+14,
+13,
+13,
+13,
+13,
+13,
+12,
+13,
+12,
+13,
+12,
+12,
+12,
+12,
+12,
+12,
+11,
+12,
+11,
+11,
+11,
+11,
+11,
+11,
+10,
+11,
+10,
+10,
+10,
+10,
+10,
+10,
+9,
+10,
+9,
+9,
+9,
+9,
+8,
+9,
+8,
+9,
+8,
+8,
+8,
+7,
+8,
+7,
+7,
+7,
+7,
+7,
+7,
+6,
+7,
+6,
+6,
+6,
+5,
+6,
+5,
+5,
+6,
+4,
+5,
+5,
+4,
+5,
+4,
+4,
+4,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+2,
+2,
+2,
+2,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+0,
+0,
+1,
+0,
+-1,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-3,
+-3,
+-3,
+-3,
+-4,
+-3,
+-4,
+-4,
+-4,
+-4,
+-4,
+-5,
+-4,
+-5,
+-5,
+-5,
+-5,
+-5,
+-6,
+-5,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-7,
+-6,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-8,
+-8,
+-7,
+-8,
+-8,
+-8,
+-8,
+-9,
+-8,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-10,
+-9,
+-10,
+-9,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-11,
+-10,
+-11,
+-10,
+-11,
+-11,
+-11,
+-10,
+-11,
+-11,
+-12,
+-11,
+-11,
+-11,
+-12,
+-11,
+-12,
+-12,
+-11,
+-12,
+-12,
+-12,
+-11,
+-12,
+-12,
+-13,
+-12,
+-12,
+-12,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-11,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-11,
+-12,
+-12,
+-11,
+-12,
+-11,
+-11,
+-12,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-10,
+-11,
+-10,
+-11,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-9,
+-10,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-8,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-7,
+-7,
+-8,
+-7,
+-7,
+-7,
+-7,
+-6,
+-7,
+-7,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-5,
+-6,
+-5,
+-5,
+-5,
+-5,
+-5,
+-4,
+-5,
+-4,
+-5,
+-4,
+-4,
+-4,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-3,
+-3,
+-3,
+-2,
+-3,
+-2,
+-2,
+-3,
+-2,
+-1,
+-2,
+-2,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+1,
+1,
+0,
+2,
+1,
+1,
+1,
+2,
+2,
+1,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+4,
+4,
+3,
+4,
+4,
+4,
+5,
+4,
+5,
+4,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+6,
+5,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+6,
+7,
+6,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+7,
+8,
+7,
+8,
+8,
+7,
+8,
+8,
+8,
+8,
+8,
+8,
+9,
+8,
+9,
+8,
+9,
+8,
+9,
+9,
+8,
+9,
+9,
+9,
+9,
+9,
+10,
+9,
+9,
+9,
+10,
+9,
+10,
+9,
+10,
+10,
+9,
+10,
+10,
+9,
+10,
+10,
+10,
+10,
+10,
+10,
+10,
+10,
+10,
+10,
+11,
+10,
+10,
+10,
+10,
+11,
+10,
+10,
+11,
+10,
+10,
+11,
+10,
+10,
+11,
+10,
+10,
+11,
+10,
+11,
+10,
+11,
+10,
+10,
+11,
+10,
+10,
+11,
+10,
+11,
+10,
+10,
+10,
+10,
+10,
+10,
+11,
+10,
+10,
+10,
+10,
+11,
+10,
+10,
+10,
+10,
+10,
+10,
+10,
+10,
+9,
+10,
+10,
+10,
+9,
+10,
+10,
+9,
+10,
+9,
+10,
+9,
+9,
+10,
+9,
+9,
+9,
+9,
+9,
+9,
+9,
+9,
+9,
+8,
+9,
+9,
+8,
+9,
+8,
+8,
+9,
+8,
+8,
+8,
+8,
+8,
+8,
+7,
+8,
+8,
+7,
+8,
+7,
+7,
+8,
+7,
+7,
+7,
+7,
+6,
+7,
+7,
+6,
+7,
+6,
+7,
+6,
+6,
+6,
+6,
+6,
+6,
+5,
+6,
+5,
+6,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+4,
+5,
+4,
+5,
+4,
+4,
+4,
+4,
+4,
+4,
+3,
+4,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-4,
+-5,
+-4,
+-4,
+-4,
+-5,
+-4,
+-5,
+-5,
+-5,
+-4,
+-5,
+-5,
+-6,
+-5,
+-5,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-7,
+-6,
+-6,
+-7,
+-6,
+-7,
+-7,
+-6,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-8,
+-7,
+-7,
+-8,
+-7,
+-8,
+-7,
+-8,
+-7,
+-8,
+-7,
+-8,
+-8,
+-8,
+-8,
+-7,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-9,
+-8,
+-8,
+-8,
+-8,
+-9,
+-8,
+-8,
+-8,
+-9,
+-8,
+-8,
+-9,
+-8,
+-9,
+-8,
+-8,
+-9,
+-8,
+-9,
+-8,
+-9,
+-8,
+-8,
+-9,
+-8,
+-9,
+-8,
+-9,
+-8,
+-9,
+-8,
+-8,
+-9,
+-8,
+-9,
+-8,
+-7,
+-9,
+-8,
+-8,
+-9,
+-8,
+-8,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-8,
+-7,
+-8,
+-8,
+-8,
+-7,
+-8,
+-8,
+-7,
+-8,
+-7,
+-8,
+-7,
+-8,
+-7,
+-7,
+-7,
+-8,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-7,
+-6,
+-7,
+-7,
+-6,
+-7,
+-7,
+-6,
+-6,
+-7,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-5,
+-6,
+-5,
+-5,
+-5,
+-5,
+-5,
+-4,
+-5,
+-5,
+-4,
+-5,
+-4,
+-5,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-3,
+-3,
+-4,
+-3,
+-2,
+-3,
+-3,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+3,
+2,
+2,
+2,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+4,
+3,
+4,
+3,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+5,
+4,
+4,
+5,
+5,
+4,
+5,
+5,
+4,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+6,
+5,
+5,
+5,
+6,
+5,
+6,
+5,
+6,
+6,
+5,
+6,
+6,
+6,
+5,
+6,
+6,
+6,
+6,
+6,
+6,
+7,
+6,
+6,
+6,
+6,
+7,
+6,
+6,
+7,
+6,
+7,
+6,
+6,
+7,
+7,
+6,
+7,
+6,
+7,
+6,
+7,
+7,
+7,
+6,
+7,
+7,
+6,
+7,
+7,
+7,
+7,
+6,
+7,
+7,
+7,
+7,
+7,
+6,
+7,
+7,
+7,
+7,
+7,
+7,
+6,
+7,
+7,
+7,
+7,
+7,
+7,
+6,
+7,
+7,
+6,
+7,
+6,
+7,
+7,
+7,
+6,
+7,
+7,
+6,
+7,
+7,
+6,
+7,
+7,
+6,
+7,
+6,
+7,
+6,
+7,
+6,
+6,
+7,
+6,
+6,
+7,
+6,
+6,
+6,
+6,
+6,
+7,
+6,
+6,
+6,
+6,
+5,
+6,
+6,
+6,
+6,
+5,
+6,
+6,
+5,
+6,
+5,
+6,
+5,
+5,
+6,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+4,
+4,
+5,
+4,
+4,
+4,
+4,
+3,
+4,
+4,
+4,
+3,
+4,
+3,
+4,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-5,
+-4,
+-4,
+-5,
+-4,
+-4,
+-5,
+-4,
+-5,
+-4,
+-5,
+-5,
+-4,
+-5,
+-5,
+-4,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-6,
+-5,
+-5,
+-5,
+-5,
+-6,
+-5,
+-5,
+-6,
+-5,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-5,
+-6,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-6,
+-5,
+-6,
+-5,
+-5,
+-5,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-5,
+-6,
+-5,
+-6,
+-5,
+-5,
+-6,
+-5,
+-5,
+-6,
+-5,
+-5,
+-5,
+-6,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-4,
+-5,
+-5,
+-5,
+-4,
+-5,
+-5,
+-4,
+-5,
+-4,
+-5,
+-4,
+-4,
+-5,
+-4,
+-4,
+-5,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-3,
+-4,
+-3,
+-3,
+-3,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-1,
+-2,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+4,
+3,
+4,
+3,
+4,
+3,
+4,
+3,
+4,
+4,
+3,
+4,
+4,
+4,
+4,
+3,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+5,
+4,
+4,
+4,
+4,
+5,
+4,
+4,
+4,
+5,
+4,
+4,
+5,
+4,
+4,
+5,
+4,
+5,
+4,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+4,
+5,
+3,
+4,
+5,
+4,
+5,
+4,
+4,
+5,
+4,
+5,
+4,
+4,
+5,
+4,
+4,
+5,
+4,
+4,
+4,
+4,
+5,
+4,
+4,
+4,
+4,
+4,
+5,
+4,
+4,
+4,
+4,
+4,
+4,
+4,
+3,
+4,
+4,
+4,
+4,
+4,
+3,
+4,
+4,
+4,
+3,
+4,
+4,
+3,
+4,
+3,
+4,
+3,
+3,
+4,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-3,
+-3,
+-3,
+-3,
+-4,
+-3,
+-3,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-4,
+-3,
+-3,
+-3,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-4,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-3,
+-3,
+-4,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-2,
+-3,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-3,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-2,
+-1,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-3,
+-1,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-2,
+-1,
+-2,
+-2,
+-1,
+-2,
+-1,
+-2,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+1,
+2,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+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,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+0,
+1,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+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,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+-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,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+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,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+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,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-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,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+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,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-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,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-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,
+-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,
+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,
+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,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+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,
+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,
+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,
+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,
+-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,
+-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,
+-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,
+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,
+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,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+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,
+-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};
diff --git a/third_party/resample/src/resample.c b/third_party/resample/src/resample.c
new file mode 100644
index 00000000..73122704
--- /dev/null
+++ b/third_party/resample/src/resample.c
@@ -0,0 +1,238 @@
+/*
+ * FILE: resample.c
+ * Sampling-rate-conversion main program (command line usage)
+ */
+
+static char resampleVersion[]
+ = "\n\tresample version 1.9 (Feb. 1, 2006 - jos@ccrma.stanford.edu)\n\n\
+Copyright 1982-2006 by Julius Smith.\n\
+This is free software. See the Lesser GNU Public License (LGPL) for copying conditions.\n\
+There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
+PARTICULAR PURPOSE.\n\n\
+";
+
+#define USAGE "\
+\n\
+USAGE: One of the following:\n\
+\n\
+ resample -to srate [-noFilterInterp] [-linearSignalInterp] [-f filterFile] [-terse] inputSoundFile outputSoundFile\n\
+ resample -by factor [options as above] inputSoundFile outputSoundFile\n\
+ resample -version\n\
+\n\
+Options can be abbreviated.\n\n\
+Report bugs to <bug-resample@w3k.org>.\n\n\
+"
+
+#include "filterkit.h"
+#include "resample.h"
+#include "sndlibextra.h"
+
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+static int trace = 1; /* controls verbosity of output */
+
+static char comment[256] = "";
+
+static void fail(char *s)
+{
+ fprintf(stderr,"\n*** resample: %s \n",s); /* Display error message */
+ fprintf(stderr,USAGE);
+ exit(1); /* Exit, indicating error */
+}
+
+static void fails(char *s, char *s2)
+{
+ printf("resample: "); /* Display error message */
+ printf(s,s2);
+ printf("\n\n");
+ exit(1); /* Exit, indicating error */
+}
+
+
+int main(int argc, char *argv[])
+{
+ double factor = -2.0; /* factor = Sndout/Sndin */
+ double newsrate=0;
+ BOOL interpFilt = TRUE; /* TRUE means interpolate filter coeffs */
+ BOOL largeFilter = FALSE; /* TRUE means use 65-tap FIR filter */
+ BOOL linearInterp = FALSE; /* TRUE => no filter, linearly interpolate */
+ BOOL knowFactor = FALSE; /* Used to detect insufficient command-line spec */
+ int inCount, outCount, outCountReal;
+ int infd, outfd, insrate, nChans, result;
+ int inType, inFormat;
+ int outType, outFormat;
+
+ struct stat statbuf;
+ char *insfname, *outsfname, *argv0;
+ char filterFile[512] = "";
+
+ if (argc == 1) {
+ fprintf(stderr, USAGE);
+ exit(1);
+ }
+
+ argv0 = argv[0];
+ while (--argc && **(++argv)=='-') {
+ ++(argv[0]); /* skip over '-' */
+ switch (*argv[0]) {
+ case 'a': /* -aaaQuality (old name) */
+ case 'e': /* -expensive */
+ largeFilter = TRUE;
+ if (trace)
+ printf("Choosing higher quality filter.\n");
+ break;
+ case 'b': /* -by factor */
+ if (--argc)
+ sscanf(*(++argv),"%lf",&factor);
+ if (trace)
+ printf("Sampling-rate conversion factor set to %f.\n",factor);
+ knowFactor = TRUE;
+ break;
+ case 'f': /* -filter filterFile */
+ if (--argc)
+ strcpy(filterFile, *++argv);
+ else
+ fail("Need to specify filter file name");
+ if (trace)
+ printf("Filter file set to %s.\n",filterFile);
+ break;
+ case 'l': /* -linearInpterpolation */
+ linearInterp = TRUE;
+ if (trace)
+ printf("Using linear instead of bandlimited interpolation\n");
+ break;
+ case 'n': /* -noFilterInterpolation */
+ interpFilt = FALSE;
+ if (trace)
+ printf("Filter-table interpolation disabled.\n");
+ break;
+ case 't':
+ if (*(argv[0]+1) == 'e') { /* -terse */
+ trace = 0;
+ break;
+ }
+ if (--argc) /* -to srate */
+ sscanf(*(++argv),"%lf",&newsrate);
+ if (trace)
+ printf("Target sampling-rate set to %f.\n",newsrate);
+ knowFactor = TRUE;
+ break;
+ case 'v': /* -version */
+ printf(resampleVersion);
+ if (argc == 1)
+ exit(0);
+ break;
+ default:
+ fprintf(stderr,"Unknown switch -%s\n",argv[0]);
+ fprintf(stderr,USAGE);
+ exit(1);
+ }
+ }
+
+ if (!knowFactor)
+ fail("Must specify sampling-rate conversion factor via '-to' or '-by' option");
+
+ if (argc < 1)
+ fail("Need to specify input soundfile");
+ insfname = *argv;
+
+ if (argc < 2) {
+ fprintf(stderr, USAGE);
+ exit(1);
+ }
+ else
+ outsfname = *++argv;
+
+ /* Test whether output file name exists. If so, bail... */
+ result = stat(outsfname, &statbuf);
+ if (result != -1)
+ fails("\"%s\" already exists", outsfname);
+ if (errno != ENOENT)
+ fails("Error creating output file (%s)", strerror(errno));
+
+ if (trace)
+ printf("Writing output to \"%s\".\n", outsfname);
+
+ /* Open input file and gather info from its header */
+ // resample-1.8: infd = sndlib_open_read(insfname);
+ infd = mus_sound_open_input(insfname);
+ if (infd == -1)
+ fails("Could not open input file \"%s\"", insfname);
+ if (NOT_A_SOUND_FILE(mus_header_type()))
+ fails("\"%s\" is probably not a sound file.", insfname);
+ nChans = mus_header_chans();
+ insrate = mus_header_srate();
+ inCount = mus_header_samples();
+ inType = mus_header_type(); /* header type (i.e. aiff, wave, etc) (see sndlib.h) */
+ inFormat = mus_header_format(); /* data format (see sndlib.h) */
+ inCount /= nChans; /* to get sample frames */
+
+/*
+ * Set output soundfile format.
+ * See sndlib.h for supported types (e.g., MUS_RIFF).
+ */
+ outType = inType;
+ outFormat = inFormat;
+
+ /* Compute sampling rate conversion factor, if not specified. */
+ if (newsrate>0) {
+ if (factor>0)
+ fprintf(stderr, "Command-line sampling-rate conversion factor "
+ "ignored ... the '-to' option overrides the '-by' option.\n");
+ factor = newsrate / (double)insrate;
+ if (trace)
+ printf("Sampling rate conversion factor set to %f\n",factor);
+ }
+
+ if (factor < 0) {
+ factor = -factor;
+ factor = GetDouble("Sampling-rate conversion factor",factor,"");
+ }
+
+ if (newsrate <= 0)
+ newsrate = (int)((double)insrate * factor + 0.5); /* round */
+
+ sprintf(comment,"%s -by %f %s%s%s%s%s%s%s %s",argv0,factor,
+ (largeFilter?"-expensiveFilter ":""),
+ (strcmp(filterFile,"")==0?"":"-f "),
+ (strcmp(filterFile,"")==0?"":filterFile),
+ (strcmp(filterFile,"")==0?"":" "),
+ (linearInterp? "-linearSigInterp ":""),
+ (interpFilt? "":"-noFilterInterp "),
+ insfname, outsfname);
+
+ outfd = sndlib_create(outsfname, inType, inFormat, newsrate, nChans, comment);
+ if (outfd == -1)
+ fails("Could not create output file \"%s\"", outsfname);
+ outCount = (int)(factor * (double)inCount + 0.5); /* output frames */
+
+ printf("\nStarting Conversion\n");
+ outCountReal = resample(factor, infd, outfd, inCount, outCount, nChans,
+ interpFilt, linearInterp, largeFilter, filterFile);
+
+ if (outCountReal <= 0)
+ fail("Conversion factor out of range");
+
+ if (trace && (outCount != outCountReal))
+ fprintf(stderr,
+ "outCount = %d, outCountReal = %d\n",outCount,outCountReal);
+
+ // resample-1.8: sndlib_close(infd, FALSE, 0, 0, 0);
+ mus_file_close(infd);
+
+ /* Output samps already written; just update header and close file. */
+ // resample-1.8: if (sndlib_close(outfd, 1, outType, outFormat, outCountReal * nChans))
+ // resample-1.8: fails("Error closing output file (%s)", strerror(errno));
+ mus_file_close(outfd);
+ int sound_bytes = outCountReal * nChans * mus_bytes_per_sample(outFormat);
+ mus_header_change_data_size(outsfname, inType, sound_bytes);
+
+ printf("\nConversion Finished: %d output samples.\n\n",outCount);
+
+ return(0);
+}
diff --git a/third_party/resample/src/resample.h b/third_party/resample/src/resample.h
new file mode 100644
index 00000000..c09e891b
--- /dev/null
+++ b/third_party/resample/src/resample.h
@@ -0,0 +1,86 @@
+/*
+ * FILE: resample.h
+ *
+ * The configuration constants below govern
+ * the number of bits in the input sample and filter coefficients, the
+ * number of bits to the right of the binary-point for fixed-point math, etc.
+ *
+ */
+
+#include "stdefs.h"
+
+/* Conversion constants */
+#define Nhc 8
+#define Na 7
+#define Np (Nhc+Na)
+#define Npc (1<<Nhc)
+#define Amask ((1<<Na)-1)
+#define Pmask ((1<<Np)-1)
+#define Nh 16
+#define Nb 16
+#define Nhxn 14
+#define Nhg (Nh-Nhxn)
+#define NLpScl 13
+
+/* Description of constants:
+ *
+ * Npc - is the number of look-up values available for the lowpass filter
+ * between the beginning of its impulse response and the "cutoff time"
+ * of the filter. The cutoff time is defined as the reciprocal of the
+ * lowpass-filter cut off frequence in Hz. For example, if the
+ * lowpass filter were a sinc function, Npc would be the index of the
+ * impulse-response lookup-table corresponding to the first zero-
+ * crossing of the sinc function. (The inverse first zero-crossing
+ * time of a sinc function equals its nominal cutoff frequency in Hz.)
+ * Npc must be a power of 2 due to the details of the current
+ * implementation. The default value of 512 is sufficiently high that
+ * using linear interpolation to fill in between the table entries
+ * gives approximately 16-bit accuracy in filter coefficients.
+ *
+ * Nhc - is log base 2 of Npc.
+ *
+ * Na - is the number of bits devoted to linear interpolation of the
+ * filter coefficients.
+ *
+ * Np - is Na + Nhc, the number of bits to the right of the binary point
+ * in the integer "time" variable. To the left of the point, it indexes
+ * the input array (X), and to the right, it is interpreted as a number
+ * between 0 and 1 sample of the input X. Np must be less than 16 in
+ * this implementation.
+ *
+ * Nh - is the number of bits in the filter coefficients. The sum of Nh and
+ * the number of bits in the input data (typically 16) cannot exceed 32.
+ * Thus Nh should be 16. The largest filter coefficient should nearly
+ * fill 16 bits (32767).
+ *
+ * Nb - is the number of bits in the input data. The sum of Nb and Nh cannot
+ * exceed 32.
+ *
+ * Nhxn - is the number of bits to right shift after multiplying each input
+ * sample times a filter coefficient. It can be as great as Nh and as
+ * small as 0. Nhxn = Nh-2 gives 2 guard bits in the multiply-add
+ * accumulation. If Nhxn=0, the accumulation will soon overflow 32 bits.
+ *
+ * Nhg - is the number of guard bits in mpy-add accumulation (equal to Nh-Nhxn)
+ *
+ * NLpScl - is the number of bits allocated to the unity-gain normalization
+ * factor. The output of the lowpass filter is multiplied by LpScl and
+ * then right-shifted NLpScl bits. To avoid overflow, we must have
+ * Nb+Nhg+NLpScl < 32.
+ */
+
+
+int resample( /* number of output sample returned */
+ double factor, /* factor = Sndout/Sndin */
+ int infd, /* input and output file descriptors */
+ int outfd,
+ int inCount, /* number of input samples to convert */
+ int outCount, /* number of output samples to compute */
+ int nChans, /* number of sound channels (1 or 2) */
+ BOOL interpFilt, /* TRUE means interpolate filter coeffs */
+ int fastMode, /* 0 = highest quality, slowest speed */
+ BOOL largeFilter, /* TRUE means use 65-tap FIR filter */
+ char *filterFile /* NULL for internal filter, else filename */
+);
+
+//#define MUS_SAMPLE_TYPE mus_sample_t; // more incompatible changes to sndlib
diff --git a/third_party/resample/src/resamplesubs.c b/third_party/resample/src/resamplesubs.c
new file mode 100644
index 00000000..920e56e6
--- /dev/null
+++ b/third_party/resample/src/resamplesubs.c
@@ -0,0 +1,520 @@
+/* resamplesubs.c - sampling rate conversion subroutines */
+// Altered version
+
+#include "resample.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+#define IBUFFSIZE 4096 /* Input buffer size */
+
+#include "smallfilter.h"
+#include "largefilter.h"
+
+#include "filterkit.h"
+#include "sndlibextra.h"
+
+#ifdef WITH_PJ
+#include "resamplesubs.h"
+
+unsigned resample_LARGE_FILTER_NMULT = LARGE_FILTER_NMULT;
+unsigned resample_LARGE_FILTER_NWING = LARGE_FILTER_NWING;
+unsigned resample_LARGE_FILTER_SCALE = LARGE_FILTER_SCALE;
+short* resample_LARGE_FILTER_IMP = LARGE_FILTER_IMP;
+short* resample_LARGE_FILTER_IMPD = LARGE_FILTER_IMPD;
+
+unsigned resample_SMALL_FILTER_NMULT = SMALL_FILTER_NMULT;
+unsigned resample_SMALL_FILTER_NWING = SMALL_FILTER_NWING;
+unsigned resample_SMALL_FILTER_SCALE = SMALL_FILTER_SCALE;
+short* resample_SMALL_FILTER_IMP = SMALL_FILTER_IMP;
+short* resample_SMALL_FILTER_IMPD = SMALL_FILTER_IMPD;
+#endif
+
+
+/* CAUTION: Assumes we call this for only one resample job per program run! */
+/* return: 0 - notDone */
+/* >0 - index of last sample */
+static int
+readData(int infd, /* input file descriptor */
+ int inCount, /* _total_ number of frames in input file */
+ HWORD *outPtr1, /* array receiving left chan samps */
+ HWORD *outPtr2, /* array receiving right chan samps */
+ int dataArraySize, /* size of these arrays */
+ int nChans,
+ int Xoff) /* read into input array starting at this index */
+{
+ int i, Nsamps, nret;
+ static unsigned int framecount; /* frames previously read */
+ static mus_sample_t **ibufs = NULL;
+
+ if (ibufs == NULL) { /* first time called, so allocate it */
+ ibufs = sndlib_allocate_buffers(nChans, dataArraySize);
+ if (ibufs == NULL) {
+ fprintf(stderr, "readData: Can't allocate input buffers!\n");
+ exit(1);
+ }
+ framecount = 0; /* init this too */
+ }
+
+ Nsamps = dataArraySize - Xoff; /* Calculate number of samples to get */
+ outPtr1 += Xoff; /* Start at designated sample number */
+ outPtr2 += Xoff;
+
+ nret = mus_file_read(infd, 0, Nsamps - 1, nChans, ibufs);
+ if (nret < 0) {
+ fprintf(stderr, "readData: Can't read data!\n");
+ exit(1);
+ }
+
+ /* NB: sndlib pads ibufs with zeros if it reads past EOF. */
+ if (nChans == 1) {
+ for (i = 0; i < Nsamps; i++)
+ *outPtr1++ = MUS_SAMPLE_TYPE_TO_HWORD(ibufs[0][i]);
+ }
+ else {
+ for (i = 0; i < Nsamps; i++) {
+ *outPtr1++ = MUS_SAMPLE_TYPE_TO_HWORD(ibufs[0][i]);
+ *outPtr2++ = MUS_SAMPLE_TYPE_TO_HWORD(ibufs[1][i]);
+ }
+ }
+
+ framecount += Nsamps;
+
+ if (framecount >= (unsigned)inCount) /* return index of last samp */
+ return (((Nsamps - (framecount - inCount)) - 1) + Xoff);
+ else
+ return 0;
+}
+
+
+#ifdef DEBUG
+static int pof = 0; /* positive overflow count */
+static int nof = 0; /* negative overflow count */
+#endif
+
+static INLINE HWORD WordToHword(WORD v, int scl)
+{
+ HWORD out;
+ WORD llsb = (1<<(scl-1));
+ v += llsb; /* round */
+ v >>= scl;
+ if (v>MAX_HWORD) {
+#ifdef DEBUG
+ if (pof == 0)
+ fprintf(stderr, "*** resample: sound sample overflow\n");
+ else if ((pof % 10000) == 0)
+ fprintf(stderr, "*** resample: another ten thousand overflows\n");
+ pof++;
+#endif
+ v = MAX_HWORD;
+ } else if (v < MIN_HWORD) {
+#ifdef DEBUG
+ if (nof == 0)
+ fprintf(stderr, "*** resample: sound sample (-) overflow\n");
+ else if ((nof % 1000) == 0)
+ fprintf(stderr, "*** resample: another thousand (-) overflows\n");
+ nof++;
+#endif
+ v = MIN_HWORD;
+ }
+ out = (HWORD) v;
+ return out;
+}
+
+/* Sampling rate conversion using linear interpolation for maximum speed.
+ */
+STATIC int
+ SrcLinear(HWORD X[], HWORD Y[], double factor, UWORD *Time, UHWORD Nx)
+{
+ HWORD iconst;
+ HWORD *Xp, *Ystart;
+ WORD v,x1,x2;
+
+ double dt; /* Step through input signal */
+ UWORD dtb; /* Fixed-point version of Dt */
+ UWORD endTime; /* When Time reaches EndTime, return to user */
+
+ dt = 1.0/factor; /* Output sampling period */
+ dtb = dt*(1<<Np) + 0.5; /* Fixed-point representation */
+
+ Ystart = Y;
+ endTime = *Time + (1<<Np)*(WORD)Nx;
+ while (*Time < endTime)
+ {
+ iconst = (*Time) & Pmask;
+ Xp = &X[(*Time)>>Np]; /* Ptr to current input sample */
+ x1 = *Xp++;
+ x2 = *Xp;
+ x1 *= ((1<<Np)-iconst);
+ x2 *= iconst;
+ v = x1 + x2;
+ *Y++ = WordToHword(v,Np); /* Deposit output */
+ *Time += dtb; /* Move to next sample by time increment */
+ }
+ return (Y - Ystart); /* Return number of output samples */
+}
+
+/* Sampling rate up-conversion only subroutine;
+ * Slightly faster than down-conversion;
+ */
+STATIC int SrcUp(HWORD X[], HWORD Y[], double factor, UWORD *Time,
+ UHWORD Nx, UHWORD Nwing, UHWORD LpScl,
+ HWORD Imp[], HWORD ImpD[], BOOL Interp)
+{
+ HWORD *Xp, *Ystart;
+ WORD v;
+
+ double dt; /* Step through input signal */
+ UWORD dtb; /* Fixed-point version of Dt */
+ UWORD endTime; /* When Time reaches EndTime, return to user */
+
+ dt = 1.0/factor; /* Output sampling period */
+ dtb = dt*(1<<Np) + 0.5; /* Fixed-point representation */
+
+ Ystart = Y;
+ endTime = *Time + (1<<Np)*(WORD)Nx;
+ while (*Time < endTime)
+ {
+ Xp = &X[*Time>>Np]; /* Ptr to current input sample */
+ /* Perform left-wing inner product */
+ v = FilterUp(Imp, ImpD, Nwing, Interp, Xp, (HWORD)(*Time&Pmask),-1);
+ /* Perform right-wing inner product */
+ v += FilterUp(Imp, ImpD, Nwing, Interp, Xp+1,
+ /* previous (triggers warning): (HWORD)((-*Time)&Pmask),1); */
+ (HWORD)((((*Time)^Pmask)+1)&Pmask),1);
+ v >>= Nhg; /* Make guard bits */
+ v *= LpScl; /* Normalize for unity filter gain */
+ *Y++ = WordToHword(v,NLpScl); /* strip guard bits, deposit output */
+ *Time += dtb; /* Move to next sample by time increment */
+ }
+ return (Y - Ystart); /* Return the number of output samples */
+}
+
+
+/* Sampling rate conversion subroutine */
+
+STATIC int SrcUD(HWORD X[], HWORD Y[], double factor, UWORD *Time,
+ UHWORD Nx, UHWORD Nwing, UHWORD LpScl,
+ HWORD Imp[], HWORD ImpD[], BOOL Interp)
+{
+ HWORD *Xp, *Ystart;
+ WORD v;
+
+ double dh; /* Step through filter impulse response */
+ double dt; /* Step through input signal */
+ UWORD endTime; /* When Time reaches EndTime, return to user */
+ UWORD dhb, dtb; /* Fixed-point versions of Dh,Dt */
+
+ dt = 1.0/factor; /* Output sampling period */
+ dtb = dt*(1<<Np) + 0.5; /* Fixed-point representation */
+
+ dh = MIN(Npc, factor*Npc); /* Filter sampling period */
+ dhb = dh*(1<<Na) + 0.5; /* Fixed-point representation */
+
+ Ystart = Y;
+ endTime = *Time + (1<<Np)*(WORD)Nx;
+ while (*Time < endTime)
+ {
+ Xp = &X[*Time>>Np]; /* Ptr to current input sample */
+ v = FilterUD(Imp, ImpD, Nwing, Interp, Xp, (HWORD)(*Time&Pmask),
+ -1, dhb); /* Perform left-wing inner product */
+ v += FilterUD(Imp, ImpD, Nwing, Interp, Xp+1,
+ /* previous (triggers warning): (HWORD)((-*Time)&Pmask), */
+ (HWORD)((((*Time)^Pmask)+1)&Pmask),
+ 1, dhb); /* Perform right-wing inner product */
+ v >>= Nhg; /* Make guard bits */
+ v *= LpScl; /* Normalize for unity filter gain */
+ *Y++ = WordToHword(v,NLpScl); /* strip guard bits, deposit output */
+ *Time += dtb; /* Move to next sample by time increment */
+ }
+ return (Y - Ystart); /* Return the number of output samples */
+}
+
+#ifndef WITH_PJ
+static int err_ret(char *s)
+{
+ fprintf(stderr,"resample: %s \n\n",s); /* Display error message */
+ return -1;
+}
+
+static int resampleFast( /* number of output samples returned */
+ double factor, /* factor = Sndout/Sndin */
+ int infd, /* input and output file descriptors */
+ int outfd,
+ int inCount, /* number of input samples to convert */
+ int outCount, /* number of output samples to compute */
+ int nChans) /* number of sound channels (1 or 2) */
+{
+ UWORD Time, Time2; /* Current time/pos in input sample */
+ UHWORD Xp, Ncreep, Xoff, Xread;
+ int OBUFFSIZE = (int)(((double)IBUFFSIZE)*factor+2.0);
+ HWORD X1[IBUFFSIZE], Y1[2]; /* I/O buffers */
+ HWORD X2[IBUFFSIZE], Y2[OBUFFSIZE]; /* I/O buffers */
+ UHWORD Nout, Nx;
+ int i, Ycount, last;
+
+ mus_sample_t **obufs = sndlib_allocate_buffers(nChans, OBUFFSIZE);
+ if (obufs == NULL)
+ return err_ret("Can't allocate output buffers");
+
+ Xoff = 10;
+
+ Nx = IBUFFSIZE - 2*Xoff; /* # of samples to process each iteration */
+ last = 0; /* Have not read last input sample yet */
+ Ycount = 0; /* Current sample and length of output file */
+
+ Xp = Xoff; /* Current "now"-sample pointer for input */
+ Xread = Xoff; /* Position in input array to read into */
+ Time = (Xoff<<Np); /* Current-time pointer for converter */
+
+ for (i=0; i<Xoff; X1[i++]=0); /* Need Xoff zeros at begining of sample */
+ for (i=0; i<Xoff; X2[i++]=0); /* Need Xoff zeros at begining of sample */
+
+ do {
+ if (!last) /* If haven't read last sample yet */
+ {
+ last = readData(infd, inCount, X1, X2, IBUFFSIZE,
+ nChans, (int)Xread);
+ if (last && (last-Xoff<Nx)) { /* If last sample has been read... */
+ Nx = last-Xoff; /* ...calc last sample affected by filter */
+ if (Nx <= 0)
+ break;
+ }
+ }
+
+ /* Resample stuff in input buffer */
+ Time2 = Time;
+ Nout=SrcLinear(X1,Y1,factor,&Time,Nx);
+ if (nChans==2)
+ Nout=SrcLinear(X2,Y2,factor,&Time2,Nx);
+
+ Time -= (Nx<<Np); /* Move converter Nx samples back in time */
+ Xp += Nx; /* Advance by number of samples processed */
+ Ncreep = (Time>>Np) - Xoff; /* Calc time accumulation in Time */
+ if (Ncreep) {
+ Time -= (Ncreep<<Np); /* Remove time accumulation */
+ Xp += Ncreep; /* and add it to read pointer */
+ }
+ for (i=0; i<IBUFFSIZE-Xp+Xoff; i++) { /* Copy part of input signal */
+ X1[i] = X1[i+Xp-Xoff]; /* that must be re-used */
+ if (nChans==2)
+ X2[i] = X2[i+Xp-Xoff]; /* that must be re-used */
+ }
+ if (last) { /* If near end of sample... */
+ last -= Xp; /* ...keep track were it ends */
+ if (!last) /* Lengthen input by 1 sample if... */
+ last++; /* ...needed to keep flag TRUE */
+ }
+ Xread = i; /* Pos in input buff to read new data into */
+ Xp = Xoff;
+
+ Ycount += Nout;
+ if (Ycount>outCount) {
+ Nout -= (Ycount-outCount);
+ Ycount = outCount;
+ }
+
+ if (Nout > OBUFFSIZE) /* Check to see if output buff overflowed */
+ return err_ret("Output array overflow");
+
+ if (nChans==1) {
+ for (i = 0; i < Nout; i++)
+ obufs[0][i] = HWORD_TO_MUS_SAMPLE_TYPE(Y1[i]);
+ } else {
+ for (i = 0; i < Nout; i++) {
+ obufs[0][i] = HWORD_TO_MUS_SAMPLE_TYPE(Y1[i]);
+ obufs[1][i] = HWORD_TO_MUS_SAMPLE_TYPE(Y2[i]);
+ }
+ }
+ /* NB: errors reported within sndlib */
+ mus_file_write(outfd, 0, Nout - 1, nChans, obufs);
+
+ printf("."); fflush(stdout);
+
+ } while (Ycount<outCount); /* Continue until done */
+
+ return(Ycount); /* Return # of samples in output file */
+}
+
+
+static int resampleWithFilter( /* number of output samples returned */
+ double factor, /* factor = outSampleRate/inSampleRate */
+ int infd, /* input and output file descriptors */
+ int outfd,
+ int inCount, /* number of input samples to convert */
+ int outCount, /* number of output samples to compute */
+ int nChans, /* number of sound channels (1 or 2) */
+ BOOL interpFilt, /* TRUE means interpolate filter coeffs */
+ HWORD Imp[], HWORD ImpD[],
+ UHWORD LpScl, UHWORD Nmult, UHWORD Nwing)
+{
+ UWORD Time, Time2; /* Current time/pos in input sample */
+ UHWORD Xp, Ncreep, Xoff, Xread;
+ int OBUFFSIZE = (int)(((double)IBUFFSIZE)*factor+2.0);
+ HWORD X1[IBUFFSIZE], Y1[OBUFFSIZE]; /* I/O buffers */
+ HWORD X2[IBUFFSIZE], Y2[OBUFFSIZE]; /* I/O buffers */
+ UHWORD Nout, Nx;
+ int i, Ycount, last;
+
+ mus_sample_t **obufs = sndlib_allocate_buffers(nChans, OBUFFSIZE);
+ if (obufs == NULL)
+ return err_ret("Can't allocate output buffers");
+
+ /* Account for increased filter gain when using factors less than 1 */
+ if (factor < 1)
+ LpScl = LpScl*factor + 0.5;
+
+ /* Calc reach of LP filter wing & give some creeping room */
+ Xoff = ((Nmult+1)/2.0) * MAX(1.0,1.0/factor) + 10;
+
+ if (IBUFFSIZE < 2*Xoff) /* Check input buffer size */
+ return err_ret("IBUFFSIZE (or factor) is too small");
+
+ Nx = IBUFFSIZE - 2*Xoff; /* # of samples to process each iteration */
+
+ last = 0; /* Have not read last input sample yet */
+ Ycount = 0; /* Current sample and length of output file */
+ Xp = Xoff; /* Current "now"-sample pointer for input */
+ Xread = Xoff; /* Position in input array to read into */
+ Time = (Xoff<<Np); /* Current-time pointer for converter */
+
+ for (i=0; i<Xoff; X1[i++]=0); /* Need Xoff zeros at begining of sample */
+ for (i=0; i<Xoff; X2[i++]=0); /* Need Xoff zeros at begining of sample */
+
+ do {
+ if (!last) /* If haven't read last sample yet */
+ {
+ last = readData(infd, inCount, X1, X2, IBUFFSIZE,
+ nChans, (int)Xread);
+ if (last && (last-Xoff<Nx)) { /* If last sample has been read... */
+ Nx = last-Xoff; /* ...calc last sample affected by filter */
+ if (Nx <= 0)
+ break;
+ }
+ }
+ /* Resample stuff in input buffer */
+ Time2 = Time;
+ if (factor >= 1) { /* SrcUp() is faster if we can use it */
+ Nout=SrcUp(X1,Y1,factor,&Time,Nx,Nwing,LpScl,Imp,ImpD,interpFilt);
+ if (nChans==2)
+ Nout=SrcUp(X2,Y2,factor,&Time2,Nx,Nwing,LpScl,Imp,ImpD,
+ interpFilt);
+ }
+ else {
+ Nout=SrcUD(X1,Y1,factor,&Time,Nx,Nwing,LpScl,Imp,ImpD,interpFilt);
+ if (nChans==2)
+ Nout=SrcUD(X2,Y2,factor,&Time2,Nx,Nwing,LpScl,Imp,ImpD,
+ interpFilt);
+ }
+
+ Time -= (Nx<<Np); /* Move converter Nx samples back in time */
+ Xp += Nx; /* Advance by number of samples processed */
+ Ncreep = (Time>>Np) - Xoff; /* Calc time accumulation in Time */
+ if (Ncreep) {
+ Time -= (Ncreep<<Np); /* Remove time accumulation */
+ Xp += Ncreep; /* and add it to read pointer */
+ }
+ for (i=0; i<IBUFFSIZE-Xp+Xoff; i++) { /* Copy part of input signal */
+ X1[i] = X1[i+Xp-Xoff]; /* that must be re-used */
+ if (nChans==2)
+ X2[i] = X2[i+Xp-Xoff]; /* that must be re-used */
+ }
+ if (last) { /* If near end of sample... */
+ last -= Xp; /* ...keep track were it ends */
+ if (!last) /* Lengthen input by 1 sample if... */
+ last++; /* ...needed to keep flag TRUE */
+ }
+ Xread = i; /* Pos in input buff to read new data into */
+ Xp = Xoff;
+
+ Ycount += Nout;
+ if (Ycount>outCount) {
+ Nout -= (Ycount-outCount);
+ Ycount = outCount;
+ }
+
+ if (Nout > OBUFFSIZE) /* Check to see if output buff overflowed */
+ return err_ret("Output array overflow");
+
+ if (nChans==1) {
+ for (i = 0; i < Nout; i++)
+ obufs[0][i] = HWORD_TO_MUS_SAMPLE_TYPE(Y1[i]);
+ } else {
+ for (i = 0; i < Nout; i++) {
+ obufs[0][i] = HWORD_TO_MUS_SAMPLE_TYPE(Y1[i]);
+ obufs[1][i] = HWORD_TO_MUS_SAMPLE_TYPE(Y2[i]);
+ }
+ }
+ /* NB: errors reported within sndlib */
+ mus_file_write(outfd, 0, Nout - 1, nChans, obufs);
+
+ printf("."); fflush(stdout);
+
+ } while (Ycount<outCount); /* Continue until done */
+
+ return(Ycount); /* Return # of samples in output file */
+}
+
+
+int resample( /* number of output samples returned */
+ double factor, /* factor = Sndout/Sndin */
+ int infd, /* input and output file descriptors */
+ int outfd,
+ int inCount, /* number of input samples to convert */
+ int outCount, /* number of output samples to compute */
+ int nChans, /* number of sound channels (1 or 2) */
+ BOOL interpFilt, /* TRUE means interpolate filter coeffs */
+ int fastMode, /* 0 = highest quality, slowest speed */
+ BOOL largeFilter, /* TRUE means use 65-tap FIR filter */
+ char *filterFile) /* NULL for internal filter, else filename */
+{
+ UHWORD LpScl; /* Unity-gain scale factor */
+ UHWORD Nwing; /* Filter table size */
+ UHWORD Nmult; /* Filter length for up-conversions */
+ HWORD *Imp=0; /* Filter coefficients */
+ HWORD *ImpD=0; /* ImpD[n] = Imp[n+1]-Imp[n] */
+
+ if (fastMode)
+ return resampleFast(factor,infd,outfd,inCount,outCount,nChans);
+
+#ifdef DEBUG
+ /* Check for illegal constants */
+ if (Np >= 16)
+ return err_ret("Error: Np>=16");
+ if (Nb+Nhg+NLpScl >= 32)
+ return err_ret("Error: Nb+Nhg+NLpScl>=32");
+ if (Nh+Nb > 32)
+ return err_ret("Error: Nh+Nb>32");
+#endif
+
+ /* Set defaults */
+
+ if (filterFile != NULL && *filterFile != '\0') {
+ if (readFilter(filterFile, &Imp, &ImpD, &LpScl, &Nmult, &Nwing))
+ return err_ret("could not find filter file, "
+ "or syntax error in contents of filter file");
+ } else if (largeFilter) {
+ Nmult = LARGE_FILTER_NMULT;
+ Imp = LARGE_FILTER_IMP; /* Impulse response */
+ ImpD = LARGE_FILTER_IMPD; /* Impulse response deltas */
+ LpScl = LARGE_FILTER_SCALE; /* Unity-gain scale factor */
+ Nwing = LARGE_FILTER_NWING; /* Filter table length */
+ } else {
+ Nmult = SMALL_FILTER_NMULT;
+ Imp = SMALL_FILTER_IMP; /* Impulse response */
+ ImpD = SMALL_FILTER_IMPD; /* Impulse response deltas */
+ LpScl = SMALL_FILTER_SCALE; /* Unity-gain scale factor */
+ Nwing = SMALL_FILTER_NWING; /* Filter table length */
+ }
+#if DEBUG
+ fprintf(stderr,"Attenuating resampler scale factor by 0.95 "
+ "to reduce probability of clipping\n");
+#endif
+ LpScl *= 0.95;
+ return resampleWithFilter(factor,infd,outfd,inCount,outCount,nChans,
+ interpFilt, Imp, ImpD, LpScl, Nmult, Nwing);
+}
+#endif /* WITH_PJ */
+
diff --git a/third_party/resample/src/smallfilter.h b/third_party/resample/src/smallfilter.h
new file mode 100644
index 00000000..6f6f0f84
--- /dev/null
+++ b/third_party/resample/src/smallfilter.h
@@ -0,0 +1,4617 @@
+/* Included by resamplesubs.c */
+#define SMALL_FILTER_NMULT ((HWORD)13)
+#define SMALL_FILTER_SCALE 13128 /* Unity-gain scale factor */
+#define SMALL_FILTER_NWING 1536 /* Filter table length */
+static HWORD SMALL_FILTER_IMP[] /* Impulse response */ = {
+32767,
+32766,
+32764,
+32760,
+32755,
+32749,
+32741,
+32731,
+32721,
+32708,
+32695,
+32679,
+32663,
+32645,
+32625,
+32604,
+32582,
+32558,
+32533,
+32506,
+32478,
+32448,
+32417,
+32385,
+32351,
+32316,
+32279,
+32241,
+32202,
+32161,
+32119,
+32075,
+32030,
+31984,
+31936,
+31887,
+31836,
+31784,
+31731,
+31676,
+31620,
+31563,
+31504,
+31444,
+31383,
+31320,
+31256,
+31191,
+31124,
+31056,
+30987,
+30916,
+30845,
+30771,
+30697,
+30621,
+30544,
+30466,
+30387,
+30306,
+30224,
+30141,
+30057,
+29971,
+29884,
+29796,
+29707,
+29617,
+29525,
+29433,
+29339,
+29244,
+29148,
+29050,
+28952,
+28852,
+28752,
+28650,
+28547,
+28443,
+28338,
+28232,
+28125,
+28017,
+27908,
+27797,
+27686,
+27574,
+27461,
+27346,
+27231,
+27115,
+26998,
+26879,
+26760,
+26640,
+26519,
+26398,
+26275,
+26151,
+26027,
+25901,
+25775,
+25648,
+25520,
+25391,
+25262,
+25131,
+25000,
+24868,
+24735,
+24602,
+24467,
+24332,
+24197,
+24060,
+23923,
+23785,
+23647,
+23507,
+23368,
+23227,
+23086,
+22944,
+22802,
+22659,
+22515,
+22371,
+22226,
+22081,
+21935,
+21789,
+21642,
+21494,
+21346,
+21198,
+21049,
+20900,
+20750,
+20600,
+20449,
+20298,
+20146,
+19995,
+19842,
+19690,
+19537,
+19383,
+19230,
+19076,
+18922,
+18767,
+18612,
+18457,
+18302,
+18146,
+17990,
+17834,
+17678,
+17521,
+17365,
+17208,
+17051,
+16894,
+16737,
+16579,
+16422,
+16264,
+16106,
+15949,
+15791,
+15633,
+15475,
+15317,
+15159,
+15001,
+14843,
+14685,
+14527,
+14369,
+14212,
+14054,
+13896,
+13739,
+13581,
+13424,
+13266,
+13109,
+12952,
+12795,
+12639,
+12482,
+12326,
+12170,
+12014,
+11858,
+11703,
+11548,
+11393,
+11238,
+11084,
+10929,
+10776,
+10622,
+10469,
+10316,
+10164,
+10011,
+9860,
+9708,
+9557,
+9407,
+9256,
+9106,
+8957,
+8808,
+8659,
+8511,
+8364,
+8216,
+8070,
+7924,
+7778,
+7633,
+7488,
+7344,
+7200,
+7057,
+6914,
+6773,
+6631,
+6490,
+6350,
+6210,
+6071,
+5933,
+5795,
+5658,
+5521,
+5385,
+5250,
+5115,
+4981,
+4848,
+4716,
+4584,
+4452,
+4322,
+4192,
+4063,
+3935,
+3807,
+3680,
+3554,
+3429,
+3304,
+3180,
+3057,
+2935,
+2813,
+2692,
+2572,
+2453,
+2335,
+2217,
+2101,
+1985,
+1870,
+1755,
+1642,
+1529,
+1418,
+1307,
+1197,
+1088,
+979,
+872,
+765,
+660,
+555,
+451,
+348,
+246,
+145,
+44,
+-54,
+-153,
+-250,
+-347,
+-443,
+-537,
+-631,
+-724,
+-816,
+-908,
+-998,
+-1087,
+-1175,
+-1263,
+-1349,
+-1435,
+-1519,
+-1603,
+-1685,
+-1767,
+-1848,
+-1928,
+-2006,
+-2084,
+-2161,
+-2237,
+-2312,
+-2386,
+-2459,
+-2531,
+-2603,
+-2673,
+-2742,
+-2810,
+-2878,
+-2944,
+-3009,
+-3074,
+-3137,
+-3200,
+-3261,
+-3322,
+-3381,
+-3440,
+-3498,
+-3554,
+-3610,
+-3665,
+-3719,
+-3772,
+-3824,
+-3875,
+-3925,
+-3974,
+-4022,
+-4069,
+-4116,
+-4161,
+-4205,
+-4249,
+-4291,
+-4333,
+-4374,
+-4413,
+-4452,
+-4490,
+-4527,
+-4563,
+-4599,
+-4633,
+-4666,
+-4699,
+-4730,
+-4761,
+-4791,
+-4820,
+-4848,
+-4875,
+-4901,
+-4926,
+-4951,
+-4974,
+-4997,
+-5019,
+-5040,
+-5060,
+-5080,
+-5098,
+-5116,
+-5133,
+-5149,
+-5164,
+-5178,
+-5192,
+-5205,
+-5217,
+-5228,
+-5238,
+-5248,
+-5257,
+-5265,
+-5272,
+-5278,
+-5284,
+-5289,
+-5293,
+-5297,
+-5299,
+-5301,
+-5303,
+-5303,
+-5303,
+-5302,
+-5300,
+-5298,
+-5295,
+-5291,
+-5287,
+-5282,
+-5276,
+-5270,
+-5263,
+-5255,
+-5246,
+-5237,
+-5228,
+-5217,
+-5206,
+-5195,
+-5183,
+-5170,
+-5157,
+-5143,
+-5128,
+-5113,
+-5097,
+-5081,
+-5064,
+-5047,
+-5029,
+-5010,
+-4991,
+-4972,
+-4952,
+-4931,
+-4910,
+-4889,
+-4867,
+-4844,
+-4821,
+-4797,
+-4774,
+-4749,
+-4724,
+-4699,
+-4673,
+-4647,
+-4620,
+-4593,
+-4566,
+-4538,
+-4510,
+-4481,
+-4452,
+-4422,
+-4393,
+-4363,
+-4332,
+-4301,
+-4270,
+-4238,
+-4206,
+-4174,
+-4142,
+-4109,
+-4076,
+-4042,
+-4009,
+-3975,
+-3940,
+-3906,
+-3871,
+-3836,
+-3801,
+-3765,
+-3729,
+-3693,
+-3657,
+-3620,
+-3584,
+-3547,
+-3510,
+-3472,
+-3435,
+-3397,
+-3360,
+-3322,
+-3283,
+-3245,
+-3207,
+-3168,
+-3129,
+-3091,
+-3052,
+-3013,
+-2973,
+-2934,
+-2895,
+-2855,
+-2816,
+-2776,
+-2736,
+-2697,
+-2657,
+-2617,
+-2577,
+-2537,
+-2497,
+-2457,
+-2417,
+-2377,
+-2337,
+-2297,
+-2256,
+-2216,
+-2176,
+-2136,
+-2096,
+-2056,
+-2016,
+-1976,
+-1936,
+-1896,
+-1856,
+-1817,
+-1777,
+-1737,
+-1698,
+-1658,
+-1619,
+-1579,
+-1540,
+-1501,
+-1462,
+-1423,
+-1384,
+-1345,
+-1306,
+-1268,
+-1230,
+-1191,
+-1153,
+-1115,
+-1077,
+-1040,
+-1002,
+-965,
+-927,
+-890,
+-854,
+-817,
+-780,
+-744,
+-708,
+-672,
+-636,
+-600,
+-565,
+-530,
+-494,
+-460,
+-425,
+-391,
+-356,
+-322,
+-289,
+-255,
+-222,
+-189,
+-156,
+-123,
+-91,
+-59,
+-27,
+4,
+35,
+66,
+97,
+127,
+158,
+188,
+218,
+247,
+277,
+306,
+334,
+363,
+391,
+419,
+447,
+474,
+501,
+528,
+554,
+581,
+606,
+632,
+657,
+683,
+707,
+732,
+756,
+780,
+803,
+827,
+850,
+872,
+895,
+917,
+939,
+960,
+981,
+1002,
+1023,
+1043,
+1063,
+1082,
+1102,
+1121,
+1139,
+1158,
+1176,
+1194,
+1211,
+1228,
+1245,
+1262,
+1278,
+1294,
+1309,
+1325,
+1340,
+1354,
+1369,
+1383,
+1397,
+1410,
+1423,
+1436,
+1448,
+1461,
+1473,
+1484,
+1496,
+1507,
+1517,
+1528,
+1538,
+1548,
+1557,
+1566,
+1575,
+1584,
+1592,
+1600,
+1608,
+1616,
+1623,
+1630,
+1636,
+1643,
+1649,
+1654,
+1660,
+1665,
+1670,
+1675,
+1679,
+1683,
+1687,
+1690,
+1694,
+1697,
+1700,
+1702,
+1704,
+1706,
+1708,
+1709,
+1711,
+1712,
+1712,
+1713,
+1713,
+1713,
+1713,
+1712,
+1711,
+1710,
+1709,
+1708,
+1706,
+1704,
+1702,
+1700,
+1697,
+1694,
+1691,
+1688,
+1685,
+1681,
+1677,
+1673,
+1669,
+1664,
+1660,
+1655,
+1650,
+1644,
+1639,
+1633,
+1627,
+1621,
+1615,
+1609,
+1602,
+1596,
+1589,
+1582,
+1575,
+1567,
+1560,
+1552,
+1544,
+1536,
+1528,
+1520,
+1511,
+1503,
+1494,
+1485,
+1476,
+1467,
+1458,
+1448,
+1439,
+1429,
+1419,
+1409,
+1399,
+1389,
+1379,
+1368,
+1358,
+1347,
+1337,
+1326,
+1315,
+1304,
+1293,
+1282,
+1271,
+1260,
+1248,
+1237,
+1225,
+1213,
+1202,
+1190,
+1178,
+1166,
+1154,
+1142,
+1130,
+1118,
+1106,
+1094,
+1081,
+1069,
+1057,
+1044,
+1032,
+1019,
+1007,
+994,
+981,
+969,
+956,
+943,
+931,
+918,
+905,
+892,
+879,
+867,
+854,
+841,
+828,
+815,
+802,
+790,
+777,
+764,
+751,
+738,
+725,
+713,
+700,
+687,
+674,
+662,
+649,
+636,
+623,
+611,
+598,
+585,
+573,
+560,
+548,
+535,
+523,
+510,
+498,
+486,
+473,
+461,
+449,
+437,
+425,
+413,
+401,
+389,
+377,
+365,
+353,
+341,
+330,
+318,
+307,
+295,
+284,
+272,
+261,
+250,
+239,
+228,
+217,
+206,
+195,
+184,
+173,
+163,
+152,
+141,
+131,
+121,
+110,
+100,
+90,
+80,
+70,
+60,
+51,
+41,
+31,
+22,
+12,
+3,
+-5,
+-14,
+-23,
+-32,
+-41,
+-50,
+-59,
+-67,
+-76,
+-84,
+-93,
+-101,
+-109,
+-117,
+-125,
+-133,
+-140,
+-148,
+-156,
+-163,
+-170,
+-178,
+-185,
+-192,
+-199,
+-206,
+-212,
+-219,
+-226,
+-232,
+-239,
+-245,
+-251,
+-257,
+-263,
+-269,
+-275,
+-280,
+-286,
+-291,
+-297,
+-302,
+-307,
+-312,
+-317,
+-322,
+-327,
+-332,
+-336,
+-341,
+-345,
+-349,
+-354,
+-358,
+-362,
+-366,
+-369,
+-373,
+-377,
+-380,
+-384,
+-387,
+-390,
+-394,
+-397,
+-400,
+-402,
+-405,
+-408,
+-411,
+-413,
+-416,
+-418,
+-420,
+-422,
+-424,
+-426,
+-428,
+-430,
+-432,
+-433,
+-435,
+-436,
+-438,
+-439,
+-440,
+-442,
+-443,
+-444,
+-445,
+-445,
+-446,
+-447,
+-447,
+-448,
+-448,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-449,
+-448,
+-448,
+-447,
+-447,
+-446,
+-445,
+-444,
+-443,
+-443,
+-442,
+-441,
+-440,
+-438,
+-437,
+-436,
+-435,
+-433,
+-432,
+-430,
+-429,
+-427,
+-426,
+-424,
+-422,
+-420,
+-419,
+-417,
+-415,
+-413,
+-411,
+-409,
+-407,
+-405,
+-403,
+-400,
+-398,
+-396,
+-393,
+-391,
+-389,
+-386,
+-384,
+-381,
+-379,
+-376,
+-374,
+-371,
+-368,
+-366,
+-363,
+-360,
+-357,
+-355,
+-352,
+-349,
+-346,
+-343,
+-340,
+-337,
+-334,
+-331,
+-328,
+-325,
+-322,
+-319,
+-316,
+-313,
+-310,
+-307,
+-304,
+-301,
+-298,
+-294,
+-291,
+-288,
+-285,
+-282,
+-278,
+-275,
+-272,
+-269,
+-265,
+-262,
+-259,
+-256,
+-252,
+-249,
+-246,
+-243,
+-239,
+-236,
+-233,
+-230,
+-226,
+-223,
+-220,
+-217,
+-213,
+-210,
+-207,
+-204,
+-200,
+-197,
+-194,
+-191,
+-187,
+-184,
+-181,
+-178,
+-175,
+-172,
+-168,
+-165,
+-162,
+-159,
+-156,
+-153,
+-150,
+-147,
+-143,
+-140,
+-137,
+-134,
+-131,
+-128,
+-125,
+-122,
+-120,
+-117,
+-114,
+-111,
+-108,
+-105,
+-102,
+-99,
+-97,
+-94,
+-91,
+-88,
+-86,
+-83,
+-80,
+-78,
+-75,
+-72,
+-70,
+-67,
+-65,
+-62,
+-59,
+-57,
+-55,
+-52,
+-50,
+-47,
+-45,
+-43,
+-40,
+-38,
+-36,
+-33,
+-31,
+-29,
+-27,
+-25,
+-22,
+-20,
+-18,
+-16,
+-14,
+-12,
+-10,
+-8,
+-6,
+-4,
+-2,
+0,
+0,
+2,
+4,
+6,
+8,
+9,
+11,
+13,
+14,
+16,
+17,
+19,
+21,
+22,
+24,
+25,
+27,
+28,
+29,
+31,
+32,
+33,
+35,
+36,
+37,
+38,
+40,
+41,
+42,
+43,
+44,
+45,
+46,
+47,
+48,
+49,
+50,
+51,
+52,
+53,
+54,
+55,
+56,
+56,
+57,
+58,
+59,
+59,
+60,
+61,
+62,
+62,
+63,
+63,
+64,
+64,
+65,
+66,
+66,
+66,
+67,
+67,
+68,
+68,
+69,
+69,
+69,
+70,
+70,
+70,
+70,
+71,
+71,
+71,
+71,
+71,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+72,
+71,
+71,
+71,
+71,
+71,
+70,
+70,
+70,
+70,
+69,
+69,
+69,
+69,
+68,
+68,
+68,
+67,
+67,
+67,
+66,
+66,
+66,
+65,
+65,
+64,
+64,
+64,
+63,
+63,
+62,
+62,
+62,
+61,
+61,
+60,
+60,
+59,
+59,
+58,
+58,
+58,
+57,
+57,
+56,
+56,
+55,
+55,
+54,
+54,
+53,
+53,
+52,
+52,
+51,
+51,
+50,
+50,
+49,
+48,
+48,
+47,
+47,
+46,
+46,
+45,
+45,
+44,
+44,
+43,
+43,
+42,
+42,
+41,
+41,
+40,
+39,
+39,
+38,
+38,
+37,
+37,
+36,
+36,
+35,
+35,
+34,
+34,
+33,
+33,
+32,
+32,
+31,
+31,
+30,
+30,
+29,
+29,
+28,
+28,
+27,
+27,
+26,
+26,
+25,
+25,
+24,
+24,
+23,
+23,
+23,
+22,
+22,
+21,
+21,
+20,
+20,
+20,
+19,
+19,
+18,
+18,
+17,
+17,
+17,
+16,
+16,
+15,
+15,
+15,
+14,
+14,
+14,
+13,
+13,
+12,
+12,
+12,
+11,
+11,
+11,
+10,
+10,
+10,
+9,
+9,
+9,
+9,
+8,
+8,
+8,
+7,
+7,
+7,
+7,
+6,
+6,
+6,
+6,
+5,
+5,
+5,
+5,
+4,
+4,
+4,
+4,
+3,
+3,
+3,
+3,
+3,
+2,
+2,
+2,
+2,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-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,
+-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,
+-2,
+-2,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1,
+-1
+};
+
+static HWORD SMALL_FILTER_IMPD[] = {
+-1,
+-2,
+-4,
+-5,
+-6,
+-8,
+-10,
+-10,
+-13,
+-13,
+-16,
+-16,
+-18,
+-20,
+-21,
+-22,
+-24,
+-25,
+-27,
+-28,
+-30,
+-31,
+-32,
+-34,
+-35,
+-37,
+-38,
+-39,
+-41,
+-42,
+-44,
+-45,
+-46,
+-48,
+-49,
+-51,
+-52,
+-53,
+-55,
+-56,
+-57,
+-59,
+-60,
+-61,
+-63,
+-64,
+-65,
+-67,
+-68,
+-69,
+-71,
+-71,
+-74,
+-74,
+-76,
+-77,
+-78,
+-79,
+-81,
+-82,
+-83,
+-84,
+-86,
+-87,
+-88,
+-89,
+-90,
+-92,
+-92,
+-94,
+-95,
+-96,
+-98,
+-98,
+-100,
+-100,
+-102,
+-103,
+-104,
+-105,
+-106,
+-107,
+-108,
+-109,
+-111,
+-111,
+-112,
+-113,
+-115,
+-115,
+-116,
+-117,
+-119,
+-119,
+-120,
+-121,
+-121,
+-123,
+-124,
+-124,
+-126,
+-126,
+-127,
+-128,
+-129,
+-129,
+-131,
+-131,
+-132,
+-133,
+-133,
+-135,
+-135,
+-135,
+-137,
+-137,
+-138,
+-138,
+-140,
+-139,
+-141,
+-141,
+-142,
+-142,
+-143,
+-144,
+-144,
+-145,
+-145,
+-146,
+-146,
+-147,
+-148,
+-148,
+-148,
+-149,
+-149,
+-150,
+-150,
+-151,
+-151,
+-152,
+-151,
+-153,
+-152,
+-153,
+-154,
+-153,
+-154,
+-154,
+-155,
+-155,
+-155,
+-155,
+-156,
+-156,
+-156,
+-156,
+-157,
+-156,
+-157,
+-157,
+-157,
+-157,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-157,
+-158,
+-157,
+-157,
+-157,
+-156,
+-157,
+-156,
+-156,
+-156,
+-156,
+-155,
+-155,
+-155,
+-155,
+-154,
+-155,
+-153,
+-154,
+-153,
+-153,
+-152,
+-153,
+-151,
+-152,
+-151,
+-150,
+-151,
+-150,
+-149,
+-149,
+-149,
+-148,
+-147,
+-148,
+-146,
+-146,
+-146,
+-145,
+-145,
+-144,
+-144,
+-143,
+-143,
+-141,
+-142,
+-141,
+-140,
+-140,
+-139,
+-138,
+-138,
+-137,
+-137,
+-136,
+-135,
+-135,
+-134,
+-133,
+-132,
+-132,
+-132,
+-130,
+-130,
+-129,
+-128,
+-128,
+-127,
+-126,
+-125,
+-125,
+-124,
+-123,
+-122,
+-122,
+-121,
+-120,
+-119,
+-118,
+-118,
+-116,
+-116,
+-115,
+-115,
+-113,
+-113,
+-111,
+-111,
+-110,
+-109,
+-109,
+-107,
+-107,
+-105,
+-105,
+-104,
+-103,
+-102,
+-101,
+-101,
+-98,
+-99,
+-97,
+-97,
+-96,
+-94,
+-94,
+-93,
+-92,
+-92,
+-90,
+-89,
+-88,
+-88,
+-86,
+-86,
+-84,
+-84,
+-82,
+-82,
+-81,
+-80,
+-78,
+-78,
+-77,
+-76,
+-75,
+-74,
+-73,
+-72,
+-72,
+-70,
+-69,
+-68,
+-68,
+-66,
+-65,
+-65,
+-63,
+-63,
+-61,
+-61,
+-59,
+-59,
+-58,
+-56,
+-56,
+-55,
+-54,
+-53,
+-52,
+-51,
+-50,
+-49,
+-48,
+-47,
+-47,
+-45,
+-44,
+-44,
+-42,
+-42,
+-41,
+-39,
+-39,
+-38,
+-37,
+-36,
+-36,
+-34,
+-33,
+-33,
+-31,
+-31,
+-30,
+-29,
+-28,
+-27,
+-26,
+-25,
+-25,
+-23,
+-23,
+-22,
+-21,
+-20,
+-20,
+-18,
+-18,
+-17,
+-16,
+-15,
+-14,
+-14,
+-13,
+-12,
+-11,
+-10,
+-10,
+-9,
+-8,
+-7,
+-6,
+-6,
+-5,
+-4,
+-4,
+-2,
+-2,
+-2,
+0,
+0,
+1,
+2,
+2,
+3,
+4,
+4,
+5,
+6,
+6,
+7,
+8,
+9,
+9,
+9,
+11,
+11,
+11,
+12,
+13,
+13,
+14,
+15,
+15,
+16,
+16,
+17,
+17,
+18,
+19,
+19,
+19,
+20,
+21,
+21,
+21,
+22,
+23,
+23,
+24,
+23,
+25,
+25,
+25,
+26,
+26,
+27,
+27,
+27,
+28,
+28,
+29,
+29,
+30,
+29,
+30,
+31,
+31,
+31,
+32,
+32,
+32,
+32,
+33,
+33,
+34,
+33,
+34,
+35,
+34,
+35,
+35,
+35,
+36,
+36,
+36,
+36,
+37,
+36,
+37,
+37,
+38,
+37,
+38,
+37,
+38,
+39,
+38,
+38,
+39,
+39,
+38,
+39,
+39,
+40,
+39,
+39,
+40,
+39,
+40,
+40,
+39,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+41,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+39,
+40,
+40,
+39,
+40,
+39,
+40,
+39,
+39,
+39,
+39,
+39,
+39,
+39,
+38,
+38,
+39,
+38,
+38,
+38,
+37,
+38,
+37,
+38,
+37,
+36,
+37,
+37,
+36,
+36,
+36,
+36,
+36,
+35,
+35,
+36,
+34,
+35,
+34,
+35,
+34,
+33,
+34,
+33,
+33,
+33,
+33,
+32,
+32,
+32,
+31,
+31,
+31,
+31,
+30,
+31,
+30,
+30,
+29,
+30,
+29,
+28,
+29,
+28,
+28,
+28,
+27,
+27,
+27,
+26,
+27,
+25,
+26,
+25,
+26,
+24,
+25,
+24,
+24,
+23,
+24,
+23,
+22,
+23,
+22,
+22,
+21,
+21,
+21,
+21,
+20,
+20,
+19,
+20,
+19,
+18,
+19,
+18,
+18,
+17,
+17,
+17,
+17,
+16,
+16,
+15,
+16,
+15,
+14,
+15,
+14,
+14,
+13,
+13,
+13,
+12,
+13,
+12,
+11,
+12,
+11,
+10,
+11,
+10,
+10,
+9,
+9,
+9,
+9,
+8,
+8,
+8,
+8,
+7,
+7,
+6,
+7,
+6,
+5,
+6,
+5,
+5,
+5,
+4,
+4,
+4,
+3,
+4,
+3,
+3,
+2,
+2,
+2,
+2,
+1,
+2,
+1,
+0,
+1,
+0,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-2,
+-2,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-4,
+-4,
+-4,
+-5,
+-4,
+-5,
+-5,
+-6,
+-5,
+-6,
+-6,
+-6,
+-6,
+-6,
+-7,
+-6,
+-7,
+-7,
+-7,
+-8,
+-7,
+-8,
+-8,
+-8,
+-8,
+-8,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-10,
+-9,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-11,
+-10,
+-11,
+-10,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-12,
+-11,
+-12,
+-12,
+-11,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-11,
+-12,
+-11,
+-12,
+-11,
+-12,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-10,
+-11,
+-11,
+-10,
+-10,
+-11,
+-10,
+-10,
+-10,
+-10,
+-10,
+-9,
+-10,
+-10,
+-9,
+-10,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-8,
+-9,
+-8,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-7,
+-8,
+-8,
+-7,
+-7,
+-8,
+-7,
+-7,
+-7,
+-7,
+-6,
+-7,
+-7,
+-6,
+-7,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-4,
+-5,
+-4,
+-4,
+-5,
+-4,
+-4,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+0,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-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,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+-1,
+-2,
+-4,
+-5,
+-6,
+-8,
+-10,
+-10,
+-13,
+-13,
+-16,
+-16,
+-18,
+-20,
+-21,
+-22,
+-24,
+-25,
+-27,
+-28,
+-30,
+-31,
+-32,
+-34,
+-35,
+-37,
+-38,
+-39,
+-41,
+-42,
+-44,
+-45,
+-46,
+-48,
+-49,
+-51,
+-52,
+-53,
+-55,
+-56,
+-57,
+-59,
+-60,
+-61,
+-63,
+-64,
+-65,
+-67,
+-68,
+-69,
+-71,
+-71,
+-74,
+-74,
+-76,
+-77,
+-78,
+-79,
+-81,
+-82,
+-83,
+-84,
+-86,
+-87,
+-88,
+-89,
+-90,
+-92,
+-92,
+-94,
+-95,
+-96,
+-98,
+-98,
+-100,
+-100,
+-102,
+-103,
+-104,
+-105,
+-106,
+-107,
+-108,
+-109,
+-111,
+-111,
+-112,
+-113,
+-115,
+-115,
+-116,
+-117,
+-119,
+-119,
+-120,
+-121,
+-121,
+-123,
+-124,
+-124,
+-126,
+-126,
+-127,
+-128,
+-129,
+-129,
+-131,
+-131,
+-132,
+-133,
+-133,
+-135,
+-135,
+-135,
+-137,
+-137,
+-138,
+-138,
+-140,
+-139,
+-141,
+-141,
+-142,
+-142,
+-143,
+-144,
+-144,
+-145,
+-145,
+-146,
+-146,
+-147,
+-148,
+-148,
+-148,
+-149,
+-149,
+-150,
+-150,
+-151,
+-151,
+-152,
+-151,
+-153,
+-152,
+-153,
+-154,
+-153,
+-154,
+-154,
+-155,
+-155,
+-155,
+-155,
+-156,
+-156,
+-156,
+-156,
+-157,
+-156,
+-157,
+-157,
+-157,
+-157,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-158,
+-157,
+-158,
+-158,
+-157,
+-158,
+-157,
+-158,
+-157,
+-157,
+-157,
+-156,
+-157,
+-156,
+-156,
+-156,
+-156,
+-155,
+-155,
+-155,
+-155,
+-154,
+-155,
+-153,
+-154,
+-153,
+-153,
+-152,
+-153,
+-151,
+-152,
+-151,
+-150,
+-151,
+-150,
+-149,
+-149,
+-149,
+-148,
+-147,
+-148,
+-146,
+-146,
+-146,
+-145,
+-145,
+-144,
+-144,
+-143,
+-143,
+-141,
+-142,
+-141,
+-140,
+-140,
+-139,
+-138,
+-138,
+-137,
+-137,
+-136,
+-135,
+-135,
+-134,
+-133,
+-132,
+-132,
+-132,
+-130,
+-130,
+-129,
+-128,
+-128,
+-127,
+-126,
+-125,
+-125,
+-124,
+-123,
+-122,
+-122,
+-121,
+-120,
+-119,
+-118,
+-118,
+-116,
+-116,
+-115,
+-115,
+-113,
+-113,
+-111,
+-111,
+-110,
+-109,
+-109,
+-107,
+-107,
+-105,
+-105,
+-104,
+-103,
+-102,
+-101,
+-101,
+-98,
+-99,
+-97,
+-97,
+-96,
+-94,
+-94,
+-93,
+-92,
+-92,
+-90,
+-89,
+-88,
+-88,
+-86,
+-86,
+-84,
+-84,
+-82,
+-82,
+-81,
+-80,
+-78,
+-78,
+-77,
+-76,
+-75,
+-74,
+-73,
+-72,
+-72,
+-70,
+-69,
+-68,
+-68,
+-66,
+-65,
+-65,
+-63,
+-63,
+-61,
+-61,
+-59,
+-59,
+-58,
+-56,
+-56,
+-55,
+-54,
+-53,
+-52,
+-51,
+-50,
+-49,
+-48,
+-47,
+-47,
+-45,
+-44,
+-44,
+-42,
+-42,
+-41,
+-39,
+-39,
+-38,
+-37,
+-36,
+-36,
+-34,
+-33,
+-33,
+-31,
+-31,
+-30,
+-29,
+-28,
+-27,
+-26,
+-25,
+-25,
+-23,
+-23,
+-22,
+-21,
+-20,
+-20,
+-18,
+-18,
+-17,
+-16,
+-15,
+-14,
+-14,
+-13,
+-12,
+-11,
+-10,
+-10,
+-9,
+-8,
+-7,
+-6,
+-6,
+-5,
+-4,
+-4,
+-2,
+-2,
+-2,
+0,
+0,
+1,
+2,
+2,
+3,
+4,
+4,
+5,
+6,
+6,
+7,
+8,
+9,
+9,
+9,
+11,
+11,
+11,
+12,
+13,
+13,
+14,
+15,
+15,
+16,
+16,
+17,
+17,
+18,
+19,
+19,
+19,
+20,
+21,
+21,
+21,
+22,
+23,
+23,
+24,
+23,
+25,
+25,
+25,
+26,
+26,
+27,
+27,
+27,
+28,
+28,
+29,
+29,
+30,
+29,
+30,
+31,
+31,
+31,
+32,
+32,
+32,
+32,
+33,
+33,
+34,
+33,
+34,
+35,
+34,
+35,
+35,
+35,
+36,
+36,
+36,
+36,
+37,
+36,
+37,
+37,
+38,
+37,
+38,
+37,
+38,
+39,
+38,
+38,
+39,
+39,
+38,
+39,
+39,
+40,
+39,
+39,
+40,
+39,
+40,
+40,
+39,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+41,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+40,
+39,
+40,
+40,
+39,
+40,
+39,
+40,
+39,
+39,
+39,
+39,
+39,
+39,
+39,
+38,
+38,
+39,
+38,
+38,
+38,
+37,
+38,
+37,
+38,
+37,
+36,
+37,
+37,
+36,
+36,
+36,
+36,
+36,
+35,
+35,
+36,
+34,
+35,
+34,
+35,
+34,
+33,
+34,
+33,
+33,
+33,
+33,
+32,
+32,
+32,
+31,
+31,
+31,
+31,
+30,
+31,
+30,
+30,
+29,
+30,
+29,
+28,
+29,
+28,
+28,
+28,
+27,
+27,
+27,
+26,
+27,
+25,
+26,
+25,
+26,
+24,
+25,
+24,
+24,
+23,
+24,
+23,
+22,
+23,
+22,
+22,
+21,
+21,
+21,
+21,
+20,
+20,
+19,
+20,
+19,
+18,
+19,
+18,
+18,
+17,
+17,
+17,
+17,
+16,
+16,
+15,
+16,
+15,
+14,
+15,
+14,
+14,
+13,
+13,
+13,
+12,
+13,
+12,
+11,
+12,
+11,
+10,
+11,
+10,
+10,
+9,
+9,
+9,
+9,
+8,
+8,
+8,
+8,
+7,
+7,
+6,
+7,
+6,
+5,
+6,
+5,
+5,
+5,
+4,
+4,
+4,
+3,
+4,
+3,
+3,
+2,
+2,
+2,
+2,
+1,
+2,
+1,
+0,
+1,
+0,
+0,
+0,
+-1,
+-1,
+-1,
+-1,
+-1,
+-2,
+-2,
+-2,
+-2,
+-3,
+-3,
+-3,
+-3,
+-3,
+-4,
+-4,
+-4,
+-4,
+-5,
+-4,
+-5,
+-5,
+-6,
+-5,
+-6,
+-6,
+-6,
+-6,
+-6,
+-7,
+-6,
+-7,
+-7,
+-7,
+-8,
+-7,
+-8,
+-8,
+-8,
+-8,
+-8,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-10,
+-9,
+-10,
+-10,
+-10,
+-10,
+-10,
+-10,
+-11,
+-10,
+-11,
+-10,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-12,
+-11,
+-12,
+-12,
+-11,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-13,
+-12,
+-13,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-13,
+-12,
+-12,
+-13,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-12,
+-11,
+-12,
+-11,
+-12,
+-11,
+-12,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-11,
+-10,
+-11,
+-11,
+-10,
+-10,
+-11,
+-10,
+-10,
+-10,
+-10,
+-10,
+-9,
+-10,
+-10,
+-9,
+-10,
+-9,
+-8,
+-9,
+-9,
+-9,
+-9,
+-9,
+-9,
+-8,
+-9,
+-8,
+-9,
+-8,
+-8,
+-8,
+-8,
+-8,
+-7,
+-8,
+-8,
+-7,
+-7,
+-8,
+-7,
+-7,
+-7,
+-7,
+-6,
+-7,
+-7,
+-6,
+-7,
+-6,
+-6,
+-6,
+-6,
+-6,
+-6,
+-5,
+-6,
+-5,
+-6,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-5,
+-4,
+-5,
+-4,
+-4,
+-5,
+-4,
+-4,
+-4,
+-3,
+-4,
+-4,
+-3,
+-4,
+-3,
+-3,
+-4,
+-3,
+-3,
+-2,
+-3,
+-3,
+-3,
+-2,
+-3,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-2,
+-1,
+-2,
+-1,
+-2,
+-1,
+-1,
+-2,
+-1,
+-1,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+2,
+1,
+2,
+1,
+2,
+2,
+2,
+1,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+4,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+3,
+3,
+3,
+3,
+2,
+3,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+3,
+2,
+3,
+2,
+3,
+3,
+2,
+2,
+3,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+3,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+2,
+0,
+2,
+2,
+2,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+2,
+1,
+2,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+2,
+1,
+1,
+1,
+2,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+1,
+1,
+0,
+1,
+0,
+1,
+0,
+1,
+1,
+0,
+0,
+1,
+0,
+1,
+0,
+1,
+0,
+0,
+1,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+-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,
+1,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+1
+};
diff --git a/third_party/resample/src/sndlibextra.c b/third_party/resample/src/sndlibextra.c
new file mode 100644
index 00000000..c756cb10
--- /dev/null
+++ b/third_party/resample/src/sndlibextra.c
@@ -0,0 +1,90 @@
+/* sndlibextra.c
+
+ An interface to the low-level sndlib functions contained in sndlib/headers.c
+ and sndlib/io.c, designed for use by the resample program.
+ (sndlibextra.c is a stripped-down version of sndlibsupport.c in RTcmix.)
+
+ - John Gibson (jgg9c@virginia.edu)
+*/
+#include <assert.h>
+#include <string.h>
+#include "sndlibextra.h"
+
+/* #define NDEBUG */ /* define to disable asserts */
+
+/* ---------------------------------------------------- sndlib_create --- */
+/* Creates a new file and writes a header with the given characteristics.
+ <type> is a sndlib constant for header type (e.g. MUS_AIFF).
+ <format> is a sndlib constant for sound data format (e.g. snd_16_linear).
+ (These constants are defined in sndlib.h.) Caller is responsible for
+ checking that the header type and data format are compatible, and that
+ the header type is one that sndlib can write (is WRITEABLE_HEADER_TYPE()).
+ Writes no comment.
+
+ NOTE: This will truncate an existing file with <sfname>, so check first!
+
+ On success, returns a standard file descriptor, and leaves the file
+ position pointer at the end of the header.
+ On failure, returns -1. Caller can check errno then.
+*/
+int
+sndlib_create(char *sfname, /* file name */
+ int type, /* file type, e.g. AIFF */
+ int format, /* data format, e.g., MU-LAW */
+ int srate, /* sampling rate in Hz */
+ int chans, /* 1 for mono, 2 for stereo */
+ char *comment)
+{
+ int fd, loc;
+ assert(sfname != NULL && strlen(sfname) <= FILENAME_MAX);
+ mus_header_initialize(); // make sure relevant parts of sndlib are initialized
+ //resample-1.8: sndlib_write_header(fd, 0, type, format, srate, chans, comment, &loc)
+ //resample-1.8: mus_file_open_descriptors(fd, format, mus_header_data_format_to_bytes_per_sample(),loc);
+ // int mus_file_open_descriptors(int tfd, const char *arg, int df, int ds, off_t dl, int dc, int dt);
+ fd = mus_sound_open_output(sfname, srate, chans, format, type, "created by resample");
+ return fd;
+}
+
+/* ------------------------------------------ sndlib_allocate_buffers --- */
+/* Allocate the multi-dimensional array required by sndlib I/O functions.
+ Returns an array of <nchans> arrays of <nframes> integers. The memory
+ is cleared. If the return value is NULL, check errno.
+*/
+int **
+sndlib_allocate_buffers(int nchans, int nframes)
+{
+ int **bufs, n;
+
+ assert(nchans > 0 && nframes > 0);
+
+ bufs = (int **)calloc(nchans, sizeof(int *));
+ if (bufs == NULL)
+ return NULL;
+
+ for (n = 0; n < nchans; n++) {
+ bufs[n] = (int *)calloc(nframes, sizeof(int));
+ if (bufs[n] == NULL) {
+ sndlib_free_buffers(bufs, nchans);
+ return NULL;
+ }
+ }
+
+ return bufs;
+}
+
+
+/* ---------------------------------------------- sndlib_free_buffers --- */
+/* Free the multi-dimensional array <bufs> with <nchans> elements.
+*/
+void
+sndlib_free_buffers(int **bufs, int nchans)
+{
+ int n;
+
+ assert(bufs != NULL);
+
+ for (n = 0; n < nchans; n++)
+ if (bufs[n])
+ free(bufs[n]);
+ free(bufs);
+}
diff --git a/third_party/resample/src/sndlibextra.h b/third_party/resample/src/sndlibextra.h
new file mode 100644
index 00000000..536ac72c
--- /dev/null
+++ b/third_party/resample/src/sndlibextra.h
@@ -0,0 +1,48 @@
+#include <endian.h> /* so that sndlib.h will get host byte-order right */
+#include <sndlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* for creating, opening and closing files for sndlib I/O */
+int sndlib_create(char *, int, int, int, int, char *);
+int sndlib_open_read(char *);
+int sndlib_open_write(char *);
+int sndlib_close(int, int, int, int, int);
+
+/* for reading and writing headers */
+int sndlib_read_header(int);
+int sndlib_write_header(int, int, int, int, int, int, char *, int *);
+int sndlib_set_header_data_size(int, int, int);
+
+/* helper functions */
+int **sndlib_allocate_buffers(int, int);
+void sndlib_free_buffers(int **, int);
+
+
+/* some handy macros */
+
+#define IS_FLOAT_FORMAT(format) ( \
+ (format) == snd_32_float \
+ || (format) == snd_32_float_little_endian )
+
+#define NOT_A_SOUND_FILE(header_type) ( \
+ (header_type) == MUS_UNSUPPORTED \
+ || (header_type) == MUS_RAW )
+
+/* The header types that sndlib can write, as of sndlib-5.5. */
+#define WRITEABLE_HEADER_TYPE(type) ( \
+ (type) == MUS_AIFF \
+ || (type) == MUS_NEXT \
+ || (type) == MUS_RIFF \
+ || (type) == MUS_IRCAM )
+
+#define INVALID_DATA_FORMAT(format) ((format) < 1)
+
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
diff --git a/third_party/resample/src/stdefs.h b/third_party/resample/src/stdefs.h
new file mode 100644
index 00000000..4672981b
--- /dev/null
+++ b/third_party/resample/src/stdefs.h
@@ -0,0 +1,59 @@
+/* stdefs.h */
+#ifndef _STDEFS_H
+#define _STDEFS_H
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef PI
+#define PI (3.14159265358979232846)
+#endif
+
+#ifndef PI2
+#define PI2 (6.28318530717958465692)
+#endif
+
+#define D2R (0.01745329348) /* (2*pi)/360 */
+#define R2D (57.29577951) /* 360/(2*pi) */
+
+#ifndef MAX
+#define MAX(x,y) ((x)>(y) ?(x):(y))
+#endif
+#ifndef MIN
+#define MIN(x,y) ((x)<(y) ?(x):(y))
+#endif
+
+#ifndef ABS
+#define ABS(x) ((x)<0 ?(-(x)):(x))
+#endif
+
+#ifndef SGN
+#define SGN(x) ((x)<0 ?(-1):((x)==0?(0):(1)))
+#endif
+
+typedef char BOOL;
+typedef short HWORD;
+typedef unsigned short UHWORD;
+typedef int WORD;
+typedef unsigned int UWORD;
+
+#define MUS_SAMPLE_TYPE_TO_HWORD(x) ((HWORD)((x)>>(MUS_SAMPLE_BITS-16)))
+#define HWORD_TO_MUS_SAMPLE_TYPE(x) ((mus_sample_t)((x)<<(MUS_SAMPLE_BITS-16)))
+
+#define MAX_HWORD (32767)
+#define MIN_HWORD (-32768)
+
+#ifdef DEBUG
+#define INLINE
+#else
+#ifndef INLINE
+#define INLINE inline
+#endif
+#endif
+
+#endif /* _STDEFS_H */
diff --git a/third_party/resample/src/windowfilter.c b/third_party/resample/src/windowfilter.c
new file mode 100644
index 00000000..b2b67690
--- /dev/null
+++ b/third_party/resample/src/windowfilter.c
@@ -0,0 +1,114 @@
+/* makefilter.c */
+
+#include <stdio.h>
+#include <math.h>
+#include "stdefs.h"
+#include "filterkit.h"
+#include "resample.h"
+#define MAXNWING 8192 /* FIXME: flush */
+
+/* LIBRARIES needed:
+ *
+ * 1. filterkit
+ * makeFilter() - designs a Kaiser-windowed low-pass filter
+ * writeFilter() - writes a filter to a standard filter file
+ * GetUShort() - prompt user for a UHWORD with help
+ * GetDouble() - prompt user for a double with help
+ *
+ * 2. math
+ */
+
+char NmultHelp[] =
+ "\n Nmult is the length of the symmetric FIR lowpass filter used"
+ "\n by the sampling rate converter. It must be odd."
+ "\n This is the number of multiplies per output sample for"
+ "\n up-conversions (Factor>1), and is the number of multiplies"
+ "\n per input sample for down-conversions (Factor<1). Thus if"
+ "\n the rate conversion is Srate2 = Factor*Srate1, then you have"
+ "\n Nmult*Srate1*MAXof(Factor,1) multiplies per second of real time."
+ "\n Naturally, higher Nmult gives better lowpass-filtering at the"
+ "\n expense of longer compute times. Nmult should be odd because"
+ "\n it is the length of a symmetric FIR filter, and the current"
+ "\n implementation requires a coefficient at the time origin.\n";
+
+char FrollHelp[] =
+ "\n Froll determines the frequency at which the lowpass filter begins to"
+ "\n roll-off. If Froll=1, then there is no 'guard zone' and the filter"
+ "\n roll-off region will be aliased. If Froll is 0.90, for example, then"
+ "\n the filter begins rolling off at 0.90*Srate/2, so that by Srate/2,"
+ "\n the filter is well down and aliasing is reduced. Since aliasing"
+ "\n distortion is typically worse than loss of the high-frequency spectral"
+ "\n amplitude, Froll<1 is highly recommended. The default of 0.90"
+ "\n sacrifices the upper 10 percent of the spectrum as an anti-aliasing"
+ "\n guard zone.\n";
+
+char BetaHelp[] =
+ "\n Beta trades the rejection of the lowpass filter against the"
+ "\n transition width from passband to stopband. Larger Beta means"
+ "\n a slower transition and greater stopband rejection. See Rabiner"
+ "\n and Gold (Th. and App. of DSP) under Kaiser windows for more about"
+ "\n Beta. The following table from Rabiner and Gold (p. 101) gives some"
+ "\n feel for the effect of Beta:"
+ "\n"
+ "\n BETA D PB RIP SB RIP"
+ "\n 2.120 1.50 +-0.27 -30"
+ "\n 3.384 2.23 0.0864 -40"
+ "\n 4.538 2.93 0.0274 -50"
+ "\n 5.658 3.62 0.00868 -60"
+ "\n 6.764 4.32 0.00275 -70"
+ "\n 7.865 5.0 0.000868 -80"
+ "\n 8.960 5.7 0.000275 -90"
+ "\n 10.056 6.4 0.000087 -100"
+ "\n"
+ "\n Above, ripples are in dB, and the transition band width is "
+ "\n approximately D*Fs/N, where Fs = sampling rate, "
+ "\n and N = window length. PB = 'pass band' and SB = 'stop band'."
+ "\n Alternatively, D is the transition widths in bins given a"
+ "\n length N DFT (i.e. a window transform with no zero padding."
+ "\n";
+
+
+int main(void)
+{
+ HWORD Imp[MAXNWING]; /* Filter coefficients */
+ HWORD ImpD[MAXNWING]; /* ImpD[i] = ImpD[i+1] - ImpD[i] */
+ double Froll, Beta;
+ UHWORD Nmult, Nwing, LpScl;
+ int err;
+
+ Froll = 0.90;
+ Beta = 9;
+ Nmult = 65;
+ while (1)
+ {
+ Froll = GetDouble("Normalized Roll-off freq (0<Froll<=1)",
+ Froll, FrollHelp);
+ Beta = GetDouble("Beta", Beta, BetaHelp);
+ Nmult = GetUHWORD("Odd filter length 'Nmult'", Nmult, NmultHelp);
+ if ((Nmult&1) == 0) {
+ Nmult++;
+ printf("Filter length increased to %d to make it odd.\n",Nmult);
+ }
+ Nwing = Npc*(Nmult-1)/2; /* # of filter coeffs in right wing */
+ printf("\n");
+ if (!(Nmult % 2))
+ printf("Error: Nmult must be odd and greater than zero\n");
+ else if ((err = makeFilter(Imp, ImpD, &LpScl, Nwing, Froll, Beta))) {
+ printf("*** Error: Unable to make filter.\n");
+ if (err == 1)
+ printf("\tNmult=%d too large for MAXNWING=%d\n",Nmult,MAXNWING);
+ else if (err == 2)
+ printf("\tNormalized roll-off freq Froll must be between 0 and 1\n");
+ else if (err == 3)
+ printf("\tHeisenberg says Beta must be greater or equal to 1\n");
+ else if (err == 4) {
+ printf("\tUnity-gain scale factor overflows 16-bit half-word\n");
+ printf("\tFilter design was probably way off. Try relaxing specs.\n");
+ }
+ } else if ((err = writeFilter(Imp, ImpD, LpScl, Nmult, Nwing)))
+ printf("Error: Unable to write filter, err=%d\n", err);
+ else
+ break;
+ }
+ return(0);
+}