add libsndifle 1.0.17 to in tree libs

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3761 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2006-12-20 19:08:07 +00:00
parent 2506451f8a
commit f210c27f43
233 changed files with 141616 additions and 1 deletions

14
libs/libsndfile/AUTHORS Normal file
View File

@ -0,0 +1,14 @@
The main author of libsndfile is Erik de Castro Lopo <erikd@mega-nerd.com>.
The code in the src/GSM610 directory was written by Jutta Degener
<jutta@cs.tu-berlin.de> and Carsten Bormann <cabo@cs.tu-berlin.de>.
They should not be contacted in relation to libsndfile or the GSM 6.10 code
that is part of libsndfile. Their original code can be found at:
http://kbs.cs.tu-berlin.de/~jutta/toast.html
Code in the src/G72x directory was released by Sun Microsystems, Inc. to the
public domain. Minor modifications were required to integrate these files
into libsndfile. The changes are listed in src/G72x/ChangeLog.

503
libs/libsndfile/COPYING Normal file
View File

@ -0,0 +1,503 @@
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
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

6316
libs/libsndfile/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

182
libs/libsndfile/INSTALL Normal file
View File

@ -0,0 +1,182 @@
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, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
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 at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' 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. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
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 supports 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' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' 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' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
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 host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
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.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--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.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -0,0 +1,27 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = man doc Win32 Octave src examples regtest tests
DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = reconfigure.mk acinclude.m4 libsndfile.spec.in \
sndfile.pc.in Mingw-make-dist.sh
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = sndfile.pc
m4datadir = $(datadir)/aclocal
test: check-recursive
# Target to make autogenerated files.
genfiles :
(cd src ; make genfiles)
(cd tests ; make genfiles)
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: e40c569e-8020-4e95-b774-6b0703614526

671
libs/libsndfile/Makefile.in Normal file
View File

@ -0,0 +1,671 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/libsndfile.spec.in \
$(srcdir)/sndfile.pc.in $(top_srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL NEWS TODO compile config.guess \
config.sub depcomp install-sh ltmain.sh missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES = libsndfile.spec sndfile.pc
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
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
pkgconfigDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgconfig_DATA)
ETAGS = etags
CTAGS = ctags
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@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
SUBDIRS = man doc Win32 Octave src examples regtest tests
DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = reconfigure.mk acinclude.m4 libsndfile.spec.in \
sndfile.pc.in Mingw-make-dist.sh
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = sndfile.pc
m4datadir = $(datadir)/aclocal
all: 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)
libsndfile.spec: $(top_builddir)/config.status $(srcdir)/libsndfile.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
sndfile.pc: $(top_builddir)/config.status $(srcdir)/sndfile.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(mkdir_p) "$(DESTDIR)$(pkgconfigdir)"
@list='$(pkgconfig_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
$(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
done
# 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) $(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) $(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) $(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)
$(am__remove_distdir)
mkdir $(distdir)
$(mkdir_p) $(distdir)/. $(distdir)/doc $(distdir)/src
@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 $(DATA)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(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 clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
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 mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am uninstall-pkgconfigDATA
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
check-am clean clean-generic clean-libtool clean-recursive \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-libtool 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-pkgconfigDATA \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
maintainer-clean-recursive mostlyclean mostlyclean-generic \
mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am uninstall-info-am \
uninstall-pkgconfigDATA
test: check-recursive
# Target to make autogenerated files.
genfiles :
(cd src ; make genfiles)
(cd tests ; make genfiles)
# 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:

View File

@ -0,0 +1,122 @@
#!/bin/sh
# Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the author nor the names of any contributors may be used
# to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
function unix_to_dos {
sed -e "s/\n/\r\n/" $1 > temp_file
mv -f temp_file $1
}
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
echo "Usage : Mingw-make-dist.sh <source tarball>."
exit 1
fi
TARGZ=$1
if [ ! -f $TARGZ ]; then
echo "Can't find source tarball."
fi
TARGZ=$1
if [ ! -f $TARGZ.asc ]; then
echo "Can't find source tarball signature."
fi
UNAME=`uname -s`
if [ x$UNAME != "xMINGW32_NT-5.1" ]; then
echo "Not able to build Win32 binaries on this platform."
fi
echo "Building MinGW binary/source zip file."
VERSION=`pwd | sed -e "s#.*/##" | sed -e s/libsndfile-//`
BUILD=`echo $VERSION | sed -e "s/\./_/g"`
INSTALL="libsndfile-$BUILD"
ZIPNAME="$INSTALL.zip"
if [ -z "$BUILD" ]; then
echo "Bad BUILD variable : '$BUILD'"
exit 1
fi
if [ ! -d $INSTALL/ ]; then
mkdir $INSTALL
fi
if [ ! -f config.status ]; then
./configure --prefix=`pwd`/$INSTALL/
else
teststr=`grep "with options" config.status | grep -- --prefix=`
if [ -z "$teststr" ]; then
# --disable-static doesn't work.
./configure --prefix=`pwd`/$INSTALL/
fi
fi
if [ ! -f src/.libs/libsndfile-1.dll ]; then
make all check
fi
if [ ! -f $INSTALL/bin/libsndfile-1.dll ]; then
make install
rm -f $INSTALL/bin/sndfile-regtest.exe
strip $INSTALL/bin/*.*
mv $INSTALL/bin/*.* $INSTALL/include/*.* $INSTALL/
rmdir $INSTALL/bin
rm -rf $INSTALL/lib
rmdir $INSTALL/include
cp src/libsndfile.def $INSTALL/libsndfile-1.def
cp Win32/README-precompiled-dll.txt Win32/testprog.c $INSTALL/
unix_to_dos $INSTALL/libsndfile-1.def
unix_to_dos $INSTALL/sndfile.h
unix_to_dos $INSTALL/README-precompiled-dll.txt
unix_to_dos $INSTALL/testprog.c
fi
if [ ! -f $INSTALL/libsndfile-$VERSION.tar.gz ]; then
cp $TARGZ $INSTALL/
if [ -f $TARGZ.asc ]; then
cp $TARGZ.asc $INSTALL/
fi
fi
if [ ! -f $ZIPNAME ]; then
zip -r $ZIPNAME $INSTALL/
fi
# Do not edit or modify anything in this comment block.
# The following line is a file identity tag for the GNU Arch
# revision control system.
#
# arch-tag: 3f82cd8a-f800-48d7-9646-2cdcf03c81a0

131
libs/libsndfile/NEWS Normal file
View File

@ -0,0 +1,131 @@
Version 1.0.17 (2006-08-31)
* Add sndfile.hh C++ wrapper.
* Update Win32 MinGW build instructions.
* Minor bug fixes and cleanups.
Version 1.0.16 (2006-04-30)
* Add support for Broadcast (BEXT) chunks in WAV files.
* Implement new commands SFC_GET_SIGNAL_MAX and SFC_GET_MAX_ALL_CHANNELS.
* Add support for RIFX (big endian WAV variant).
* Fix configure script bugs.
* Fix bug in INST and MARK chunk writing for AIFF files.
Version 1.0.15 (2006-03-16)
* Fix some ia64 issues.
* Fix precompiled DLL.
* Minor bug fixes.
Version 1.0.14 (2006-02-19)
* Really fix MinGW compile problems.
* Minor bug fixes.
Version 1.0.13 (2006-01-21)
* Fix for MinGW compiler problems.
* Allow readin/write of instrument chunks from WAV and AIFF files.
* Compile problem fix for Solaris compiler.
* Minor cleanups and bug fixes.
Version 1.0.12 (2005-09-30)
* Add support for FLAC and Apple's Core Audio Format (CAF).
* Add virtual I/O interface (still needs docs).
* Cygwin and other Win32 fixes.
* Minor bug fixes and cleanups.
Version 1.0.11 (2004-11-15)
* Add support for SD2 files.
* Add read support for loop info in WAV and AIFF files.
* Add more tests.
* Improve type safety.
* Minor optimisations and bug fixes.
Version 1.0.10 (2004-06-15)
* Fix AIFF read/write mode bugs.
* Add support for compiling Win32 DLLS using MinGW.
* Fix problems resulting in failed compiles with gcc-2.95.
* Improve test suite.
* Minor bug fixes.
Version 1.0.9 (2004-03-30)
* Add handling of AVR (Audio Visual Research) files.
* Improve handling of WAVEFORMATEXTENSIBLE WAV files.
* Fix for using pipes on Win32.
Version 1.0.8 (2004-03-14)
* Correct peak chunk handing for files with > 16 tracks.
* Fix for WAV files with huge number of CUE chunks.
Version 1.0.7 (2004-02-25)
* Fix clip mode detection on ia64, MIPS and other CPUs.
* Fix two MacOSX build problems.
Version 1.0.6 (2004-02-08)
* Added support for native Win32 file access API (Ross Bencina).
* New mode to add clippling then a converting from float/double to integer
would otherwise wrap around.
* Fixed a bug in reading/writing files > 2Gig on Linux, Solaris and others.
* Many minor bug fixes.
* Other random fixes for Win32.
Version 1.0.5 (2003-05-03)
* Added support for HTK files.
* Added new function sf_open_fd() to allow for secure opening of temporary
files as well as reading/writing sound files embedded within larger
container files.
* Added string support for AIFF files.
* Minor bug fixes and code cleanups.
Version 1.0.4 (2003-02-02)
* Added suport of PVF and XI files.
* Added functionality for setting and retreiving strings from sound files.
* Minor code cleanups and bug fixes.
Version 1.0.3 (2002-12-09)
* Minor bug fixes.
Version 1.0.2 (2002-11-24)
* Added support for VOX ADPCM.
* Improved error reporting.
* Added version scripting on Linux and Solaris.
* Minor bug fixes.
Version 1.0.1 (2002-09-14)
* Added MAT and MAT5 file formats.
* Minor bug fixes.
Version 1.0.0 (2002-08-16)
* Final release for 1.0.0.
Version 1.0.0rc6 (2002-08-14)
* Release candidate 6 for the 1.0.0 series.
* MacOS9 fixes.
Version 1.0.0rc5 (2002-08-10)
* Release candidate 5 for the 1.0.0 series.
* Changed the definition of sf_count_t which was causing problems when
libsndfile was compiled with other libraries (ie WxWindows).
* Minor bug fixes.
* Documentation cleanup.
Version 1.0.0rc4 (2002-08-03)
* Release candidate 4 for the 1.0.0 series.
* Minor bug fixes.
* Fix broken Win32 "make check".
Version 1.0.0rc3 (2002-08-02)
* Release candidate 3 for the 1.0.0 series.
* Fix bug where libsndfile was reading beyond the end of the data chunk.
* Added on-the-fly header updates on write.
* Fix a couple of documentation issues.
Version 1.0.0rc2 (2002-06-24)
* Release candidate 2 for the 1.0.0 series.
* Fix compile problem for Win32.
Version 1.0.0rc1 (2002-06-24)
* Release candidate 1 for the 1.0.0 series.
Version 0.0.28 (2002-04-27)
* Last offical release of 0.0.X series of the library.
Version 0.0.8 (1999-02-16)
* First offical release.

View File

@ -0,0 +1,14 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = sndfile_load.m sndfile_save.m sndfile_play.m
octconfigdir = $(exec_prefix)/share/octave/site/m
octconfig_DATA = sndfile_load.m sndfile_save.m sndfile_play.m
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: 56f1645a-3a13-4846-acc7-8b4abf2904ff

View File

@ -0,0 +1,374 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = Octave
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(octconfigdir)"
octconfigDATA_INSTALL = $(INSTALL_DATA)
DATA = $(octconfig_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
EXTRA_DIST = sndfile_load.m sndfile_save.m sndfile_play.m
octconfigdir = $(exec_prefix)/share/octave/site/m
octconfig_DATA = sndfile_load.m sndfile_save.m sndfile_play.m
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 Octave/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Octave/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
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-octconfigDATA: $(octconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(octconfigdir)" || $(mkdir_p) "$(DESTDIR)$(octconfigdir)"
@list='$(octconfig_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(octconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(octconfigdir)/$$f'"; \
$(octconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(octconfigdir)/$$f"; \
done
uninstall-octconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(octconfig_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(octconfigdir)/$$f'"; \
rm -f "$(DESTDIR)$(octconfigdir)/$$f"; \
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 $(DATA)
installdirs:
for dir in "$(DESTDIR)$(octconfigdir)"; 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 clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-octconfigDATA
install-exec-am:
install-info: install-info-am
install-man:
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 mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-octconfigDATA
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool 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-octconfigDATA \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am uninstall-info-am \
uninstall-octconfigDATA
# 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:

View File

@ -0,0 +1,59 @@
## Copyright (C) 2002 Erik de Castro Lopo
##
## 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 file. If not, write to the Free Software Foundation,
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
## -*- texinfo -*-
## @deftypefn {Function File} {} sndfile_load (@var{filename})
## Load data from the file given by @var{filename}.
## @end deftypefn
## Author: Erik de Castro Lopo <erikd@mega-nerd.com>
## Description: Load the sound data from the given file name
function [data fs] = sndfile_load (filename)
if (nargin != 1),
error ("Need an input filename") ;
endif
samplerate = -1 ;
samplingrate = -1 ;
wavedata = -1 ;
eval (sprintf ('load -f %s', filename)) ;
if (samplerate > 0),
fs = samplerate ;
elseif (samplingrate > 0),
fs = samplingrate ;
else
error ("Not able to find sample rate.") ;
endif
if (max (size (wavedata)) > 1),
data = wavedata ;
else
error ("Not able to find waveform data.") ;
endif
endfunction
# Do not edit or modify anything in this comment block.
# The arch-tag line is a file identity tag for the GNU Arch
# revision control system.
#
# arch-tag: 9d7ed7ce-41fe-4efe-8bde-f5fc6f46bb03

View File

@ -0,0 +1,66 @@
## Copyright (C) 2002 Erik de Castro Lopo
##
## 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 file. If not, write to the Free Software Foundation,
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
## -*- texinfo -*-
## @deftypefn {Function File} {} sndfile_play (@var{data, fs})
## Play @var{data} at sample rate @var{fs} using the sndfile-play
## program.
## @end deftypefn
## Author: Erik de Castro Lopo <erikd@mega-nerd.com>
## Description: Play the given data as a sound file
function sndfile_play (data, fs)
if nargin != 2,
error ("Need two input arguments: data and fs.") ;
endif
if (max (size (fs)) > 1),
error ("Second parameter fs must be a single value.") ;
endif
[nr nc] = size (data) ;
if (nr > nc),
data = data' ;
endif
samplerate = fs ;
wavedata = data ;
filename = tmpnam () ;
cmd = sprintf ("save -mat-binary %s fs data", filename) ;
eval (cmd) ;
cmd = sprintf ("sndfile-play %s", filename) ;
[output, status] = system (cmd) ;
if (status),
disp (outout) ;
endif
endfunction
# Do not edit or modify anything in this comment block.
# The arch-tag line is a file identity tag for the GNU Arch
# revision control system.
#
# arch-tag: 96fb14c8-2b5a-4b93-a576-ab83a6d9026b

View File

@ -0,0 +1,60 @@
## Copyright (C) 2002 Erik de Castro Lopo
##
## 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 file. If not, write to the Free Software Foundation,
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
## -*- texinfo -*-
## @deftypefn {Function File} {} sndfile_save (@var{filename, data, fs})
## Save the given @var{data} as audio data to the given at @var{fs}. Set
## the sample rate to @var{fs}.
## @end deftypefn
## Author: Erik de Castro Lopo <erikd@mega-nerd.com>
## Description: Save data as a sound file
function sndfile_save (filename, data, fs)
if nargin != 3,
error ("Need three input arguments: filename, data and fs.") ;
endif
if (! isstr (filename)),
error ("First parameter 'filename' is must be a string.") ;
endif
if (max (size (fs)) > 1),
error ("Second parameter 'fs' must be a single value, not an array or matrix.") ;
endif
[nr nc] = size (data) ;
if (nr > nc),
data = data' ;
endif
samplerate = fs ;
wavedata = data ;
str = sprintf ("save -mat-binary %s samplerate wavedata", filename) ;
eval (str) ;
endfunction
# Do not edit or modify anything in this comment block.
# The arch-tag line is a file identity tag for the GNU Arch
# revision control system.
#
# arch-tag: 5e44602b-940b-4927-af7c-47639769a40b

71
libs/libsndfile/README Normal file
View File

@ -0,0 +1,71 @@
This is libsndfile, 1.0.17
libsndfile is a library of C routines for reading and writing
files containing sampled audio data.
The src/ directory contains the source code for library itself.
The doc/ directory contains the libsndfile documentation.
The examples/ directory contains examples of how to write code using
libsndfile. 'wav32_aiff24' converts a WAV file containing 32 bit floating
point data into a 24 bit PCM AIFF file. 'sndfile2oct' dumps the audio
data of a file in a human readable format. 'sfconvert' is the beginnings
of a audio file format conversion utility. 'make_sine' generates a WAV
file containing one cycle of a sine wave with 4096 sample points in
32 bit floating point format. 'sfinfo' opens a sound file and prints
out information about that file.
The tests/ directory contains programs which link against libsndfile
and test its functionality.
The Win32/ directory contains files and documentation to allow libsndfile
to compile under Win32 with the Microsoft Visual C++ compiler.
The src/GSM610 directory contains code written by Jutta Degener and Carsten
Bormann. Their original code can be found at :
http://kbs.cs.tu-berlin.de/~jutta/toast.html
The src/G72x directory contains code written and released by Sun Microsystems
under a suitably free license.
Win32
-----
There are detailed instructions for building libsndfile on Win32 in the file
doc/win32.html
MacOSX
------
Building on MacOSX should be the same as building it on any other Unix.
OTHER PLATFORMS
---------------
To compile libsndfile on platforms which have a Bourne Shell compatible
shell, an ANSI C compiler and a make utility should require no more that
the following three commands :
./configure
make
make install
For platforms without the required shell, it is usually sufficient to
create an approriate config.h file in the src/ directory with correct
values for the following #defines (this would work for AmigaOS) :
#define HAVE_ENDIAN_H 0
#define GUESS_BIG_ENDIAN 1
#define GUESS_LITTLE_ENDIAN 0
#define FORCE_BROKEN_FLOAT 0
CONTACTS
--------
libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
The libsndfile home page is at :
http://www.mega-nerd.com/libsndfile/

42
libs/libsndfile/TODO Normal file
View File

@ -0,0 +1,42 @@
Here's a list of what I (erikd AT mega-nerd DOT com) think needs to be
done. The list is by no means exhaustive and people are encouraged to
email me with suggestions.
o Add pipe in/out capabilities. libsndfile should be able to read
its input from a pipe and write its output to a pipe.
o Add checks of the error state after fseek???? Use ferror ().
o Modify tests/lossy_comp_test.c to add tests for stereo files.
o Testing compilation and correctness on more platforms.
o Improve testing routines. Must test all combinations of inputs
and outputs.
o Test sf_seek function on write???
o Add more sound file formats. People should contact me with their
requirements.
o Add support for accessing sound formats with multiple audio
data sections (ie samples within tracker files, Soundfont II and
multi-sample sampler formats).
o Add an interface to allow reading and writing of sample loop points
and other info within AIFF and other file formats. This must be a
general solution.
o Improve documentation. Is HTML documentation good enough?
o Look into the possibility of optional sample rate convert on file
read.
As I am the person who knows libsndfile best, I can probably implement
any new features faster than anybody else (and you can spend your time
writing applications with libsndfile). All I need is some
documentation and some sample files. Please contact me before emailing
me documentation and sample files. I would much rather pull them off
the web than have them clogging up my email inbox.

View File

@ -0,0 +1,10 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = README-precompiled-dll.txt testprog.c
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: c28c7540-67f6-47e7-8035-0abbc6a174bc

View File

@ -0,0 +1,341 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = Win32
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
EXTRA_DIST = README-precompiled-dll.txt testprog.c
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 Win32/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Win32/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
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
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
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(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 clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
install-info: install-info-am
install-man:
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 mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool 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-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am 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:

View File

@ -0,0 +1,40 @@
Notes on Using the Pre-compiled libsndfile DLL.
===============================================
In order to use this pre-compiled DLL with Visual Studio, you will need to
generate a .LIB file from the DLL.
This can be achieved as follows:
1) In a CMD window, change to the directory containing this file and
run the command:
lib /machine:i386 /def:libsndfile-1.def
You now have two files:
libsndfile-1.dll
libsndfile-1.lib
to be used with VisualStudio.
If the lib command fails with a command saying "'lib' is not recognized as
an internal or external command, operable program or batch file", you need
to find the location of "lib.exe" and add that directory to your PATH
environment variable. Another alternative is to use the "Visual Studio 2005
Command Prompt" Start menu item:
Start ->
All Programs ->
Visual Studio 2005 ->
Visual Studio Tools ->
Visual Studio 2005 Command Prompt
If for some reason these instructions don't work for you or you are still
not able to use the libsndfile DLL with you project, please do not contact
the main author of libsndfile. Instead, join the libsndfile-users mailing
list :
http://www.mega-nerd.com/libsndfile/lists.html
and ask a question there.

View File

@ -0,0 +1,24 @@
/* Simple test program to make sure that Win32 linking to libsndfile is
** working.
*/
#include <stdio.h>
#include "sndfile.h"
int
main (void)
{ static char strbuffer [256] ;
sf_command (NULL, SFC_GET_LIB_VERSION, strbuffer, sizeof (strbuffer)) ;
puts (strbuffer) ;
return 0 ;
}
/*
** Do not edit or modify anything in this comment block.
** The following line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 31165fd8-9d91-4e5d-8b31-8efd42ef7645
*/

View File

@ -0,0 +1,569 @@
dnl By default, many hosts won't let programs access large files;
dnl one must use special compiler options to get large-file access to work.
dnl For more details about this brain damage please see:
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
dnl Written by Paul Eggert <eggert@twinsun.com>.
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],
[AC_CACHE_CHECK([for $1 value to request large file support],
ac_cv_sys_largefile_$1,
[ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
ac_cv_sys_largefile_$1=no
ifelse($1, CFLAGS,
[case "$host_os" in
# IRIX 6.2 and later require cc -n32.
changequote(, )dnl
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
changequote([, ])dnl
if test "$GCC" != yes; then
ac_cv_sys_largefile_CFLAGS=-n32
fi
ac_save_CC="$CC"
CC="$CC $ac_cv_sys_largefile_CFLAGS"
AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
CC="$ac_save_CC"
esac])
}])])
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
[case $2 in
no) ;;
?*)
case "[$]$1" in
'') $1=$2 ;;
*) $1=[$]$1' '$2 ;;
esac ;;
esac])
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
[AC_CACHE_CHECK([for $1], $2,
[$2=no
changequote(, )dnl
$4
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
case "$ac_flag" in
-D$1)
$2=1 ;;
-D$1=*)
$2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
esac
done
changequote([, ])dnl
])
if test "[$]$2" != no; then
AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
fi])
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_ENABLE(largefile,
[ --disable-largefile omit support for large files])
if test "$enable_largefile" != no; then
AC_CHECK_TOOL(GETCONF, getconf)
AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
case "$ac_flag" in
no) ;;
-D_FILE_OFFSET_BITS=*) ;;
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
-D?* | -I?*)
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
*)
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
esac
done
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
ac_cv_sys_file_offset_bits,
[Number of bits in a file offset, on hosts where this is settable.])
[case "$host_os" in
# HP-UX 10.20 and later
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
ac_cv_sys_file_offset_bits=64 ;;
esac]
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
ac_cv_sys_largefile_source,
[Define to make fseeko etc. visible, on some hosts.],
[case "$host_os" in
# HP-UX 10.20 and later
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
ac_cv_sys_largefile_source=1 ;;
esac])
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
ac_cv_sys_large_files,
[Define for large files, on AIX-style hosts.],
[case "$host_os" in
# AIX 4.2 and later
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
ac_cv_sys_large_files=1 ;;
esac])
fi
])
dnl @synopsis AC_C_FIND_ENDIAN
dnl
dnl Determine endian-ness of target processor.
dnl @version 1.1 Mar 03 2002
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
dnl
dnl Majority written from scratch to replace the standard autoconf macro
dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation
dnl of the AC_TRY_RUN macro.
dnl
dnl Permission to use, copy, modify, distribute, and sell this file for any
dnl purpose is hereby granted without fee, provided that the above copyright
dnl and this permission notice appear in all copies. No representations are
dnl made about the suitability of this software for any purpose. It is
dnl provided "as is" without express or implied warranty.
dnl Find endian-ness in the following way:
dnl 1) Look in <endian.h>.
dnl 2) If 1) fails, look in <sys/types.h> and <sys/param.h>.
dnl 3) If 1) and 2) fails and not cross compiling run a test program.
dnl 4) If 1) and 2) fails and cross compiling then guess based on target.
AC_DEFUN([AC_C_FIND_ENDIAN],
[AC_CACHE_CHECK(processor byte ordering,
ac_cv_c_byte_order,
# Initialize to unknown
ac_cv_c_byte_order=unknown
if test x$ac_cv_header_endian_h = xyes ; then
# First try <endian.h> which should set BYTE_ORDER.
[AC_TRY_LINK([
#include <endian.h>
#if BYTE_ORDER != LITTLE_ENDIAN
not big endian
#endif
], return 0 ;,
ac_cv_c_byte_order=little
)]
[AC_TRY_LINK([
#include <endian.h>
#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
], return 0 ;,
ac_cv_c_byte_order=big
)]
fi
if test $ac_cv_c_byte_order = unknown ; then
[AC_TRY_LINK([
#include <sys/types.h>
#include <sys/param.h>
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
], return 0 ;,
[AC_TRY_LINK([
#include <sys/types.h>
#include <sys/param.h>
#if BYTE_ORDER != LITTLE_ENDIAN
not big endian
#endif
], return 0 ;,
ac_cv_c_byte_order=little
)]
[AC_TRY_LINK([
#include <sys/types.h>
#include <sys/param.h>
#if BYTE_ORDER != LITTLE_ENDIAN
not big endian
#endif
], return 0 ;,
ac_cv_c_byte_order=little
)]
)]
fi
if test $ac_cv_c_byte_order = unknown ; then
if test $cross_compiling = yes ; then
# This is the last resort. Try to guess the target processor endian-ness
# by looking at the target CPU type.
[
case "$target_cpu" in
alpha* | i?86* | mipsel* | ia64*)
ac_cv_c_big_endian=0
ac_cv_c_little_endian=1
;;
m68* | mips* | powerpc* | hppa* | sparc*)
ac_cv_c_big_endian=1
ac_cv_c_little_endian=0
;;
esac
]
else
AC_TRY_RUN(
[[
int main (void)
{ /* Are we little or big endian? From Harbison&Steele. */
union
{ long l ;
char c [sizeof (long)] ;
} u ;
u.l = 1 ;
return (u.c [sizeof (long) - 1] == 1);
}
]], , ac_cv_c_byte_order=big,
ac_cv_c_byte_order=unknown
)
AC_TRY_RUN(
[[int main (void)
{ /* Are we little or big endian? From Harbison&Steele. */
union
{ long l ;
char c [sizeof (long)] ;
} u ;
u.l = 1 ;
return (u.c [0] == 1);
}]], , ac_cv_c_byte_order=little,
ac_cv_c_byte_order=unknown
)
fi
fi
)
]
if test $ac_cv_c_byte_order = big ; then
ac_cv_c_big_endian=1
ac_cv_c_little_endian=0
elif test $ac_cv_c_byte_order = little ; then
ac_cv_c_big_endian=0
ac_cv_c_little_endian=1
else
ac_cv_c_big_endian=0
ac_cv_c_little_endian=0
AC_MSG_WARN([[*****************************************************************]])
AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]])
AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]])
AC_MSG_WARN([[*** src/config.h may need to be hand editied. ]])
AC_MSG_WARN([[*****************************************************************]])
fi
)# AC_C_FIND_ENDIAN
dnl @synopsis AC_C99_FLEXIBLE_ARRAY
dnl
dnl Dose the compiler support the 1999 ISO C Standard "stuct hack".
dnl @version 1.1 Mar 15 2004
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
dnl
dnl Permission to use, copy, modify, distribute, and sell this file for any
dnl purpose is hereby granted without fee, provided that the above copyright
dnl and this permission notice appear in all copies. No representations are
dnl made about the suitability of this software for any purpose. It is
dnl provided "as is" without express or implied warranty.
AC_DEFUN([AC_C99_FLEXIBLE_ARRAY],
[AC_CACHE_CHECK(C99 struct flexible array support,
ac_cv_c99_flexible_array,
# Initialize to unknown
ac_cv_c99_flexible_array=no
AC_TRY_LINK([[
#include <stdlib.h>
typedef struct {
int k;
char buffer [] ;
} MY_STRUCT ;
]],
[ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
ac_cv_c99_flexible_array=yes,
ac_cv_c99_flexible_array=no
))]
) # AC_C99_FLEXIBLE_ARRAY
dnl @synopsis AC_C99_FUNC_LRINT
dnl
dnl Check whether C99's lrint function is available.
dnl @version 1.3 Feb 12 2002
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
dnl
dnl Permission to use, copy, modify, distribute, and sell this file for any
dnl purpose is hereby granted without fee, provided that the above copyright
dnl and this permission notice appear in all copies. No representations are
dnl made about the suitability of this software for any purpose. It is
dnl provided "as is" without express or implied warranty.
dnl
AC_DEFUN([AC_C99_FUNC_LRINT],
[AC_CACHE_CHECK(for lrint,
ac_cv_c99_lrint,
[
lrint_save_CFLAGS=$CFLAGS
CFLAGS="-lm"
AC_TRY_LINK([
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
CFLAGS=$lrint_save_CFLAGS
])
if test "$ac_cv_c99_lrint" = yes; then
AC_DEFINE(HAVE_LRINT, 1,
[Define if you have C99's lrint function.])
fi
])# AC_C99_FUNC_LRINT
dnl @synopsis AC_C99_FUNC_LRINTF
dnl
dnl Check whether C99's lrintf function is available.
dnl @version 1.3 Feb 12 2002
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
dnl
dnl Permission to use, copy, modify, distribute, and sell this file for any
dnl purpose is hereby granted without fee, provided that the above copyright
dnl and this permission notice appear in all copies. No representations are
dnl made about the suitability of this software for any purpose. It is
dnl provided "as is" without express or implied warranty.
dnl
AC_DEFUN([AC_C99_FUNC_LRINTF],
[AC_CACHE_CHECK(for lrintf,
ac_cv_c99_lrintf,
[
AC_TRY_LINK([
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
])
if test "$ac_cv_c99_lrintf" = yes; then
AC_DEFINE(HAVE_LRINTF, 1,
[Define if you have C99's lrintf function.])
fi
])# AC_C99_FUNC_LRINTF
dnl @synopsis AC_C99_FUNC_LLRINT
dnl
dnl Check whether C99's llrint function is available.
dnl @version 1.1 Sep 30 2002
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
dnl
dnl Permission to use, copy, modify, distribute, and sell this file for any
dnl purpose is hereby granted without fee, provided that the above copyright
dnl and this permission notice appear in all copies. No representations are
dnl made about the suitability of this software for any purpose. It is
dnl provided "as is" without express or implied warranty.
dnl
AC_DEFUN([AC_C99_FUNC_LLRINT],
[AC_CACHE_CHECK(for llrint,
ac_cv_c99_llrint,
[
AC_TRY_LINK([
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
#include <stdint.h>
], int64_t x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
])
if test "$ac_cv_c99_llrint" = yes; then
AC_DEFINE(HAVE_LLRINT, 1,
[Define if you have C99's llrint function.])
fi
])# AC_C99_FUNC_LLRINT
dnl @synopsis AC_C_CLIP_MODE
dnl
dnl Determine the clipping mode when converting float to int.
dnl @version 1.0 May 17 2003
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
dnl
dnl Permission to use, copy, modify, distribute, and sell this file for any
dnl purpose is hereby granted without fee, provided that the above copyright
dnl and this permission notice appear in all copies. No representations are
dnl made about the suitability of this software for any purpose. It is
dnl provided "as is" without express or implied warranty.
dnl Find the clipping mode in the following way:
dnl 1) If we are not cross compiling test it.
dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
AC_DEFUN([AC_C_CLIP_MODE],
[AC_CACHE_CHECK(processor clipping capabilities,
ac_cv_c_clip_type,
# Initialize to unknown
ac_cv_c_clip_positive=unknown
ac_cv_c_clip_negative=unknown
if test $ac_cv_c_clip_positive = unknown ; then
AC_TRY_RUN(
[[
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
int main (void)
{ double fval ;
int k, ival ;
fval = 1.0 * 0x7FFFFFFF ;
for (k = 0 ; k < 100 ; k++)
{ ival = (lrint (fval)) >> 24 ;
if (ival != 127)
return 1 ;
fval *= 1.2499999 ;
} ;
return 0 ;
}
]],
ac_cv_c_clip_positive=yes,
ac_cv_c_clip_positive=no,
ac_cv_c_clip_positive=unknown
)
AC_TRY_RUN(
[[
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
int main (void)
{ double fval ;
int k, ival ;
fval = -8.0 * 0x10000000 ;
for (k = 0 ; k < 100 ; k++)
{ ival = (lrint (fval)) >> 24 ;
if (ival != -128)
return 1 ;
fval *= 1.2499999 ;
} ;
return 0 ;
}
]],
ac_cv_c_clip_negative=yes,
ac_cv_c_clip_negative=no,
ac_cv_c_clip_negative=unknown
)
fi
if test $ac_cv_c_clip_positive = yes ; then
ac_cv_c_clip_positive=1
else
ac_cv_c_clip_positive=0
fi
if test $ac_cv_c_clip_negative = yes ; then
ac_cv_c_clip_negative=1
else
ac_cv_c_clip_negative=0
fi
[[
case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
"00")
ac_cv_c_clip_type="none"
;;
"10")
ac_cv_c_clip_type="positive"
;;
"01")
ac_cv_c_clip_type="negative"
;;
"11")
ac_cv_c_clip_type="both"
;;
esac
]]
)
]
)# AC_C_CLIP_MODE
dnl @synopsis AC_ADD_CFLAGS
dnl
dnl Add the given option to CFLAGS, if it doesn't break the compiler
AC_DEFUN([AC_ADD_CFLAGS],
[AC_MSG_CHECKING([if $CC accepts $1])
ac_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_TRY_LINK([#include <stdio.h>],
[printf("Hello, World!\n"); return 0;],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
CFLAGS="$ac_add_cflags__old_cflags")
])
ifelse(dnl
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: bc38294d-bb5c-42ad-90b9-779def5eaab7
)dnl

7377
libs/libsndfile/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

142
libs/libsndfile/compile Normal file
View File

@ -0,0 +1,142 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, 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.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

1497
libs/libsndfile/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1608
libs/libsndfile/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

33073
libs/libsndfile/configure vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,552 @@
# Copyright (C) 1999-2006 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
dnl Require autoconf version
AC_PREREQ(2.59)
AC_INIT([libsndfile],[1.0.17],[erikd@mega-nerd.com])
AC_CONFIG_SRCDIR([src/sndfile.c])
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION)
AC_CONFIG_HEADERS([src/config.h])
AC_LANG([C])
#------------------------------------------------------------------------------------
# Rules for library version information:
#
# 1. Start with version information of `0:0:0' for each libtool library.
# 2. Update the version information only immediately before a public release of
# your software. More frequent updates are unnecessary, and only guarantee
# that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update, then
# increment revision (`c:r:a' becomes `c:r+1:a').
# 4. If any interfaces have been added, removed, or changed since the last update,
# increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then increment
# age.
# 6. If any interfaces have been removed since the last public release, then set age
# to 0.
SHARED_VERSION_INFO="1:17:0"
AC_PROG_CC
AM_PROG_LIBTOOL
AC_CHECK_PROG(autogen, autogen, yes, no)
AC_PROG_INSTALL
AC_PROG_LN_S
AC_HEADER_STDC
AC_CHECK_HEADERS(endian.h)
AC_CHECK_HEADERS(byteswap.h)
AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(inttypes.h)
AC_HEADER_SYS_WAIT
AC_CHECK_DECLS(S_IRGRP)
if test x$ac_cv_have_decl_S_IRGRP = xyes ; then
AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],1,[Set to 1 if S_IRGRP is defined.])
else
AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],0)
fi
#====================================================================================
# Check for support of the struct hack.
AC_C99_FLEXIBLE_ARRAY
if test x$ac_cv_c99_flexible_array = xyes ; then
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],1, [Set to 1 if the compile supports the struct hack.])
else
AC_MSG_WARN([[*** This compiler does not support the 1999 ISO C Standard ***]])
AC_MSG_WARN([[*** feature known as the flexible array struct member. ***]])
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],0)
fi
#====================================================================================
# Couple of initializations here. Fill in real values later.
SHLIB_VERSION_ARG=""
#====================================================================================
# Finished checking, handle options.
AC_ARG_ENABLE(experimental,
AC_HELP_STRING([--enable-experimental], [enable experimental code]))
EXPERIMENTAL_CODE=0
if test x$enable_experimental = xyes ; then
EXPERIMENTAL_CODE=1
fi
AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE],${EXPERIMENTAL_CODE}, [Set to 1 to enable experimental code.])
AC_ARG_ENABLE(gcc-werror,
AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
AC_ARG_ENABLE(gcc-pipe,
AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option]))
AC_ARG_ENABLE(gcc-opt,
AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations]))
AC_ARG_ENABLE(cpu-clip,
AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
AC_ARG_ENABLE(bow-docs,
AC_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs]))
AC_ARG_ENABLE(sqlite,
AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
AC_ARG_ENABLE(flac,
AC_HELP_STRING([--disable-flac], [disable use of FLAC]))
AC_ARG_ENABLE(alsa,
AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
#====================================================================================
# Check types and their sizes.
AC_CHECK_SIZEOF(short,2)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(long,4)
AC_CHECK_SIZEOF(float,4)
AC_CHECK_SIZEOF(double,4)
AC_CHECK_SIZEOF(void*,8)
AC_CHECK_SIZEOF(size_t,4)
AC_CHECK_SIZEOF(int64_t,8)
AC_CHECK_SIZEOF(long long,8)
#====================================================================================
# Find an appropriate type for sf_count_t.
# On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value.
# Unfortunately there is more than one way of ensuring this so need to do some
# pretty rigourous testing here.
unset ac_cv_sizeof_off_t
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
case "$host_os" in
mingw*)
TYPEOF_SF_COUNT_T="__int64"
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
SIZEOF_SF_COUNT_T=8
;;
*)
if test "x$ac_cv_sizeof_off_t" = "x8" ; then
# If sizeof (off_t) is 8, no further checking is needed.
TYPEOF_SF_COUNT_T="off_t"
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
SIZEOF_SF_COUNT_T=8
else
# Check for common 64 bit file offset types.
AC_CHECK_SIZEOF(loff_t,1) # Fake default value.
AC_CHECK_SIZEOF(off64_t,1) # Fake default value.
TYPEOF_SF_COUNT_T="unknown"
if test "x$ac_cv_sizeof_loff_t" = "x8" ; then
TYPEOF_SF_COUNT_T="loff_t"
SIZEOF_SF_COUNT_T=8
elif test "x$ac_cv_sizeof_off64_t" = "x8" ; then
TYPEOF_SF_COUNT_T="off64_t"
SIZEOF_SF_COUNT_T=8
fi
# Save the old sizeof (off_t) value and then unset it to see if it
# changes when Large File Support is enabled.
pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
unset ac_cv_sizeof_off_t
AC_SYS_EXTRA_LARGEFILE
if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
ac_cv_sys_largefile_CFLAGS=""
fi
if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
ac_cv_sys_largefile_LDFLAGS=""
fi
if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
ac_cv_sys_largefile_LIBS=""
fi
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
if test "x$ac_cv_sizeof_off_t" = "x8" ; then
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
elif test "x$ac_cv_sizeof_off_t" = "x$pre_largefile_sizeof_off_t" ; then
AC_MSG_WARN([[This machine does not seem to support 64 bit file offsets.]])
TYPEOF_SF_COUNT_T="off_t"
SIZEOF_SF_COUNT_T=$ac_cv_sizeof_off_t
elif test "x$TYPEOF_SF_COUNT_T" = "xunknown" ; then
echo
echo "*** The configure process has determined that this system is capable"
echo "*** of Large File Support but has not been able to find a type which"
echo "*** is an unambiguous 64 bit file offset."
echo "*** Please contact the author to help resolve this problem."
echo
AC_MSG_ERROR([[Bad file offset type.]])
fi
fi
;;
esac
if test $SIZEOF_SF_COUNT_T = 4 ; then
SF_COUNT_MAX="0x7FFFFFFF"
fi
AC_DEFINE_UNQUOTED([TYPEOF_SF_COUNT_T],${TYPEOF_SF_COUNT_T}, [Set to long if unknown.])
AC_SUBST(TYPEOF_SF_COUNT_T)
AC_DEFINE_UNQUOTED([SIZEOF_SF_COUNT_T],${SIZEOF_SF_COUNT_T}, [Set to sizeof (long) if unknown.])
AC_SUBST(SIZEOF_SF_COUNT_T)
AC_DEFINE_UNQUOTED([SF_COUNT_MAX],${SF_COUNT_MAX}, [Set to maximum allowed value of sf_count_t type.])
AC_SUBST(SF_COUNT_MAX)
AC_CHECK_TYPES(ssize_t)
AC_CHECK_SIZEOF(ssize_t,4)
#====================================================================================
# Determine endian-ness of target processor.
AC_C_FIND_ENDIAN
AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
[Target processor is big endian.])
AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
[Target processor is little endian.])
#====================================================================================
# Check for functions.
AC_CHECK_FUNCS(malloc calloc realloc free)
AC_CHECK_FUNCS(open read write lseek pread pwrite)
AC_CHECK_FUNCS(fstat ftruncate fsync)
AC_CHECK_FUNCS(snprintf vsnprintf)
AC_CHECK_FUNCS(gmtime gmtime_r)
AC_CHECK_FUNCS(mmap getpagesize)
AC_CHECK_FUNCS(setlocale)
AC_CHECK_LIB([m],floor)
AC_CHECK_FUNCS(floor ceil fmod)
case "$host_os" in
cygwin*)
AC_MSG_WARN([[Not using built-in lrint() and lrintf() because they are broken on Cygwin.]])
;;
*)
AC_C99_FUNC_LRINT
AC_C99_FUNC_LRINTF
if test "x$ac_cv_c99_lrint" = "xno" ; then
if test "x$ac_cv_c99_lrintf" = "xno" ; then
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
fi
fi
;;
esac
#====================================================================================
# Check for libsqlite3 (only used in regtest).
ac_cv_sqlite3=no
if test x$enable_sqlite != xno ; then
PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
fi
if test x$ac_cv_sqlite3 = "xyes" ; then
HAVE_SQLITE3=1
else
HAVE_SQLITE3=0
fi
AC_DEFINE_UNQUOTED([HAVE_SQLITE3],$HAVE_SQLITE3,[Set to 1 if you have libsqlite3.])
#====================================================================================
# Determine if the processor can do clipping on float to int conversions.
if test x$enable_cpu_clip != "xno" ; then
AC_C_CLIP_MODE
else
echo "checking processor clipping capabilities... disabled"
ac_cv_c_clip_positive=0
ac_cv_c_clip_negative=0
fi
AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
[Target processor clips on positive float to int conversion.])
AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
[Target processor clips on negative float to int conversion.])
#====================================================================================
# Target OS specific stuff.
OS_SPECIFIC_CFLAGS=""
OS_SPECIFIC_LINKS=""
os_is_win32=0
os_is_macosx=0
use_windows_api=0
case "$host_os" in
darwin* | rhapsody*)
os_is_macosx=1
OS_SPECIFIC_CFLAGS="-fpascal-strings -I/Developer/Headers/FlatCarbon"
OS_SPECIFIC_LINKS="-framework CoreAudio"
;;
mingw*)
os_is_win32=1
use_windows_api=1
OS_SPECIFIC_LINKS="-lwinmm"
;;
cygwin*)
os_is_win32=1
OS_SPECIFIC_LINKS="-lwinmm"
;;
esac
AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
AC_DEFINE_UNQUOTED(OS_IS_MACOSX, ${os_is_macosx}, [Set to 1 if compiling for MacOSX])
AC_DEFINE_UNQUOTED(USE_WINDOWS_API, ${use_windows_api}, [Set to 1 to use the native windows API])
#====================================================================================
# Check for ALSA.
ALSA_LIBS=""
if test x$enable_alsa != xno ; then
AC_CHECK_HEADERS(alsa/asoundlib.h)
if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
ALSA_LIBS="-lasound"
fi
fi
#====================================================================================
# Check for FLAC
FLAC_LIBS=""
if test x$enable_flac != xno ; then
AC_CHECK_HEADERS(FLAC/all.h)
if test x$ac_cv_header_FLAC_all_h = xyes ; then
AC_CHECK_LIB(FLAC, FLAC__seekable_stream_encoder_set_tell_callback, HAVE_FLAC_1_1_1="yes")
if test "x$HAVE_FLAC_1_1_1" = xyes ; then
AC_DEFINE(HAVE_FLAC_1_1_1, [1], [Define to 1 if you have libflac 1.1.1])
fi
FLAC_LIBS="-lFLAC"
fi
fi
#====================================================================================
# Test for sanity when cross-compiling.
if test x$cross_compiling = xyes ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** We are cross-compiling, so have to assume sizeof (short) == 2 ]])
AC_MSG_WARN([[*** and sizeof (int) == 4. If this is not the case there is no ]])
AC_MSG_WARN([[*** chance of this working. Please contact the mantainer. ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test $ac_cv_sizeof_short != 2 ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** sizeof (short) != 2. ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test $ac_cv_sizeof_int != 4 ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** sizeof (int) != 4 ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test $ac_cv_sizeof_float != 4 ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** sizeof (float) != 4. ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test $ac_cv_sizeof_double != 8 ; then
AC_MSG_WARN([[******************************************************************]])
AC_MSG_WARN([[*** sizeof (double) != 8. ]])
AC_MSG_WARN([[******************************************************************]])
fi
if test x"$ac_cv_prog_autogen" = "xno" ; then
AC_MSG_WARN([[Touching files in directory tests/.]])
touch tests/*.c tests/*.h
fi
#====================================================================================
# Settings for the HTML documentation.
htmldocdir=$prefix/share/doc/libsndfile1-dev/html
if test $prefix = "NONE" ; then
htmldocdir=/usr/local/share/doc/libsndfile1-dev/html
else
htmldocdir=$prefix/share/doc/libsndfile1-dev/html
fi
if test x$enable_bow_docs = "xyes" ; then
HTML_BGCOLOUR="white"
HTML_FGCOLOUR="black"
else
HTML_BGCOLOUR="black"
HTML_FGCOLOUR="white"
fi
#====================================================================================
# Now use the information from the checking stage.
if test x$ac_cv_c_compiler_gnu = xyes ; then
AC_ADD_CFLAGS(-std=gnu99)
CFLAGS="$CFLAGS -W -Wall"
CXXFLAGS="$CXXFLAGS -W -Wall"
AC_ADD_CFLAGS(-Wdeclaration-after-statement)
AC_ADD_CFLAGS(-Wpointer-arith)
if test x$enable_gcc_werror = "xyes" ; then
CFLAGS="-Werror $CFLAGS"
CXXFLAGS="-Werror $CXXFLAGS"
fi
CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings "
# -Wundef -Wmissing-declarations -Winline -Wconversion"
CXXFLAGS="$CXXFLAGS -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo "
if test "x$enable_gcc_opt" = "xno" ; then
temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"`
CFLAGS=$temp_CFLAGS
AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
fi
# OS specific tweaks.
case "$host_os" in
darwin* | rhapsody*)
# Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
# System headers on these systems are broken.
temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall -pedantic//" | sed "s/-Wshadow//" | sed "s/-Waggregate-return//"`
CFLAGS=$temp_CFLAGS
SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(srcdir)/Symbols.darwin"
;;
linux*)
SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.linux"
;;
mingw*)
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile.def"
;;
cygwin*)
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/cygsndfile.def"
;;
*)
;;
esac
if test x$enable_gcc_pipe != "xno" ; then
CFLAGS="$CFLAGS -pipe"
fi
AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
fi
CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
if test x"$CFLAGS" = x ; then
echo "Error in configure script. CFLAGS has been screwed up."
exit
fi
AC_SUBST(htmldocdir)
AC_SUBST(HTML_BGCOLOUR)
AC_SUBST(HTML_FGCOLOUR)
AC_SUBST(SHLIB_VERSION_ARG)
AC_SUBST(SHARED_VERSION_INFO)
AC_SUBST(OS_SPECIFIC_CFLAGS)
AC_SUBST(OS_SPECIFIC_LINKS)
AC_SUBST(ALSA_LIBS)
AC_SUBST(FLAC_LIBS)
AC_SUBST(ENABLE_EXPERIMENTAL_CODE)
AC_SUBST(COMPILER_IS_GCC)
AC_SUBST(GCC_MAJOR_VERSION)
dnl The following line causes the libtool distributed with the source
dnl to be replaced if the build system has a more recent version.
AC_SUBST(LIBTOOL_DEPS)
AC_CONFIG_FILES([ \
src/sndfile.h src/Makefile src/GSM610/Makefile src/G72x/Makefile \
man/Makefile examples/Makefile tests/Makefile regtest/Makefile \
doc/Makefile doc/libsndfile.css \
Win32/Makefile Octave/Makefile \
Makefile libsndfile.spec sndfile.pc \
])
AC_OUTPUT
#====================================================================================
AC_MSG_RESULT([
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
Configuration summary :
Version : ..................... ${VERSION}
Experimental code : ........... ${enable_experimental:-no}
])
if test x$ac_cv_c_compiler_gnu = xyes ; then
echo -e " Tools :\n"
echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
echo " GCC major version : ........... ${GCC_MAJOR_VERSION}"
if test $GCC_MAJOR_VERSION -lt 3 ; then
echo -e "\n ** This compiler version allows applications to write"
echo " ** to static strings within the library."
echo " ** Compile with GCC version 3.X to avoid this problem."
fi
fi
if test $libdir = "\${exec_prefix}/lib" ; then
libdir="$prefix/lib"
fi
if test $bindir = "\${exec_prefix}/bin" ; then
bindir="$prefix/bin"
fi
AC_MSG_RESULT([[
Installation directories :
Library directory : ........... $libdir
Program directory : ........... $bindir
Pkgconfig directory : ......... $libdir/pkgconfig
HTML docs directory : ......... $htmldocdir
]])
if test x$prefix != "x/usr" ; then
echo "Compiling some other packages against libsndfile may require"
echo -e "the addition of \"$libdir/pkgconfig\" to the"
echo -e "PKG_CONFIG_PATH environment variable.\n"
fi
#====================================================================================
ifelse(dnl
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: 6391b316-6cfc-43c2-a18a-8defdc4ee359
)dnl

530
libs/libsndfile/depcomp Normal file
View File

@ -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:

View File

@ -0,0 +1,577 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
libsndfile : Frequently Asked Questions.
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<META NAME="Description" CONTENT="The libsndfile FAQ.">
<META NAME="Keywords" CONTENT="WAV AIFF AU libsndfile sound audio dsp Linux">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<H1><B>libsndfile : Frequently Asked Questions.</B></H1>
<P>
<A HREF="#Q001">Q1 : Do you plan to support XYZ codec in libsndfile?</A><BR>
<A HREF="#Q002">Q2 : In version 0 the SF_INFO struct had a pcmbitwidth field
but version 1 does not. Why?</A><BR>
<A HREF="#Q003">Q3 : Compiling is really slow on MacOSX. Why?</A><BR>
<A HREF="#Q004">Q4 : When trying to compile libsndfile on Solaris I get a "bad
substitution" error during linking. What can I do to fix this?</A><BR>
<A HREF="#Q005">Q5 : Why doesn't libsndfile do interleaving/de-interleaving?</A><BR>
<A HREF="#Q006">Q6 : What's the best format for storing temporary files?</A><BR>
<A HREF="#Q007">Q7 : On Linux/Unix/MaxOSX, what's the best way of detecting the
presence of libsndfile?</A><BR>
<A HREF="#Q008">Q8 : But I just want a simple Makefile! What do I do?</A><BR>
<A HREF="#Q009">Q9 : How about adding the ability to write/read sound files to/from
memory buffers?</A><BR>
<A HREF="#Q010">Q10 : Reading a 16 bit PCM file as normalised floats and then
writing them back changes some sample values. Why?</A><BR>
<A HREF="#Q011">Q11 : I'm having problems with u-law encoded WAV files generated by
libsndfile in Winamp. Why?</A><BR>
<A HREF="#Q012">Q12 : I'm looking at sf_read*. What are items? What are frames?</A><BR>
<A HREF="#Q013">Q13 : Why can't libsndfile open this Sound Designer II (SD2)
file?</A><BR>
<A HREF="#Q014">Q14 : I'd like to statically link libsndfile to my closed source
application. Can I buy a license so that this is possible?</A><BR>
<A HREF="#Q015">Q15 : My program is crashing during a call to a function in libsndfile.
Is this a bug in libsndfile?</A><BR>
<A HREF="#Q016">Q16 : Will you accept a fix for compiling libsndfile with compiler X?
</A><BR>
<A HREF="#Q017">Q17 : Can libsndfile read/write files from/to UNIX pipes?
</A><BR>
<HR>
<!-- ========================================================================= -->
<A NAME="Q001"></A>
<H2><BR><B>Q1 : Do you plan to support XYZ codec in libsnfile?</B></H2>
<P>
If source code for XYZ codec is available under a suitable license (LGPL, BSD,
MIT etc) then yes, I'd like to add it.
</P>
<P>
If suitable documentation is available on how to decode and enocde the format
then maybe, depending on how much work is involved.
</P>
<P>
If XYZ is some proprietary codec where no source code or documentation is
available then no.
</P>
<P>
So if you want support for XYZ codec, first find existing source code or
documentation.
If you can't find either then the answer is no.
</P>
<!-- ========================================================================= -->
<A NAME="Q002"></A>
<H2><BR><B>Q2 : In version 0 the SF_INFO struct had a pcmbitwidth field
but version 1 does not. Why?</B></H2>
<P>
This was dropped for a number of reasons:
</P>
<UL>
<LI> pcmbitwidth makes little sense on compressed or floating point formats
<LI> with the new API you really don't need to know it
</UL>
<P>
As documented
<A HREF="http://www.mega-nerd.com/libsndfile/api.html#note1">here</A>
there is now a well defined behavior which ensures that no matter what the
bit width of the source file, the scaling always does something sensible.
This makes it safe to read 8, 16, 24 and 32 bit PCM files using sf_read_short()
and always have the optimal behavior.
</P>
<!-- ========================================================================= -->
<A NAME="Q003"></A>
<H2><BR><B>Q3 : Compiling is really slow on MacOSX. Why?</B></H2>
<P>
When you configure and compile libsndfile, it uses the Bourne shell for a number
of tasks (ie configure script and libtool).
However, Apple has decided to ship their system with a really crappy Bourne shell.
</P>
<P>
To fix this I suggest that you install the GNU Bash shell, rename /bin/sh to
/bin/sh.old and make a softlink from /bin/sh to the bash shell.
Bash is designed to behave as a Bourne shell when is is called as /bin/sh.
</P>
<P>
When I did this on my iBook running MacOSX, compile times dropped from 13 minutes
to 3 minutes.
</P>
<!-- ========================================================================= -->
<A NAME="Q004"></A>
<H2><BR><B>Q4 : When trying to compile libsndfile on Solaris I get a "bad
substitution" error on linking. Why?</B></H2>
<P>
It seems that the Solaris Bourne shell disagrees with GNU libtool.
</P>
<P>
To fix this I suggest that you install the GNU Bash shell, rename /bin/sh to
/bin/sh.old and make a softlink from /bin/sh to the bash shell.
Bash is designed to behave as a Bourne shell when is is called as /bin/sh.
</P>
<!-- ========================================================================= -->
<A NAME="Q005"></A>
<H2><BR><B>Q5 : Why doesn't libsndfile do interleaving/de-interleaving?</B></H2>
<P>
This problem is bigger than it may seem at first.
</P>
<P>
For a stereo file, it is a pretty safe bet that a simple interleaving/de-interleaving
could satisfy most users.
However, for files with more than 2 channels this is unlikely to be the case.
If the user has a 4 channel file and want to play that file on a stereo output
sound card they either want the first two channels or they want some mixed combination
of the 4 channels.
</P>
<P>
When you add more channels, the combinations grow exponentially and it becomes
increasingly difficult to cover even a sensible subset of the possible combinations.
On top of that, coding any one style of interleaver/de-interleaver is trivial, while
coding one that can cover all combinations is far from trivial.
This means that this feature will not be added any time soon.
</P>
<!-- ========================================================================= -->
<A NAME="Q006"></A>
<H2><BR><B>Q6 : What's the best format for storing temporary files?</B></H2>
<P>
When you want to store temporary data there are a number of requirements;
</P>
<UL>
<LI> A simple, easy to parse header.
<LI> The format must provide the fastest possible read and write rates (ie
avoid conversions and encoding/decoding).
<LI> The file format must be reasonably common and playable by most players.
<LI> Able to store data in either endian-ness.
</UL>
<P>
The format which best meets these requirements is AU, which allows data to be
stored in any one of short, int, float and double (among others) formats.
</P>
<P>
For instance, if an application uses float data internally, its temporary files
should use a format of (SF_ENDIAN_CPU | SF_FORMAT_AU | SF_FORMAT_FLOAT) which
will store big endian float data in big endian CPUs and little endian float data
on little endian CPUs.
Reading and writing this format will not require any conversions or byte swapping
regardless of the host CPU.
</P>
<!-- ========================================================================= -->
<A NAME="Q007"></A>
<H2><BR><B>Q7 : On Linux/Unix/MaxOSX, what's the best way of detecting the presence
of libsndfile using autoconf?</B></H2>
<P>
libsndfile uses the pkg-config (man pkg-config) method of registering itself with the
host system.
The best way of detecting its presence is using something like this in configure.ac
(or configure.in):
</P>
<PRE>
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, ac_cv_sndfile=1, ac_cv_sndfile=0)
AC_DEFINE_UNQUOTED([HAVE_SNDFILE],${ac_cv_sndfile},
[Set to 1 if you have libsndfile.])
AC_SUBST(SNDFILE_CFLAGS)
AC_SUBST(SNDFILE_LIBS)
</PRE>
<P>
This will automatically set the <B>SNDFILE_CFLAGS</B> and <B>SNDFILE_LIBS</B>
variables which can be used in Makefile.am like this:
</P>
<PRE>
SNDFILE_CFLAGS = @SNDFILE_CFLAGS@
SNDFILE_LIBS = @SNDFILE_LIBS@
</PRE>
<P>
If you install libsndfile from source, you will probably need to set the
<B>PKG_CONFIG_PATH</B> environment variable as suggested at the end of the
libsndfile configure process. For instance on my system I get this:
</P>
<PRE>
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
Configuration summary :
Version : ..................... 1.0.5
Experimental code : ........... no
Tools :
Compiler is GCC : ............. yes
GCC major version : ........... 3
Installation directories :
Library directory : ........... /usr/local/lib
Program directory : ........... /usr/local/bin
Pkgconfig directory : ......... /usr/local/lib/pkgconfig
Compiling some other packages against libsndfile may require
the addition of "/usr/local/lib/pkgconfig" to the
PKG_CONFIG_PATH environment variable.
</PRE>
<!-- ========================================================================= -->
<A NAME="Q008"></A>
<H2><BR><B>Q8 : But I just want a simple Makefile! What do I do?</B></H2>
<P>
The <B>pkg-config</B> program makes finding the correct compiler flag values and
library location far easier.
During the installation of libsndfile, a file named <B>sndfile.pc</B> is installed
in the directory <B>${libdir}/pkgconfig</B> (ie if libsndfile is installed in
<B>/usr/local/lib</B>, <B>sndfile.pc</B> will be installed in
<B>/usr/local/lib/pkgconfig/</B>).
</P>
<P>
In order for pkg-config to find sndfile.pc it may be necessary to point the
environment variable <B>PKG_CONFIG_PATH</B> in the right direction.
</P>
<PRE>
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
</PRE>
<P>
Then, to compile a C file into an object file, the command would be:
</P>
<PRE>
gcc `pkg-config --cflags sndfile` -c somefile.c
</PRE>
<P>
and to link a number of objects into an executable that links against libsndfile,
the command would be:
</P>
<PRE>
gcc `pkg-config --libs sndfile` obj1.o obj2.o -o program
</PRE>
<!-- ========================================================================= -->
<A NAME="Q009"></A>
<H2><BR><B>Q9 : How about adding the ability to write/read sound files to/from
memory buffers?</B></H2>
<P>
This has been added for version 1.0.13.
</P>
<!-- ========================================================================= -->
<A NAME="Q010"></A>
<H2><BR><B>Q10 : Reading a 16 bit PCM file as normalised floats and then
writing them back changes some sample values. Why?</B></H2>
<P>
This is caused by the fact that the conversion from 16 bit short to float is
done by dividing by 32768 (0x8000 in hexadecimal) while the conversion from
float to 16 bit short is done by multiplying by 32767 (0x7FFF in hex).
So for instance, a value in a 16 bit PCM file of 20000 gets read as a floating
point number of 0.6103515625 (20000.0 / 0x8000).
Converting that back to a 16 bit short results in a value of 19999.3896484375
(0.6103515625 * 0x7FFF) which then gets rounded down to 19999.
</P>
<P>
You will notice that for this particular case, the error is 1 in 20000 or
0.005%.
Interestingly, for values of less than 16369, dividing by 0x8000 followed
by multiplying by 0x7FFF and then rounding the result, gives back the
original value.
It turns out that as long as the host operating system supplies the 1999 ISO
C Standard functions <B>lrintf</B> and <B>lrint</B> (or a replacement has
been supplied) then the maximum possible error is 1 in 16369 or about 0.006%.
</P>
<P>
Regardless of the size of the error, the reason why this is done is rather
subtle.
</P>
<P>
In a file containing 16 bit PCM samples, the values are restricted to the range
[-32768, 32767] while we want floating point values in the range [-1.0, 1.0].
The only way to do this conversion is to do a floating point division by a value
of 0x8000.
Converting the other way, the only way to ensure that floating point values in
the range [-1.0, 1.0] are within the valid range allowed by a 16 bit short is
to multiply by 0x7FFF.
</P>
<P>
Some people would say that this is a severe short-coming of libsndfile.
I would counter that anybody who is constantly converting back and forth
between 16 bit shorts and normalised floats is going to suffer other losses
in audio quality that they should also be concerned about.
</P>
<P>
The correct way to deal with this problem is to consider 16 bit short data as
a final destination format only, not as an intermediate storage format.
All intermediate data (ie which is going to be processed further) should be
stored in floating point format which is supported by all of the most common
file formats.
If floating point files are considered too large (2 times the size of a 16 bit
PCM file), it would also be possible to use 24 bit PCM as an intermediate
storage format (and which is also supported by most common file types).
</P>
<!-- ========================================================================= -->
<A NAME="Q011"></A>
<H2><BR><B>Q11 : I'm having problems with u-law encoded WAV files generated by
libsndfile in Winamp. Why?
</B></H2>
<P>
This is actually a Winamp problem.
The official Microsoft spec suggests that the 'fmt ' chunk should be 18 bytes.
Unfortunately at least one of Microsoft's own applications (Sound Recorder on
Win98 I believe) did not accept 18 bytes 'fmt ' chunks.
</P>
<P>
Michael Lee did some experimenting and found that:
</P>
<PRE>
I have checked that Windows Media Player 9, QuickTime Player 6.4,
RealOne Player 2.0 and GoldWave 5.06 can all play u-law files with
16-byte or 18-byte 'fmt ' chunk. Only Winamp (2.91) and foobar2000
are unable to play u-law files with 16-byte 'fmt ' chunk.
</PRE>
<P>
Even this is a very small sampling of all the players out there.
For that reason it is probably not a good idea to change this now because there
is the risk of breaking something that currently works.
</P>
<!-- ========================================================================= -->
<A NAME="Q012"></A>
<H2><BR><B>Q12 : I'm looking at sf_read*. What are items? What are frames?
</B></H2>
<P>
For a sound file with only one channel, a frame is the same as a item.
</P>
<P>
For multi channel sound files, a single frame contains a single item for
each channel.
</P>
<!-- ========================================================================= -->
<A NAME="Q013"></A>
<H2><BR><B>Q13 : Why can't libsndfile open this Sound Designer II (SD2) file?
</B></H2>
<P>
This is somewhat complicated.
First some background.
</P>
<P>
SD2 files are native to the Apple Macintosh platform and use features of
the Mac filesystem (file resource forks) to store the file's sample rate,
number of channels, sample width and more.
When you look at a file and its resource fork on Mac OSX it looks like
this:
</P>
<PRE>
-rw-r--r-- 1 erikd erikd 46512 Oct 18 22:57 file.sd2
-rw-r--r-- 1 erikd erikd 538 Oct 18 22:57 file.sd2/rsrc
</PRE>
<P>
Notice how the file itself looks like a directory containing a single file
named <B>rsrc</B>.
When libsndfile is compiled for MacOSX, it should open (for write and read)
SD2 file with resource forks like this without any problems.
It will also handle files with the resource fork in a separate file as
described below.
</P>
<P>
When SD2 files are moved to other platforms, the resource fork of the file
can sometimes be dropped altogether.
All that remains is the raw audio data and no information about the number
of channels, sample rate or bit width which makes it a little difficult for
libsndfile to open the file.
</P>
<P>
However, it is possible to safely move an SD2 file to a Linux or Windows
machine.
For instance, when an SD2 file is copied from inside MacOSX to a windows
shared directory or a Samba share (ie Linux), MacOSX is clever enough to
store the resource fork of the file in a separate hidden file in the
same directory like this:
</P>
<PRE>
-rw-r--r-- 1 erikd erikd 538 Oct 18 22:57 ._file.sd2
-rw-r--r-- 1 erikd erikd 46512 Oct 18 22:57 file.sd2
</PRE>
<P>
Regardless of what platform it is running on, when libsndfile is asked to
open a file named <B>"foo"</B> and it can't recognize the file type from
the data in the file, it will attempt to open the resource fork and if
that fails, it then tries to open a file named <B>"._foo"</B> to see if
the file has a valid resource fork.
This is the same regardless of whether the file is being opened for read
or write.
</P>
<P>
In short, libsndfile should open SD2 files with a valid resource fork on
all of the platforms that libsndfile supports.
If a file has lost its resource fork, the only option is the open the file
using the SF_FORMAT_RAW option and guessing its sample rate, channel count
and bit width.
</P>
<P>
Occasionally, when SD2 files are moved to other systems, the file is
<A HREF="http://www.macdisk.com/binhexen.php3">BinHexed</A>
which wraps the resource fork and the data fork together.
For these files, it would be possible to write a BinHex parser but
there is not a lot to gain considering how rare these BinHexed SD2
files are.
</P>
<!-- ========================================================================= -->
<A NAME="Q014"></A>
<H2><BR><B>Q14 : I'd like to statically link libsndfile to my closed source
application. Can I buy a license so that this is possible?
</B></H2>
<P>
Unfortunately no.
libsndfile contains code written by other people who have agreed that their
code be used under the GNU LGPL but no more.
Even if they were to agree, there would be significant difficulties in
dividing up the payments fairly.
</P>
<P>
The <B>only</B> way you can legally use libsndfile as a statically linked
library is if your application is released under the GNU GPL or LGPL.
</P>
<!-- ========================================================================= -->
<A NAME="Q015"></A>
<H2><BR><B>Q15 : My program is crashing during a call to a function in libsndfile.
Is this a bug in libsndfile?
</B></H2>
<P>
libsndfile is being used by large numbers of people all over the world
without any problems like this. That means that it is much more likely
that your code has a bug than libsndfile. However, it is still possible
that there is a bug in libsndfile.
</P>
<P>
To figure out whether it is your code or libsndfile you should do the
following:
</P>
<UL>
<LI>Make sure you are compiling your code with warnings switched on and
that you fix as many warnings as possible.
With the GNU compiler (gcc) I would recommend at least
<B>-W -Wall -Werror</B> which will force you to fix all warnings
before you can run the code.
<LI>Try using a memory debugger.
<A HREF="http://valgrind.kde.org/">Valgrind</A> on x86 Linux is excellent.
<A HREF="http://www.ibm.com/software/awdtools/purify/">Purify</A> also
has a good reputation.
<LI>If the code is clean after the above two steps and you still get
a crash in libsndfile, then send me a small snippet of code (no
more than 30-40 lines) which includes the call to sf_open() and
also shows how all variables passed to/returned from sf_open()
are defined.
</UL>
<!-- ========================================================================= -->
<A NAME="Q016"></A>
<H2><BR><B>Q16 : Will you accept a fix for compiling libsndfile with compiler X?
</B></H2>
<P>
If compiler X is a C++ compiler then no.
C and C++ are different enough to make writing code that compiles as valid C
and valid C++ too difficult.
I would rather spend my time fixing bugs and adding features.
</P>
<P>
If compiler X is a C compiler then I will do what I can as long as that does
not hamper the correctness, portability and maintainability of the existing
code.
It should be noted however that libsndfile uses features specified by the 1999
ISO C Standard.
This can make compiling libsndfile with some older compilers difficult.
</P>
<!-- ========================================================================= -->
<A NAME="Q017"></A>
<H2><BR><B>Q17 : Can libsndfile read/write files from/to UNIX pipes?
</B></H2>
<P>
Yes, libsndfile can read files from pipes.
Unfortunately, the write case is much more complicated.
</P>
<P>
File formats like AIFF and WAV have information at the start of the file (the
file header) which states the length of the file, the number of sample frames
etc.
This information must be filled in correctly when the file header is written,
but this information is not reliably known until the file is closed.
This means that libsndfile cannot write AIFF, WAV and many other file types
to a pipe.
</P>
<P>
However, there is at least one file format (AU) which is specifically designed
to be written to a pipe.
Like AIFF and WAV, AU has a header with a sample frames field, but it is
specifically allowable to set that frames field to 0x7FFFFFFF if the file
length is not known when the header is written.
The AU file format can also hold data in many of the standard formats (ie
SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_FLOAT etc) as well as allowing
data in both big and little endian format.
</P>
<P>
Sell also <A HREF="#Q006">FAQ Q6</A>.
</P>
<!-- ========================================================================= -->
<HR>
<P>
The libsndfile home page is here :
<A HREF="http://www.mega-nerd.com/libsndfile/">
http://www.mega-nerd.com/libsndfile/</A>.
<BR>
Version : 1.0.13
</P>
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: 508f827d-b9a7-4a86-8c2f-d82321df91f7
-->

View File

@ -0,0 +1,16 @@
## Process this file with automake to produce Makefile.in
htmldir = $(htmldocdir)
html_DATA = index.html libsndfile.jpg libsndfile.css api.html command.html \
bugs.html sndfile_info.html new_file_type.HOWTO pkgconfig.html \
win32.html FAQ.html lists.html embedded_files.html octave.html \
dither.html
EXTRA_DIST = $(html_DATA)
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: 2f7e97fe-5ef8-49a1-ae12-14ebab69c048

View File

@ -0,0 +1,379 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/libsndfile.css.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES = libsndfile.css
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(htmldir)"
htmlDATA_INSTALL = $(INSTALL_DATA)
DATA = $(html_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = $(htmldocdir)
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
html_DATA = index.html libsndfile.jpg libsndfile.css api.html command.html \
bugs.html sndfile_info.html new_file_type.HOWTO pkgconfig.html \
win32.html FAQ.html lists.html embedded_files.html octave.html \
dither.html
EXTRA_DIST = $(html_DATA)
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 doc/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/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
libsndfile.css: $(top_builddir)/config.status $(srcdir)/libsndfile.css.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-htmlDATA: $(html_DATA)
@$(NORMAL_INSTALL)
test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)"
@list='$(html_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(htmlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
$(htmlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
done
uninstall-htmlDATA:
@$(NORMAL_UNINSTALL)
@list='$(html_DATA)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(htmldir)/$$f'"; \
rm -f "$(DESTDIR)$(htmldir)/$$f"; \
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 $(DATA)
installdirs:
for dir in "$(DESTDIR)$(htmldir)"; 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 clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-htmlDATA
install-exec-am:
install-info: install-info-am
install-man:
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 mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-htmlDATA uninstall-info-am
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
install-htmlDATA install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am uninstall-htmlDATA 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:

View File

@ -0,0 +1,703 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
The libsndfile API.
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<META NAME="Description" CONTENT="The libsndfile API.">
<META NAME="Keywords" CONTENT="WAV AIFF AU libsndfile sound audio dsp Linux">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<BR>
<H1><B>libsndfile</B></H1>
<P>
Libsndfile is a library designed to allow the reading and writing of many
different sampled sound file formats (such as MS Windows WAV and the Apple/SGI
AIFF format) through one standard library interface.
</P>
<!-- pepper -->
<P>
During read and write operations, formats are seamlessly converted between the
format the application program has requested or supplied and the file's data
format. The application programmer can remain blissfully unaware of issues
such as file endian-ness and data format. See <A HREF="#note1">Note 1</A> and
<A HREF="#note2">Note 2</A>.
</P>
<!-- pepper -->
<P>
Every effort is made to keep these documents up-to-date, error free and
unambiguous.
However, since maintaining the documentation is the least fun part of working
on libsndfile, these docs can and do fall behind the behaviour of library.
If any errors omissions or ambiguities are found, please notify
<A HREF="m&#97;ilt&#111;:&#101;rikd&#64;z&#105;p.&#99;om.au">
Erik de Castro Lopo</a>.
</P>
<!-- pepper -->
<P>
<B> Finally, if you think there is some feature missing from libsndfile, check that
it isn't already implemented (and documented)
<A HREF="command.html">here</A>.
</B>
</P>
<H2><B>SYNOPSIS</B></H2>
<P>
The functions of libsndfile are defined as follows:
</P>
<!-- pepper -->
<PRE>
#include &lt;stdio.h&gt;
#include &lt;sndfile.h&gt;
SNDFILE* <A HREF="#open">sf_open</A> (const char *path, int mode, SF_INFO *sfinfo) ;
SNDFILE* <A HREF="#open_fd">sf_open_fd</A> (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
int <A HREF="#check">sf_format_check</A> (const SF_INFO *info) ;
sf_count_t <A HREF="#seek">sf_seek</A> (SNDFILE *sndfile, sf_count_t frames, int whence) ;
int <A HREF="#command">sf_command</A> (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
int <A HREF="#error">sf_error</A> (SNDFILE *sndfile) ;
const char* <A HREF="#error">sf_strerror</A> (SNDFILE *sndfile) ;
const char* <A HREF="#error">sf_error_number</A> (int errnum) ;
int <A HREF="#error">sf_perror</A> (SNDFILE *sndfile) ;
int <A HREF="#error">sf_error_str</A> (SNDFILE *sndfile, char* str, size_t len) ;
int <A HREF="#close">sf_close</A> (SNDFILE *sndfile) ;
void <A HREF="#write_sync">sf_write_sync</A> (SNDFILE *sndfile) ;
sf_count_t <A HREF="#read">sf_read_short</A> (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
sf_count_t <A HREF="#read">sf_read_int</A> (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
sf_count_t <A HREF="#read">sf_read_float</A> (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
sf_count_t <A HREF="#read">sf_read_double</A> (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
sf_count_t <A HREF="#readf">sf_readf_short</A> (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
sf_count_t <A HREF="#readf">sf_readf_int</A> (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
sf_count_t <A HREF="#readf">sf_readf_float</A> (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
sf_count_t <A HREF="#readf">sf_readf_double</A> (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
sf_count_t <A HREF="#write">sf_write_short</A> (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
sf_count_t <A HREF="#write">sf_write_int</A> (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
sf_count_t <A HREF="#write">sf_write_float</A> (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
sf_count_t <A HREF="#write">sf_write_double</A> (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
sf_count_t <A HREF="#writef">sf_writef_short</A> (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
sf_count_t <A HREF="#writef">sf_writef_int</A> (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
sf_count_t <A HREF="#writef">sf_writef_float</A> (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
sf_count_t <A HREF="#writef">sf_writef_double</A> (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
sf_count_t <A HREF="#raw">sf_read_raw</A> (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
sf_count_t <A HREF="#raw">sf_write_raw</A> (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
const char* <A HREF="#string">sf_get_string</A> (SNDFILE *sndfile, int str_type) ;
int <A HREF="#string">sf_set_string</A> (SNDFILE *sndfile, int str_type, const char* str) ;
</PRE>
<!-- pepper -->
<P>
SNDFILE* is an anonymous pointer to data which is private to the library.
</P>
<A NAME="open"></A>
<H2><B>File Open Function</B></H2>
<PRE>
SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ;
</PRE>
<P>
The SF_INFO structure is for passing data between the calling function and the library
when opening a file for reading or writing. It is defined in sndfile.h as follows:
</P>
<!-- pepper -->
<PRE>
typedef struct
{ sf_count_t frames ; /* Used to be called samples. */
int samplerate ;
int channels ;
int format ;
int sections ;
int seekable ;
} SF_INFO ;
</PRE>
<P>
The mode parameter for this function can be any one of the following three values:
</P>
<!-- pepper -->
<PRE>
SFM_READ - read only mode
SFM_WRITE - write only mode
SFM_RDWR - read/write mode
</PRE>
<P>
When opening a file for read, the <b>format</B> field should be set to zero before
calling sf_open().
The only exception to this is the case of RAW files where the caller has to set
the samplerate, channels and format fields to valid values.
All other fields of the structure are filled in by the library.
</P>
<!-- pepper -->
<P>
When opening a file for write, the caller must fill in structure members samplerate,
channels, and format.
</P>
<!-- pepper -->
<P>
The format field in the above SF_INFO structure is made up of the bit-wise OR of a
major format type (values between 0x10000 and 0x08000000), a minor format type
(with values less than 0x10000) and an optional endian-ness value.
The currently understood formats are listed in sndfile.h as follows and also include
bitmasks for separating major and minor file types.
Not all combinations of endian-ness and major and minor file types are valid.
</P>
<!-- pepper -->
<PRE>
enum
{ /* Major formats. */
SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian). */
SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */
SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */
SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */
SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */
SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */
SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */
SF_FORMAT_VOC = 0x080000, /* VOC files. */
SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */
SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */
SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */
SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */
SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */
SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */
SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */
SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */
SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */
SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */
SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */
SF_FORMAT_FLAC = 0x170000, /* FLAC lossless file format */
SF_FORMAT_CAF = 0x180000, /* Core Audio File format */
/* Subtypes from here on. */
SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */
SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */
SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */
SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */
SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */
SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */
SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */
SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */
SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */
SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */
SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */
SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */
SF_FORMAT_VOX_ADPCM = 0x0021, /* Oki Dialogic ADPCM encoding. */
SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */
SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */
SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */
SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */
SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */
SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */
SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */
SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */
SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */
/* Endian-ness options. */
SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */
SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */
SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */
SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */
SF_FORMAT_SUBMASK = 0x0000FFFF,
SF_FORMAT_TYPEMASK = 0x0FFF0000,
SF_FORMAT_ENDMASK = 0x30000000
} ;
</PRE>
<!-- pepper -->
<P>
Every call to sf_open() should be matched with a call to sf_close() to free up
memory allocated during the call to sf_open().
</P>
<!-- pepper -->
<P>
On success, the sf_open function returns a non NULL pointer which should be
passed as the first parameter to all subsequent libsndfile calls dealing with
that audio file.
On fail, the sf_open function returns a NULL pointer.
</P>
<A NAME="open_fd"></A>
<H3><B>File Descriptor Open</B></H3>
<PRE>
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
</PRE>
<P>
The second open function takes a file descriptor of a file that has already been
opened.
Care should be taken to ensure that the mode of the file represented by the
descriptor matches the mode argument.
This function is useful in the following circumstances:
</P>
<UL>
<LI>Opening temporary files securely (ie use the tmpfile() to return a
FILE* pointer and then using fileno() to retrieve the file descriptor
which is then passed to libsndfile).
<LI>Opening files with file names using OS specific character encodings
and then passing the file descriptor to sf_open_fd().
<LI>Opening sound files embedded within larger files.
<A HREF="embedded_files.html">More info</A>.
</UL>
<P>
Every call to sf_open_fd() should be matched with a call to sf_close() to free up
memory allocated during the call to sf_open().
</P>
<P>
When sf_close() is called, the file descriptor is only closed if the <B>close_desc</B>
parameter was TRUE when the sf_open_fd() function was called.
</P>
<P>
On success, the sf_open_fd function returns a non NULL pointer which should be
passed as the first parameter to all subsequent libsndfile calls dealing with
that audio file.
On fail, the sf_open_fd function returns a NULL pointer.
</P>
<A NAME="check"></A>
<BR><H2><B>Format Check Function</B></H2>
<PRE>
int sf_format_check (const SF_INFO *info) ;
</PRE>
<!-- pepper -->
<P>
This function allows the caller to check if a set of parameters in the SF_INFO struct
is valid before calling sf_open (SFM_WRITE).
</P>
<P>
sf_format_check returns TRUE if the parameters are valid and FALSE otherwise.
</P>
<A NAME="seek"></A>
<BR><H2><B>File Seek Functions</B></H2>
<PRE>
sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ;
</PRE>
<P>
The file seek functions work much like lseek in unistd.h with the exception that
the non-audio data is ignored and the seek only moves within the audio data section of
the file.
In addition, seeks are defined in number of (multichannel) frames.
Therefore, a seek in a stereo file from the current position forward with an offset
of 1 would skip forward by one sample of both channels.
</P>
<P>
like lseek(), the whence parameter can be any one of the following three values:
</P>
<PRE>
SEEK_SET - The offset is set to the start of the audio data plus offset (multichannel) frames.
SEEK_CUR - The offset is set to its current location plus offset (multichannel) frames.
SEEK_END - The offset is set to the end of the data plus offset (multichannel) frames.
</PRE>
<!-- pepper -->
<P>
Internally, libsndfile keeps track of the read and write locations using separate
read and write pointers.
If a file has been opened with a mode of SFM_RDWR, bitwise OR-ing the standard whence
values above with either SFM_READ or SFM_WRITE allows the read and write pointers to
be modified separately.
If the SEEK_* values are used on their own, the read and write pointers are
both modified.
</P>
<P>
Note that the frames offset can be negative and in fact should be when SEEK_END is used for the
whence parameter.
</P>
<P>
sf_seek will return the offset in (multichannel) frames from the start of the audio data
or -1 if an error occured (ie an attempt is made to seek beyond the start or end of the file).
</P>
<A NAME="command"></A>
<H2><BR><B>Command Interface</B></H2>
<PRE>
int sf_command (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
</PRE>
<P>
This function allows the caller to retrieve information from or change aspects of the
library behaviour on a per file basis. Examples include reading or writing text descriptions
to a file or changing the scaling applied to sample data during read and write.
</P>
<!-- pepper -->
<P>
The cmd parameter is a short null terminated string which specifies which command
to execute. Data is passed to and returned from the library by use of a void
pointer. The library will not read or write more than datasize bytes from the void
pointer. For some calls no data is required in which case data should be NULL and
datasize may be used for some other purpose.
</P>
<P>
The return value of sf_command () depends on the value of the cmd parameter, but it is
usually non-zero for success and zero on error.
</P>
<P>
This function is explained more fully <A HREF="command.html">here</A>.
</P>
<A NAME="error"></A>
<H2><BR><B>Error Reporting Functions</B></H2>
<PRE>
int sf_error (SNDFILE *sndfile) ;
</PRE>
<P>
This function returns the current error number for the given SNDFILE.
The error number may be one of the following:
</P>
<PRE>
enum
{ SF_ERR_NO_ERROR = 0,
SF_ERR_UNRECOGNISED_FORMAT = 1,
SF_ERR_SYSTEM = 2,
SF_ERR_MALFORMED_FILE = 3,
SF_ERR_UNSUPPORTED_ENCODING = 4
} ;
</PRE>
<!-- pepper -->
<P>
or any one of many other internal error values.
Applications should only test the return value against error values defined in
&lt;sndfile.h&gt; as the internal error values are subject to change at any
time.
For errors not in the above list, the function sf_error_number() can be used to
convert it to an error string.
</P>
<PRE>
const char* sf_strerror (SNDFILE *sndfile) ;
const char* sf_error_number (int errnum) ;
</PRE>
<P>
The error functions sf_strerror() and sf_error_number() convert the library's internal
error enumerations into text strings.
</P>
<PRE>
int sf_perror (SNDFILE *sndfile) ;
int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ;
</PRE>
<P>
The functions sf_perror() and sf_error_str() are deprecated and will be dropped
from the library at some later date.
</P>
<A NAME="close"></A>
<H2><BR><B>File Close Function</B></H2>
<PRE>
int sf_close (SNDFILE *sndfile) ;
</PRE>
<!-- pepper -->
<P>
The close function closes the file, deallocates its internal buffers and returns
0 on success or an error value otherwise.
</P>
<BR>
<A NAME="write_sync"></A>
<H2><BR><B>Write Sync Function</B></H2>
<PRE>
void sf_write_sync (SNDFILE *sndfile) ;
</PRE>
<!-- pepper -->
<P>
If the file is opened SFM_WRITE or SFM_RDWR, call the operating system's function
to force the writing of all file cache buffers to disk. If the file is opened
SFM_READ no action is taken.
</P>
<BR>
<A NAME="read"></A>
<H2><BR><B>File Read Functions (Items)</B></H2>
<PRE>
sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
</PRE>
<P>
The file read items functions fill the array pointed to by ptr with the requested
number of items. The items parameter must be an integer product of the number
of channels or an error will occur.
</P>
<!-- pepper -->
<P>
It is important to note that the data type used by the calling program and the data
format of the file do not need to be the same. For instance, it is possible to open
a 16 bit PCM encoded WAV file and read the data using sf_read_float(). The library
seamlessly converts between the two formats on-the-fly. See
<A HREF="#note1">Note 1</A>.
</P>
<!-- pepper -->
<P>
The sf_read_XXXX functions return the number of items read.
Unless the end of the file was reached during the read, the return value should
equal the number of items requested.
Attempts to read beyond the end of the file will not result in an error but will
cause the sf_read_XXXX functions to return less than the number of items requested
or 0 if already at the end of the file.
</P>
<A NAME="readf"></A>
<H2><BR><B>File Read Functions (Frames)</B></H2>
<PRE>
sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
</PRE>
<!-- pepper -->
<P>
The file read frames functions fill the array pointed to by ptr with the requested
number of frames of data. The array must be large enough to hold the product of
frames and the number of channels.
</P>
<P><B>
Care must be taken to ensure that there is enough space in the array pointed to by
ptr, to take (frames * channels) number of items (shorts, ints, floats or doubles).
</B></P>
<P>
The sf_readf_XXXX functions return the number of frames read.
Unless the end of the file was reached during the read, the return value should equal
the number of frames requested.
Attempts to read beyond the end of the file will not result in an error but will cause
the sf_readf_XXXX functions to return less than the number of frames requested or 0 if
already at the end of the file.
</P>
<A NAME="write"></A>
<H2><BR><B>File Write Functions (Items)</B></H2>
<PRE>
sf_count_t sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
sf_count_t sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
sf_count_t sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
sf_count_t sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
</PRE>
<P>
The file write items functions write the data in the array pointed to by ptr to the file.
The items parameter must be an integer product of the number of channels or an error
will occur.
</P>
<!-- pepper -->
<P>
It is important to note that the data type used by the calling program and the data
format of the file do not need to be the same. For instance, it is possible to open
a 16 bit PCM encoded WAV file and write the data using sf_write_float(). The library
seamlessly converts between the two formats on-the-fly. See
<A HREF="#note1">Note 1</A>.
</P>
<P>
The sf_write_XXXX functions return the number of items written (which should be the
same as the items parameter).
</P>
<A NAME="writef"></A>
<H2><BR><B>File Write Functions (Frames)</B></H2>
<PRE>
sf_count_t sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
sf_count_t sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
sf_count_t sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
sf_count_t sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
</PRE>
<P>
The file write frames functions write the data in the array pointed to by ptr to the file.
The array must be large enough to hold the product of frames and the number of channels.
</P>
<P>
The sf_writef_XXXX functions return the number of frames written (which should be the
same as the frames parameter).
</P>
<A NAME="raw"></A>
<H2><BR><B>Raw File Read and Write Functions</B></H2>
<!-- pepper -->
<PRE>
sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
sf_count_t sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
</PRE>
<P>
The raw read and write functions read raw audio data from the audio file (not to be
confused with reading RAW header-less PCM files). The number of bytes read or written
must always be an integer multiple of the number of channels multiplied by the number
of bytes required to represent one sample from one channel.
</P>
<!-- pepper -->
<P>
The raw read and write functions return the number of bytes read or written (which
should be the same as the bytes parameter).
</P>
<P>
<B>
Note : The result of using of both regular reads/writes and raw reads/writes on
compressed file formats other than SF_FORMAT_ALAW and SF_FORMAT_ULAW is undefined.
</B>
</P>
<A NAME="string"></A>
<H2><BR><B>Functions for Reading and Writing String Data</B></H2>
<PRE>
const char* sf_get_string (SNDFILE *sndfile, int str_type) ;
int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ;
</PRE>
<P>
These functions allow strings to be set on files opened for write and to be
retrieved from files opened for read where supported by the given file type.
The <B>str_type</B> parameter can be any one of the following string types:
</P>
<PRE>
enum
{ SF_STR_TITLE,
SF_STR_COPYRIGHT,
SF_STR_SOFTWARE,
SF_STR_ARTIST,
SF_STR_COMMENT,
SF_STR_DATE
} ;
</PRE>
<P>
The sf_get_string() function returns the specificed string if it exists and a
NULL pointer otherwise.
In addition to the string ids above, SF_STR_FIRST (== SF_STR_TITLE) and
SF_STR_LAST (always the same as the highest numbers string id) are also
available to allow iteration over all the available string ids.
</P>
<P>
The sf_set_string() function sets the string data.
It returns zero on success and non-zero on error.
The error code can be converted to a string using sf_error_number().
</P>
<P>
</P>
<HR>
<A NAME="note1"></A>
<H2><BR><B>Note 1</B></H2>
<!-- pepper -->
<P>
When converting between integer PCM formats of differing size (ie using sf_read_int()
to read a 16 bit PCM encoded WAV file) libsndfile obeys one simple rule:
</P>
<P CLASS=indent_block>
Whenever integer data is moved from one sized container to another sized container,
the most significant bit in the source container will become the most significant bit
in the destination container.
</P>
<P>
When converting between integer data and floating point data, different rules apply.
The default behaviour when reading floating point data (sf_read_float() or
sf_read_double ()) from a file with integer data is normalisation. Regardless of
whether data in the file is 8, 16, 24 or 32 bit wide, the data will be read as
floating point data in the range [-1.0, 1.0]. Similarly, data in the range [-1.0, 1.0]
will be written to an integer PCM file so that a data value of 1.0 will be the largest
allowable integer for the given bit width. This normalisation can be turned on or off
using the <A HREF="command.html">sf_command</A> interface.
</P>
<A NAME="note2"></A>
<H2><BR><B>Note 2</B></H2>
<P>
Reading a file containg floating point data (allowable with WAV, AIFF, AU and other
file formats) using integer read methods (sf_read_short() or sf_read_int()) can
produce unexpected results.
For instance the data in the file may have a maximum absolute value &lt; 1.0 which
would mean that all sample values read from the file will be zero.
In order to read these files correctly using integer read methods, it is recommended
that you use the
<A HREF="command.html">sf_command</A>
interface a command of
<A HREF="command.html#SFC_SET_SCALE_FLOAT_INT_READ">SFC_SET_SCALE_FLOAT_INT_READ</A>
and a parameter of SF_TRUE to force correct scaling.
</P>
<!-- pepper -->
<HR>
<!-- pepper -->
<P>
The libsndfile home page is
<A HREF="http://www.mega-nerd.com/libsndfile/">here</A>.
</P>
<P>
Version : 1.0.17
</P>
<!-- pepper -->
<!-- pepper -->
<!-- pepper -->
<!-- pepper -->
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: f6d3aa8f-983a-4ad3-9681-346e122d815e
-->

View File

@ -0,0 +1,84 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
Bug Reporting
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<CENTER>
<H1><B>Reporting Bugs in libsndfile</B></H1>
</CENTER>
<P>
Before even attempting to report a bug in libsndfile please make sure you have
read the
<A HREF="FAQ.html">Frequently Asked Questions</A>.
If you are having a problem writing code using libsndfile make sure you read
the
<A HREF="api.html">Application Programming Interface</A>
documentation.
</P>
<P>
That said, I am interested in finding and fixing all genuine bugs in libsndfile.
Bugs I want to fix include any of the following problems (and probably others) :
</P>
<UL>
<LI> Compilation problems on new platforms.
<LI> Errors being detected during the `make check' process.
<LI> Segmentation faults occuring inside libsndfile.
<LI> libsndfile hanging when opening a file.
<LI> Supported sound file types being incorrectly read or written.
<LI> Omissions, errors or spelling mistakes in the documentation.
</UL>
<P>
When submitting a bug report you must include :
</P>
<UL>
<LI> Your system (CPU and memory size should be enough).
<LI> The operating system you are using.
<LI> Whether you are using a package provided by your distribution or you
compiled it youself.
<LI> If you compiled it yourself, the compiler you are using. (Also make
sure to run "make check".)
<LI> A description of the problem.
<LI> Information generated by the sndfile-info program (see next paragraph).
<LI> If you are having problems with sndfile-play and ALSA on Linux, I will
need information about your kernel, ALSA version, compiler version,
whether you compiled the kernel/ALSA your self or installed from a
package etc.
</UL>
<P>
If libsndfile compiles and installs correctly but has difficulty reading a particular
file or type of file you should run the <B>sndfile-info</B> program (from the examples
directory of the libsndfile distribution) on the file. See
<A HREF="sndfile_info.html">here</A>
for an example of the use of the <B>sndfile-info</B> program.
</P>
<P>
Please do not send me a sound file which fails to open under libsndfile unless I
specifically ask you to. The above information should usually suffice for most
problems.
</P>
<P>
Once you have the above information you should email it to one of the
<A HREF="lists.html">mailing lists</a>
(posting to these lists is limited to the list subscribers).
</P>
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: 1533a2ca-489c-4190-b602-ecae1cc992e4
-->

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
libsndfile : Embedded Sound Files.
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<META NAME="Description" CONTENT="The libsndfile API.">
<META NAME="Keywords" CONTENT="WAV AIFF AU libsndfile sound audio dsp Linux">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<!-- pepper -->
<BODY>
<!-- pepper -->
<H1><B>Embedded Sound Files.</B></H1>
<P>
By using the open SNDFILE with a file descriptor function:
</P>
<!-- pepper -->
<PRE>
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
</PRE>
<!-- pepper -->
<P>
it is possible to open sound files embedded within larger files.
There are however a couple of caveats:
<P>
<!-- pepper -->
<UL>
<LI> Read/Write mode (SFM_RDWR) is not supported.
<LI> Writing of embedded files is only supported at the end of the file.
<LI> Reading of embedded files is only supported at file offsets greater
than zero.
<LI> Not all file formats are supported (currently only WAV, AIFF and AU).
</UL>
<!-- pepper -->
<P>
The test program <B>multi_file.c</B> in the <B>tests/</B> directory of the
source code tarball shows how this functionality is used to read and write
embedded files.
</P>
<!-- pepper -->
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: 25bcfcfc-231d-4c31-bded-e4184bcaa815
-->

View File

@ -0,0 +1,476 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
libsndfile
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<META NAME="Version" CONTENT="libsndfile-1.0.17">
<META NAME="Description" CONTENT="The libsndfile Home Page">
<META NAME="Keywords" CONTENT="WAV AIFF AU SVX PAF NIST W64 libsndfile sound audio dsp Linux">
<META NAME="ROBOTS" CONTENT="NOFOLLOW">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<!-- pepper -->
<CENTER>
<IMG SRC="libsndfile.jpg" HEIGHT=98 WIDTH=367 ALT="libsndfile.jpg">
</CENTER>
<!-- pepper -->
<CENTER>
<A HREF="#History">History</A> -+-
<A HREF="#Features">Features</A> -+-
<A HREF="#Similar">Similar or Related Projects</A> -+-
<A HREF="NEWS">News</A>
<BR>
<A HREF="development.html">Development</A> -+-
<A HREF="api.html">Programming Interface</A> -+-
<A HREF="bugs.html">Bug Reporting</A> -+-
<A HREF="#Download">Download</A>
<BR>
<A HREF="FAQ.html">FAQ</A> -+-
<A HREF="lists.html">Mailing Lists</A> -+-
<A HREF="ChangeLog">Change Log</A> -+-
<A HREF="#Licensing">Licensing Information</A>
</CENTER>
<BR><BR>
<P>
Libsndfile is a C library for reading and writing files containing sampled sound
(such as MS Windows WAV and the Apple/SGI AIFF format) through one standard
library interface. It is released in source code format under the
<A HREF="http://www.gnu.org/copyleft/lesser.html">Gnu Lesser General Public License</A>.
</P>
<!-- pepper -->
<P>
The library was written to compile and run on a Linux system but should compile
and run on just about any Unix (including MacOSX).
It can also be compiled and run on Win32 systems using the Microsoft compiler and
MacOS (OS9 and earlier) using the Metrowerks compiler.
There are directions for compiling libsndfile on these platforms in the Win32 and
MacOS directories of the source code distribution.
</P>
<P>
It was designed to handle both little-endian (such as WAV) and big-endian
(such as AIFF) data, and to compile and run correctly on little-endian (such as Intel
and DEC/Compaq Alpha) processor systems as well as big-endian processor systems such
as Motorola 68k, Power PC, MIPS and Sparc.
Hopefully the design of the library will also make it easy to extend for reading and
writing new sound file formats.
</P>
<!-- pepper -->
<P>
It has been compiled and tested (at one time or another) on the following systems:
</P>
<!-- pepper -->
<UL>
<LI>i586-pc-linux-gnu (Linux on PC hardware)
<LI>powerpc-unknown-linux-gnu (Linux on Apple Mac hardware)
<LI>powerpc-apple-darwin7.0 (Mac OS X 10.3)
<LI>sparc-sun-solaris2.8 (using gcc)
<LI>mips-sgi-irix5.3 (using gcc)
<LI>QNX 6.0
<LI>i386-unknown-openbsd2.9
<BR>
<LI>Win32 (Microsoft Visual C++)
</UL>
<!-- pepper -->
<P>
At the moment, each new release is being tested on i386 Linux, PowerPC Linux,
MacOSX on PowerPC and Win32.
</P>
<!-- pepper -->
<A NAME="Capabilities"></A>
<A NAME="Features"></A>
<H1><B>Features</B></H1>
<P>
libsndfile has the following main features :
</P>
<UL>
<lI> Ability to read and write a large number of file formats.
<LI> A simple, elegant and easy to use Applications Programming Interface.
<LI> Usable on Unix, Win32, MacOS and others.
<LI> On the fly format conversion, including endian-ness swapping, type conversion
and bitwidth scaling.
<LI> Optional normalisation when reading floating point data from files containing
integer data.
<LI> Ability to open files in read/write mode.
<LI> The ability to write the file header without closing the file (only on files
open for write or read/write).
<LI> Ability to query the library about all supported formats and retrieve text
strings describing each format.
</UL>
<P>
libsndfile has a comprehensive test suite so that each release is as bug free
as possible.
When new bugs are found, new tests are added to the test suite to ensure that
these bugs don't creep back into the code.
When new features are added, tests are added to the test suite to make sure that
these features continue to work correctly even when they are old features.
</P>
<P>
The following table lists the file formats and encodings that libsndfile can read
and write.
The file formats are arranged across the top and encodings along the left
edge.
</P>
<BR>
<TABLE BORDER="1" cellpadding="2">
<TR><TD>&nbsp;</TD>
<TD ALIGN="center">Micro- soft<BR>WAV</TD>
<TD ALIGN="center">SGI / Apple<BR>AIFF / AIFC</TD>
<TD ALIGN="center">Sun / DEC /<BR>NeXT<BR>AU / SND</TD>
<TD ALIGN="center">Header- less<BR>RAW</TD>
<TD ALIGN="center">Paris Audio<BR>File<BR>PAF</TD>
<TD ALIGN="center">Commo- dore<BR>Amiga<BR>IFF / SVX</TD>
<TD ALIGN="center">Sphere<BR>Nist<BR>WAV</TD>
<TD ALIGN="center">IRCAM<BR>SF</TD>
<TD ALIGN="center">Creative<BR>VOC</TD>
<TD ALIGN="center">Sound forge<BR>W64</TD>
<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.0</A><BR>MAT4</TD>
<TD ALIGN="center"><A HREF="octave.html">GNU Octave 2.1</A><BR>MAT5</TD>
<TD ALIGN="center">Portable Voice Format<BR>PVF</TD>
<TD ALIGN="center">Fasttracker 2<BR>XI</TD>
<TD ALIGN="center">HMM Tool Kit<BR>HTK</TD>
<TD ALIGN="center">Apple<BR>CAF</TD>
<!-- TD ALIGN="center">Sound<BR>Designer II<BR>SD2</TD -->
</TR>
<TR><TD>Unsigned 8 bit PCM</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>Signed 8 bit PCM</TD>
<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>R/W</TD>
</TR>
<TR><TD>Signed 16 bit PCM</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
</TR>
<TR><TD>Signed 24 bit PCM</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
</TR>
<TR><TD>Signed 32 bit PCM</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
</TR>
<TR><TD>32 bit float</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
</TR>
<TR><TD>64 bit double</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
</TR>
<TR><TD>u-law encoding</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD ALIGN="center">R/W</TD>
</TR>
<TR><TD>A-law encoding</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD ALIGN="center">R/W</TD>
</TR>
<TR><TD>IMA ADPCM</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>MS ADPCM</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>GSM 6.10</TD>
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>G721 ADPCM 32kbps</TD>
<TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>G723 ADPCM 24kbps</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>G723 ADPCM 40kbps</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>12 bit DWVW</TD>
<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>16 bit DWVW</TD>
<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>24 bit DWVW</TD>
<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>Ok Dialogic ADPCM</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>8 bit DPCM</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
<TR><TD>16 bit DPCM</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
<TD>&nbsp;</TD><TD ALIGN="center">R/W</TD><TD>&nbsp;</TD><TD>&nbsp;</TD>
</TR>
</TABLE>
<!-- pepper -->
<P>
Some of the file formats I am also interested in adding are:
</P>
<UL>
<LI> Kurzweil K2000 sampler files.
<LI> Ogg Vorbis.
<LI> Ogg Speex.
<LI> FLAC.
</UL>
<P>
I have decided that I will not be adding support for MPEG Layer 3 due to the
patent issues surrounding this file format.
</P>
<P>
Other file formats may also be added on request.
</P>
<!-- pepper -->
<A NAME="History"></A>
<H1><B>History</B></H1>
<P>
My first attempt at reading and writing WAV files was in 1990 or so under Windows
3.1.
I started using Linux in early 1995 and contributed some code to the
<A HREF="http://www.vaxxine.com/ve3wwg/gnuwave.html">wavplay</A>
program.
That contributed code would eventually mutate into this library.
As one of my interests is Digital Signal Processing (DSP) I decided that as well as
reading data from an audio file in the native format (typically 16 bit short integers)
it would also be useful to be able to have the library do the conversion to floating
point numbers for DSP applications.
It then dawned on me that whatever file format (anything from 8 bit unsigned chars,
to 32 bit floating point numbers) the library should be able to convert the data to
whatever format the library user wishes to use it in.
For example, in a sound playback program, the library caller typically wants the sound
data in 16 bit short integers to dump into a sound card even though the data in the
file may be 32 bit floating point numbers (ie Microsoft's WAVE_FORMAT_IEEE_FLOAT
format).
Another example would be someone doing speech recognition research who has recorded
some speech as a 16 bit WAV file but wants to process it as double precision floating
point numbers.
</P>
<P>
Here is the release history for libsndfile :
</P>
<UL>
<LI>Version 0.0.8 (Feb 15 1999) First official release.
<LI>Version 0.0.28 (Apr 26 2002) Final release of version 0 of libsndfile.
<LI>Version 1.0.0rc1 (Jun 24 2002) Release candidate 1 of version 1 of libsndfile.
<LI>Version 1.0.0rc6 (Aug 14 2002) MacOS 9 fixes.
<LI>Version 1.0.0 (Aug 16 2002) First 1.0.X release.
<LI>Version 1.0.1 (Sep 14 2002) Added MAT4 and MAT5 file formats.
<LI>Version 1.0.2 (Nov 24 2002) Added VOX ADPCM format.
<LI>Version 1.0.3 (Dec 09 2002) Fixes for Linux on ia64 CPUs.
<LI>Version 1.0.4 (Feb 02 2003) New file formats and functionality.
<LI>Version 1.0.5 (May 03 2003) One new file format and new functionality.
<LI>Version 1.0.6 (Feb 08 2004) Large file fix for Linux/Solaris, new functionality
and Win32 improvements.
<LI>Version 1.0.7 (Feb 24 2004) Fix build problems on MacOSX and fix ia64/MIPS etc
clip mode detction.
<LI>Version 1.0.8 (Mar 14 2004) Minor bug fixes.
<LI>Version 1.0.9 (Mar 30 2004) Add AVR format. Improve handling of some WAV files.
<LI>Version 1.0.10 (Jun 15 2004) Minor bug fixes. Fix support for Win32 MinGW compiler.
<LI>Version 1.0.11 (Nov 15 2004) Add SD2 file support, reading of loop data in WAV and AIFF.
Minor bug fixes.
<LI>Version 1.0.12 (Sep 30 2005) Add FLAC and CAF file support, virtual I/O interface.
Minor bug fixes and cleanups.
<LI>Version 1.0.13 (Jan 21 2006) Add read/write of instrument chunks. Minor bug fixes.
<LI>Version 1.0.14 (Feb 19 2006) Minor bug fixes. Start shipping windows binary/source ZIP.
<LI>Version 1.0.15 (Mar 16 2006) Minor bug fixes.
<LI>Version 1.0.16 (Apr 30 2006) Add support for RIFX. Other minor feature enhancements and
bug fixes.
<LI>Version 1.0.17 (Aug 31 2006) Add C++ wrapper sndfile.hh. Minor bug fixes and cleanups.
</UL>
<A NAME="Similar"></A>
<H1><B>Similar or Related Projects</B></H1>
<UL>
<LI><A HREF="http://home.sprynet.com/~cbagwell/sox.html">SoX</A> is a program for
converting between sound file formats.
<LI><A HREF="http://members.home.com/ve3wwg/gnuwave.html">Wavplay</A> started out
as a minimal WAV file player under Linux and has mutated into Gnuwave, a client/server
application for more general multimedia and games sound playback.
<LI><A HREF="http://www.68k.org/~michael/audiofile/">Audiofile</A> (libaudiofile) is
a library similar to libsndfile but with a different programming interface. The
author Michael Pruett has set out to clone (and fix some bugs in) the libaudiofile
library which ships with SGI's IRIX OS.
<LI><A HREF="ftp://ccrma-ftp.stanford.edu/pub/Lisp/sndlib.tar.gz">sndlib.tar.gz</A> is
another library written by Bill Schottstaedt of CCRMA.
</UL>
<A NAME="Licensing"></A>
<H1><B>Licensing</B></H1>
<P>
libsndfile is released under the terms of the GNU Lesser General Public License. You may
read the license
<A HREF="http://www.gnu.org/copyleft/lesser.html">here</A>
or read a simple explanation of the ideas behind the GPL and the LGPL
<A HREF="http://www.gnu.org/copyleft/copyleft.html">here</A>.
</P>
<P>
You can use libsndfile with
<A HREF="http://www.gnu.org/">Free Software</A>,
<A HREF="http://www.opensource.org/">Open Source</A>,
proprietary, shareware or other closed source applications as long as libsndfile
is used as a dynamically loaded library and you abide by a small number of other
conditions (read the LGPL for more info).
With applications released under the GNU GPL you can also use libsndfile statically
linked to your application.
</P>
<P>
I would like to see libsndfile used as widely as possible but I would prefer it
if you released software that uses libsndfile as
<A HREF="http://www.gnu.org/">Free Software</A>
or
<A HREF="http://www.opensource.org/">Open Source</A>.
However, if you put in a great deal of effort building a huge application
which simply uses libsndfile for file I/O, then I have no problem with you releasing
that as closed source and charging as much money as you want for it as long as you
abide by <A HREF="http://www.gnu.org/copyleft/lesser.html">the license</A>.
</P>
<A NAME="Download"></A>
<P>
What I don't like to see is things like Steve Dekorte's
<A HREF="http://www.dekorte.com/Software/OSX/SoundConverter/">SoundConverter</A>
for Mac OSX.
Mr Dekorte has grabbed a number of Free Software packages and wrapped them in a
rather amateurish, buggy GUI and released the result as shareware.
He charges US$10 for the full version when his contribution to the whole is, by
his own
<A HREF="http://groups.google.com/groups?selm=3F9B8F8B.7853300B@mega-nerd.com">
admission</A>,
less than 10%.
</P>
<H1><B>Download</B></H1>
<P>
Here is the latest version. It is available in the following formats (I am no longer
distributing RPMs).
</P>
<UL>
<LI>Source code as a .tar.gz :
<A HREF="libsndfile-1.0.17.tar.gz">libsndfile-1.0.17.tar.gz</A>
and
<A HREF="libsndfile-1.0.17.tar.gz.asc">(GPG signature)</A>.
<LI>Windows .zip file including precompiled binaries and all source code :
<A HREF="libsndfile-1_0_17.zip">libsndfile-1_0_17.zip</A>
and
<A HREF="libsndfile-1_0_17.zip.asc">(GPG signature)</A>.
</UL>
<P>
Compiling libsndfile is relatively easy. The INSTALL file in the top level directory
gives instructions on compiling and installing libsndfile on Unix-like systems
(including MacOSX). For Win32 there are instructions in the doc/ directory of the
tarball. These instructions are mirrored
<A HREF="win32.html">here</A>.
</P>
<P>
Pre-release versions of libsndfile are available
<A HREF="http://www.mega-nerd.com/tmp/">here</A>
and are announced on the
<A HREF="lists.html">libsndfile-devel</A>
mailing list.
</P>
<BR><BR>
<HR>
<P>
The latest version of this document can be found
<A HREF="http://www.mega-nerd.com/libsndfile/">here</A>.
</P>
<P>
Author :
<A HREF="m&#97;ilt&#111;:&#101;rikd&#64;&#109;eg&#97;-&#110;erd.&#99;om">
Erik de Castro Lopo</a>
</P>
<!-- pepper -->
<P>
This page has been accessed
<IMG SRC=
"/cgi-bin/Count.cgi?ft=6|frgb=55;55;55|tr=0|trgb=0;0;0|wxh=15;20|md=6|dd=B|st=1|sh=1|df=libsndfile.dat"
HEIGHT=30 WIDTH=100 ALT="counter.gif">
times.
</P>
<!-- pepper -->
<!-- pepper -->
<!-- pepper -->
<BR><BR>
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: a96adffb-3017-46e2-82a0-6d77832b14d5
-->

View File

@ -0,0 +1,81 @@
body {
background : black ;
color : white ;
font-family : arial, helvetica, sans-serif ;
}
td {
font-family : arial, helvetica, sans-serif ;
background : black ;
color : white ;
}
center {
font-family : arial, helvetica, sans-serif ;
}
p {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
.indent_block {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 10% ;
margin-right : 10% ;
}
br {
font-family : arial, helvetica, sans-serif ;
}
form {
font-family : arial, helvetica, sans-serif ;
}
ul {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 3% ;
margin-right : 6% ;
}
ol {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 3% ;
margin-right : 6% ;
}
dl {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
h1 {
font-size : xx-large ;
background : black ;
color : #5050FF ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
h2 {
font-size : x-large ;
background : black ;
color : #5050FF ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
h3 {
font-size : large ;
background : black ;
color : #5050FF ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
pre {
font-family : courier, monospace ;
font-size : medium ;
}
a:link { color : #9090FF ; }
a:visited { color : #5050FF ; }
a:active { color : #FF00FF ; }
a:hover { background-color : #202080 ; }

View File

@ -0,0 +1,81 @@
body {
background : @HTML_BGCOLOUR@ ;
color : @HTML_FGCOLOUR@ ;
font-family : arial, helvetica, sans-serif ;
}
td {
font-family : arial, helvetica, sans-serif ;
background : @HTML_BGCOLOUR@ ;
color : @HTML_FGCOLOUR@ ;
}
center {
font-family : arial, helvetica, sans-serif ;
}
p {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
.indent_block {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 10% ;
margin-right : 10% ;
}
br {
font-family : arial, helvetica, sans-serif ;
}
form {
font-family : arial, helvetica, sans-serif ;
}
ul {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 3% ;
margin-right : 6% ;
}
ol {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 3% ;
margin-right : 6% ;
}
dl {
font-family : arial, helvetica, sans-serif ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
h1 {
font-size : xx-large ;
background : @HTML_BGCOLOUR@ ;
color : #5050FF ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
h2 {
font-size : x-large ;
background : @HTML_BGCOLOUR@ ;
color : #5050FF ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
h3 {
font-size : large ;
background : @HTML_BGCOLOUR@ ;
color : #5050FF ;
text-align : left ;
margin-left : 3% ;
margin-right : 3% ;
}
pre {
font-family : courier, monospace ;
font-size : medium ;
}
a:link { color : #9090FF ; }
a:visited { color : #5050FF ; }
a:active { color : #FF00FF ; }
a:hover { background-color : #202080 ; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -0,0 +1,59 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
libsndfile Mailing Lists
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<!-- pepper -->
<H1><BR>libsndfile Mailing Lists</H1>
<!-- pepper -->
<P>
There are three mailing lists for libsndfile:
</P>
<!-- pepper -->
<UL>
<LI> <B>libsndfile-announce&#64;mega-nerd.com</B>&nbsp;&nbsp;<!-- pepper -->
<A HREF="m&#97;ilt&#111;:li&#98;sndfile-announce-request@meg&#97;-nerd.&#99;om?subject=subscribe">Subscribe</A>
<BR>
A list which will announce each new release of libsndfile.
Noone can post to this list except the author.
<BR><BR>
<LI> <B>libsndfile-devel&#64;mega-nerd.com</B>&nbsp;&nbsp;<!-- pepper -->
<A HREF="m&#97;ilt&#111;:li&#98;sndfile-devel-request@meg&#97;-nerd.&#99;om?subject=subscribe">Subscribe</A>
<BR>
A list for discussing bugs, porting issues and feature requests.
Posting is restricted to subscribers.
<BR><BR>
<LI> <B>libsndfile-users&#64;mega-nerd.com</B>&nbsp;&nbsp;<!-- pepper -->
<A HREF="m&#97;ilt&#111;:li&#98;sndfile-users-request@meg&#97;-nerd.&#99;om?subject=subscribe">Subscribe</A>
<BR>
A list for discussing the use of libsndfile in other programs.
Posting is restricted to subscribers.
<!-- pepper -->
<BR><BR>
</UL>
<!-- pepper -->
<P>
The libsndfile-devel and libsndfile-users list will automatically receive a
copy of all emails to the libsndfile-announce list.
</P>
<BR>
<!-- pepper -->
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: 71a13776-1e29-47ae-8eee-e376e73dc4db
-->

View File

@ -0,0 +1,135 @@
new_file_type.HOWTO
===================
Original : Wed May 23 19:05:07 EST 2001
Update 1 : Fri Jul 11 22:12:38 EST 2003
This document will attempt to explain as fully as possible how to add code to
libsndfile to allow the reading and writing of new file types. By new file
type I particularly mean a new header type rather than a new encoding method
for an existing file type.
This HOWTO will take the form of a step by step guide. It will assume that you
have all required tools including :
- gcc
- make (should really be the GNU version)
- autoconf
- automake
- libtool
These should all be available on the GNU ftp site: ftp://ftp.gnu.org/pub/gnu/.
To help make these steps clearer let's suppose we are adding support for the
Whacky file format whose files contain 'W','A','C' and 'K' as the first four
bytes of the file format. Lets also assume that Whacky files contain PCM encoded
data.
Step 1
------
Create a new .c file in the src/ directory of the libsndfile source tree. The
file name should be reasonable descriptive so that is is obvious that files of
the new type are handled by this file. In this particular case the file might
be named 'whacky.c'.
Step 2
------
Add your new source code file to the build process.
Edit the file src/Makefile.am and add the name of your file handler to the
FILESPECIFIC list of handlers. This list looks something like this:
FILESPECIFIC = aiff.c au.c au_g72x.c nist.c paf.c raw.c samplitude.c \
svx.c wav.c wav_float.c wav_gsm610.c wav_ima_adpcm.c \
wav_ms_adpcm.c
Then, run the script named 'reconf' in the libsndfile top level directory,
which will run autoconf and other associated tools. Finally run "./configure"
in the top level directory. You may want to use the "--disable-gcc-opt" option
to disable gcc optimisations and make debugging with gdb/ddd easier.
Step 3
------
Add a unique identifier for the new file type.
Edit src/sndfile.h.in and find the enum containing the SF_FORMAT_XXX identifiers.
Since you will be adding a major file type you should add your identifier to the
top part of the list where the values are above 0x10000 in value. The easiest
way to do this is to find the largest value in the list, add 0x10000 to it and
make that your new identifier value. The identifier should be something like
SF_FORMAT_WACK.
Step 4
------
Add code to the file type recogniser function.
Edit src/sndfile.c and find the function guess_file_type (). This function
reads the first 3 ints of the file and from that makes a guess at the file
type. In our case we would add:
if (buffer [0] == MAKE_MARKER ('W','A','C','K'))
return SF_FORMAT_WACK ;
The use of the MAKE_MARKER macro should be pretty obvious and it is defined at the
top of file should you need to have a look at it.
Step 5
------
Add a call to your open read function from sf_open_read ().
Edit src/sndfile.c and find the switch statement in sf_open_read (). It starts
like this:
switch (filetype)
{ case SF_FORMAT_WAV :
sf_errno = wav_open_read (psf) ;
break ;
case SF_FORMAT_AIFF :
sf_errno = aiff_open_read (psf) ;
break ;
Towards the bottom of this switch statement your should add one for the new file
type. Something like:
case SF_FORMAT_WACK :
sf_errno = whacky_open_read (psf) ;
break ;
Setp 6
------
Add prototypes for new open read and open write functions.
Edit src/common.h, go to the bottom of the file and add something like
int whacky_open (SF_PRIVATE *psf) ;
Step 7
------
Implement your open read function. The best way to do this is by coding
something much like one of the other file formats. The file src/au.c might be
a good place to start.
In src/whacky.c you should now implement the function whacky_open_read() which
was prototyped in src/common.h. This function should return 0 on success and
a negative number on error.
Error values are defined in src/common.h in a enum which starts at SFE_NO_ERROR.
When adding a new error value, you also need to add an error string to the
SndfileErrors array in src/sndfile.c.
To parse the header of your new file type you should avoid using standard read/
write/seek functions (and the fread/fwrite/fseek etc) and instead use
psf_binheader_readf () which is implemented and documented in src/common.h.
During the parsing process, you should also print logging information to
libsndfile's internal log buffer using the psf_log_printf() function.
At the end of the open read process, you should have set a number of fields in the
SF_PRIVATE structure pointed to by psf.
*** THIS FILE IS INCOMPLETE ***

View File

@ -0,0 +1,125 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
libsndfile and GNU Octave
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<BR>
<H1><B>libsndfile and GNU Octave</B></H1>
<P>
<A HREF="http://www.octave.org/">GNU Octave</A> is a high-level interactive
language for numerical computations.
There are currently two development streams, a stable 2.0.X series and a
development 2.1.X series.
Octave reads and writes data in binary formats that were originally developed
for
<A HREF="http://www.mathworks.com/">MATLAB</A>.
Version 2.0.X of Octave uses binary data files compatible with MATLAB
version 4.2 while Octave 2.1.X uses binary data files compatible
with MATLAB version 5.0 as well as being able to read the older MATLAB 4.2
format.
</P>
<P>
From version 1.0.1 of libsndfile onwards, libsndfile has the ability of reading
and writing a small subset of the binary data files used by both versions
of GNU Octave.
This gives people using GNU Octave for audio based work an easy method of
moving audio data between GNU Octave and other programs which use libsndfile.
</P>
<P>
For instance it is now possible to do the following:
</P>
<UL>
<LI> Load a WAV file into a sound file editor such as
<A HREF="http://www.metadecks.org/software/sweep/">Sweep</A>.
<LI> Save it as a MAT4 file.
<LI> Load the data into Octave for manipulation.
<LI> Save the modified data.
<LI> Reload it in Sweep.
</UL>
<P>
Another example would be using the MAT4 or MAT5 file formats as a format which
can be easily loaded into Octave for viewing/analyzing as well as a format
which can be played with command line players such as the one included with
libsndfile.
</P>
<H2><B>Details</B></H2>
<P>
Octave, like most programming languages, uses variables to store data, and
Octave variables can contain both arrays and matrices.
It is also able to store one or more of these variables in a file.
When reading Octave files, libsndfile expects a file to contain two
variables and their associated data.
The first variable should contain a variable holding the file sample rate
while the second variable contains the audio data.
</P>
<P>
For example, to generate a sine wave and store it as a binary file which
is compatible with libsndfile, do the following:
</P>
<PRE>
octave:1 > samplerate = 44100 ;
octave:2 > wavedata = sin ((0:1023)*2*pi/1024) ;
octave:3 > save sine.mat samplerate wavedata
</PRE>
<P>
The process of reading and writing files compatible with libsndfile can be
made easier by use of two Octave script files :
</P>
<PRE>
octave:4 > [data fs] = sndfile_load ("sine.mat") ;
octave:5 > sndfile_save ("sine2.mat", data, fs) ;
</PRE>
<P>
In addition, libsndfile contains a command line program which which is able
to play the correct types of Octave files.
Using this command line player <B>sndfile-play</B> and a third Octave script
file allows Octave data to be played from within Octave on any of the platforms
which <B>sndfile-play</B> supports (at the moment: Linux, MacOSX, Solaris and
Win32).
</P>
<PRE>
octave:6 > sndfile_play (data, fs) ;
</PRE>
<P>
These three Octave scripts are installed automatically in Octave's site
script directory when libsndfile is installed (except on Win32) ie when
libsndfile is being installed into /usr/local, the Octave scripts will
be installed in /usr/local/share/octave/site/m/.
</P>
<P>
There are some other Octave scripts for audio to be found
<A HREF="http://octave.sourceforge.net/index/audio.html">here</A>.
</P>
<BR>
<!-- ========================================================================= -->
<HR>
<P>
The libsndfile home page is here :
<A HREF="http://www.mega-nerd.com/libsndfile/">
http://www.mega-nerd.com/libsndfile/</A>.
</P>
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: 6e99f38b-e2ad-4fdd-bc0f-94bf0c66d243
-->

View File

@ -0,0 +1,78 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
libsndfile : pkg-config
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<BR>
<H1>libsndfile and pkg-config</H1>
<P>
From version 1.0.0 libsndfile has had the ability to read and write files of
greater than 2 Gig in size on most OSes even if sizeof (long) == 4.
OSes which support this feature include Linux (2.4 kernel, glibc6) on x86, PPC and
probably others, Win32, MacOSX, *BSD, Solaris and probably others.
OSes on 64 bit processors where the default compile environment is LP64 (longs and
pointers are 64 bit ie Linux on DEC/Compaq/HP Alpha processors) automatically
support large file access.
</P>
<P>
Other OSes including Linux on 32 bit processors, 32 bit Solaris and others require
special compiler flags to add large file support.
This applies to both the compilation of the library itself and the compilation of
programs which link to the library.
</P>
<P>
Note : People using Win32, MacOS (both OSX and pre-OSX) or *BSD can disregard the
rest of this document as it does not apply to either of these OSes.
</P>
<P>
The <B>pkg-config</B> program makes finding the correct compiler flag values and
library location far easier.
During the installation of libsndfile, a file named <B>sndfile.pc</B> is installed
in the directory <B>${libdir}/pkgconfig</B> (ie if libsndfile is installed in
<B>/usr/local/lib</B>, <B>sndfile.pc</B> will be installed in
<B>/usr/local/lib/pkgconfig/</B>).
</P>
<P>
In order for pkg-config to find sndfile.pc it may be necessary to point the
environment variable <B>PKG_CONFIG_PATH</B> in the right direction.
</P>
<PRE>
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
</PRE>
<P>
Then, to compile a C file into an object file, the command would be:
</P>
<PRE>
gcc `pkg-config --cflags sndfile` -c somefile.c
</PRE>
<P>
and to link a number of objects into an executable that links against libsndfile,
the command would be:
</P>
<PRE>
gcc `pkg-config --libs sndfile` obj1.o obj2.o -o program
</PRE>
<P>
Obviously all this can be rolled into a Makefile for easier maintenance.
</P>
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: 3c1ed1be-9875-47f9-90f3-015da975d622
-->

View File

@ -0,0 +1,60 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
sndfile-info
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<P>
Here is an example of the output from the <B>sndfile-info</B> program distributed with
libsndfile.
</P>
<P>
This file was opened and parsed correctly but had been truncated so that the values
in the <B>FORM</B> and <B>SSND</B> chunks were incorrect.
</P>
<PRE>
<B>erikd@hendrix ></B> examples/sndfile-info truncated.aiff
truncated.aiff
size : 200000
FORM : 307474 (should be 199992)
AIFF
COMM : 18
Sample Rate : 16000
Samples : 76857
Channels : 2
Sample Size : 16
SSND : 307436 (should be 199946)
Offset : 0
Block Size : 0
--------------------------------
Sample Rate : 16000
Frames : 76857
Channels : 2
Bit Width : 16
Format : 0x00020001
Sections : 1
Seekable : TRUE
Signal Max : 32766
</PRE>
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: a7ae18b0-bf27-4c50-b8b2-e209d0cd36c5
-->

View File

@ -0,0 +1,141 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
Building libsndfile on Win32
</TITLE>
<META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
<LINK REL=StyleSheet HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
</HEAD>
<BODY>
<!-- pepper -->
<H1><BR>Building libsndfile on Win32</H1>
<P><B>
Note : For pre-compiled binaries for windows, see the main web page.
</B></P>
<P>
There are currently two ways of building libsndfile under Win32:
</P>
<UL>
<LI> Using the free <A HREF="#MinGW">MinGW</A> tools.
<LI> Using Cygwin (this is the full Cygwin without the -mno-cygwin option).
</UL>
<P><B>
Building libsndfile using the microsoft compiler does not currently work.
Microsoft's compiler is a C++ compiler and does not compile a number of ISO
C99 Standard constructs.
If you insist on compiling libsndfile with the microsoft compiler you are
on your own.
</B></P>
<P><B>
However, even though the libsndfile source code cannot be compiled with
the microsoft compiler, the pre-compiled windows DLL distributed on the
main web page can be used with C++ projects compiled with the microsoft
compiler.
</B></P>
<P>
The free MinGW tools are the preferred option because they are a free (as in
beer and speech), easily obtainable and much closer to the Linux/GCC
environment on which libsndfile is developed.
</P>
<A NAME="MinGW"></A>
<H2><BR>Building libsndfile using MinGW.</H2>
<P>
The MinGW tools are available from <A HREF="http://www.mingw.org/">
http://www.mingw.org/</A>.
The files you will need will be named something like:
</P>
<UL>
<LI> msysDTK-1.0.1.exe
<LI> MSYS-1.0.10.exe
<LI> gcc-core-3.4.2-20040916-1.tar.gz
<LI> gcc-g++-3.4.2-20040916-1.tar.gz
<LI> binutils-2.15.91-20040901-1.tar.gz
<LI> mingw-runtime-3.9.tar.gz
<LI> w32api-3.6.tar.gz
<LI> mingw-utils-0.3.tar.gz
</UL>
<P>
They should be installed using the directions on the MinGW site.
I know the instructions aren't great, but I don't have the time or expertise
to write better ones.
</P>
<P>
Once you have the tools installed you will get an icon named <B>MSYS</B> on
your desktop.
Clicking on that icon will bring up something that looks a little like an
xterm.
</P>
<P>
Assuming that you have downloaded the <B>.tar.gz</B> file into the
<B>C:\temp\</B> directory you should now be able to execute the following
commands:
</P>
<PRE>
tar zxf /c/temp/libsndfile.X.Y.Z.tar.gz
cd libsndfile-X.Y.Z
./configure
make
make check
</PRE>
<P>
If there is a failure during compiling or the "make check" stage, you should
check that you are using the current stable version of the MinGW tools, and
the latest version of libsndfile before sending the author a bug report.
</P>
<P>
Once this is done, anyone interested in using libsndfile in other projects
will be interested in the following files:
</P>
<UL>
<LI> libsndfile.dll
<LI> libsndfile.lib
<LI> libsndfile.def
<LI> src/sndfile.h
<LI> doc/*.html
</UL>
<!--===========================================================================-->
<!-- pepper -->
<H2><BR>Compile Problems</H2>
<!-- pepper -->
<P>
Compile problems using the above method of building the libsndfile DLL on Win32 should
be emailed to
<A HREF="m&#97;ilt&#111;:&#101;rikd&#64;&#109;eg&#97;-&#110;erd.&#99;om">
Erik de Castro Lopo</a>.
</P>
<!-- pepper -->
<P>
If you are using some other method to compile the libsndfile DLL you are on your own.
</P>
<BR>
<!-- pepper -->
<!-- pepper -->
<!-- pepper -->
<!-- pepper -->
</BODY>
</HTML>
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: b32ddb11-eb51-425f-9d39-b8b66284f129
-->

View File

@ -0,0 +1,46 @@
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert
noinst_PROGRAMS = make_sine sfprocess list_formats cooledit-fixer generate
# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
# compiler.
EXTRA_DIST = sndfile-play-beos.cpp
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
SNDFILEDIR =../src
INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
sndfile_info_SOURCES = sndfile-info.c
sndfile_info_LDADD = $(SNDFILEDIR)/libsndfile.la
sndfile_play_SOURCES = sndfile-play.c
sndfile_play_LDADD = $(SNDFILEDIR)/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
sndfile_convert_SOURCES = sndfile-convert.c
sndfile_convert_LDADD = $(SNDFILEDIR)/libsndfile.la
make_sine_SOURCES = make_sine.c
make_sine_LDADD = $(SNDFILEDIR)/libsndfile.la
sfprocess_SOURCES = sfprocess.c
sfprocess_LDADD = $(SNDFILEDIR)/libsndfile.la
list_formats_SOURCES = list_formats.c
list_formats_LDADD = $(SNDFILEDIR)/libsndfile.la
cooledit_fixer_SOURCES = cooledit-fixer.c
cooledit_fixer_LDADD = $(SNDFILEDIR)/libsndfile.la
generate_SOURCES = generate.c
generate_LDADD = $(SNDFILEDIR)/libsndfile.la
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: faeb8674-e417-4162-9ac9-05f2b8369b57

View File

@ -0,0 +1,565 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
bin_PROGRAMS = sndfile-info$(EXEEXT) sndfile-play$(EXEEXT) \
sndfile-convert$(EXEEXT)
noinst_PROGRAMS = make_sine$(EXEEXT) sfprocess$(EXEEXT) \
list_formats$(EXEEXT) cooledit-fixer$(EXEEXT) \
generate$(EXEEXT)
subdir = examples
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am_cooledit_fixer_OBJECTS = cooledit-fixer.$(OBJEXT)
cooledit_fixer_OBJECTS = $(am_cooledit_fixer_OBJECTS)
cooledit_fixer_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la
am_generate_OBJECTS = generate.$(OBJEXT)
generate_OBJECTS = $(am_generate_OBJECTS)
generate_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la
am_list_formats_OBJECTS = list_formats.$(OBJEXT)
list_formats_OBJECTS = $(am_list_formats_OBJECTS)
list_formats_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la
am_make_sine_OBJECTS = make_sine.$(OBJEXT)
make_sine_OBJECTS = $(am_make_sine_OBJECTS)
make_sine_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la
am_sfprocess_OBJECTS = sfprocess.$(OBJEXT)
sfprocess_OBJECTS = $(am_sfprocess_OBJECTS)
sfprocess_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la
am_sndfile_convert_OBJECTS = sndfile-convert.$(OBJEXT)
sndfile_convert_OBJECTS = $(am_sndfile_convert_OBJECTS)
sndfile_convert_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la
am_sndfile_info_OBJECTS = sndfile-info.$(OBJEXT)
sndfile_info_OBJECTS = $(am_sndfile_info_OBJECTS)
sndfile_info_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la
am_sndfile_play_OBJECTS = sndfile-play.$(OBJEXT)
sndfile_play_OBJECTS = $(am_sndfile_play_OBJECTS)
am__DEPENDENCIES_1 =
sndfile_play_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(cooledit_fixer_SOURCES) $(generate_SOURCES) \
$(list_formats_SOURCES) $(make_sine_SOURCES) \
$(sfprocess_SOURCES) $(sndfile_convert_SOURCES) \
$(sndfile_info_SOURCES) $(sndfile_play_SOURCES)
DIST_SOURCES = $(cooledit_fixer_SOURCES) $(generate_SOURCES) \
$(list_formats_SOURCES) $(make_sine_SOURCES) \
$(sfprocess_SOURCES) $(sndfile_convert_SOURCES) \
$(sndfile_info_SOURCES) $(sndfile_play_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
# compiler.
EXTRA_DIST = sndfile-play-beos.cpp
SNDFILEDIR = ../src
INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
sndfile_info_SOURCES = sndfile-info.c
sndfile_info_LDADD = $(SNDFILEDIR)/libsndfile.la
sndfile_play_SOURCES = sndfile-play.c
sndfile_play_LDADD = $(SNDFILEDIR)/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS)
sndfile_convert_SOURCES = sndfile-convert.c
sndfile_convert_LDADD = $(SNDFILEDIR)/libsndfile.la
make_sine_SOURCES = make_sine.c
make_sine_LDADD = $(SNDFILEDIR)/libsndfile.la
sfprocess_SOURCES = sfprocess.c
sfprocess_LDADD = $(SNDFILEDIR)/libsndfile.la
list_formats_SOURCES = list_formats.c
list_formats_LDADD = $(SNDFILEDIR)/libsndfile.la
cooledit_fixer_SOURCES = cooledit-fixer.c
cooledit_fixer_LDADD = $(SNDFILEDIR)/libsndfile.la
generate_SOURCES = generate.c
generate_LDADD = $(SNDFILEDIR)/libsndfile.la
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu examples/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 \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(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:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
cooledit-fixer$(EXEEXT): $(cooledit_fixer_OBJECTS) $(cooledit_fixer_DEPENDENCIES)
@rm -f cooledit-fixer$(EXEEXT)
$(LINK) $(cooledit_fixer_LDFLAGS) $(cooledit_fixer_OBJECTS) $(cooledit_fixer_LDADD) $(LIBS)
generate$(EXEEXT): $(generate_OBJECTS) $(generate_DEPENDENCIES)
@rm -f generate$(EXEEXT)
$(LINK) $(generate_LDFLAGS) $(generate_OBJECTS) $(generate_LDADD) $(LIBS)
list_formats$(EXEEXT): $(list_formats_OBJECTS) $(list_formats_DEPENDENCIES)
@rm -f list_formats$(EXEEXT)
$(LINK) $(list_formats_LDFLAGS) $(list_formats_OBJECTS) $(list_formats_LDADD) $(LIBS)
make_sine$(EXEEXT): $(make_sine_OBJECTS) $(make_sine_DEPENDENCIES)
@rm -f make_sine$(EXEEXT)
$(LINK) $(make_sine_LDFLAGS) $(make_sine_OBJECTS) $(make_sine_LDADD) $(LIBS)
sfprocess$(EXEEXT): $(sfprocess_OBJECTS) $(sfprocess_DEPENDENCIES)
@rm -f sfprocess$(EXEEXT)
$(LINK) $(sfprocess_LDFLAGS) $(sfprocess_OBJECTS) $(sfprocess_LDADD) $(LIBS)
sndfile-convert$(EXEEXT): $(sndfile_convert_OBJECTS) $(sndfile_convert_DEPENDENCIES)
@rm -f sndfile-convert$(EXEEXT)
$(LINK) $(sndfile_convert_LDFLAGS) $(sndfile_convert_OBJECTS) $(sndfile_convert_LDADD) $(LIBS)
sndfile-info$(EXEEXT): $(sndfile_info_OBJECTS) $(sndfile_info_DEPENDENCIES)
@rm -f sndfile-info$(EXEEXT)
$(LINK) $(sndfile_info_LDFLAGS) $(sndfile_info_OBJECTS) $(sndfile_info_LDADD) $(LIBS)
sndfile-play$(EXEEXT): $(sndfile_play_OBJECTS) $(sndfile_play_DEPENDENCIES)
@rm -f sndfile-play$(EXEEXT)
$(LINK) $(sndfile_play_LDFLAGS) $(sndfile_play_OBJECTS) $(sndfile_play_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cooledit-fixer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list_formats.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/make_sine.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfprocess.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-convert.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-play.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) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
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 clean-libtool \
clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool 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 \
mostlyclean-libtool
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 clean-libtool clean-noinstPROGRAMS ctags \
distclean distclean-compile distclean-generic \
distclean-libtool 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 mostlyclean-libtool 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:

View File

@ -0,0 +1,231 @@
/*
** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/stat.h>
#include <sndfile.h>
#define BUFFER_LEN 1024
static void usage_exit (char *progname) ;
static int is_data_really_float (SNDFILE *sndfile) ;
static void fix_file (char *filename) ;
static off_t file_size (char *filename) ;
static union
{ int i [BUFFER_LEN] ;
float f [BUFFER_LEN] ;
} buffer ;
int
main (int argc, char *argv [])
{ SNDFILE *sndfile ;
SF_INFO sfinfo ;
int k, data_is_float, converted = 0 ;
puts ("\nCooledit Fixer.\n---------------") ;
if (argc < 2)
usage_exit (argv [0]) ;
for (k = 1 ; k < argc ; k++)
{ if ((sndfile = sf_open (argv [k], SFM_READ, &sfinfo)) == NULL)
{ /*-printf ("Failed to open : %s\n", argv [k]) ;-*/
continue ;
} ;
if (sfinfo.format != (SF_FORMAT_WAV | SF_FORMAT_PCM_32))
{ /*-printf ("%-50s : not a 32 bit PCM WAV file.\n", argv [k]) ;-*/
sf_close (sndfile) ;
continue ;
} ;
data_is_float = is_data_really_float (sndfile) ;
sf_close (sndfile) ;
if (data_is_float == SF_FALSE)
{ /*-printf ("%-50s : not a Cooledit abomination.\n", argv [k]) ;-*/
continue ;
} ;
fix_file (argv [k]) ;
converted ++ ;
} ;
if (converted == 0)
puts ("\nNo files converted.") ;
puts ("") ;
return 0 ;
} /* main */
static void
usage_exit (char *progname)
{ char *cptr ;
if ((cptr = strrchr (progname, '/')))
progname = cptr + 1 ;
if ((cptr = strrchr (progname, '\\')))
progname = cptr + 1 ;
printf ("\n Usage : %s <filename>\n", progname) ;
puts ("\n"
"Fix broken files created by Syntrillium's Cooledit. These files are \n"
"marked as containing PCM data but actually contain floating point \n"
"data. Only the broken files created by Cooledit are processed. All \n"
"other files remain untouched.\n"
"\n"
"More than one file may be included on the command line. \n"
) ;
exit (1) ;
} /* usage_exit */
static int
is_data_really_float (SNDFILE *sndfile)
{ int k, readcount ;
while ((readcount = sf_read_int (sndfile, buffer.i, BUFFER_LEN)) > 0)
{ for (k = 0 ; k < readcount ; k++)
{ if (buffer.i [k] == 0)
continue ;
if (fabs (buffer.f [k]) > 32768.0)
return SF_FALSE ;
} ;
} ;
return SF_TRUE ;
} /* is_data_really_float */
static void
fix_file (char *filename)
{ static char newfilename [512] ;
SNDFILE *infile, *outfile ;
SF_INFO sfinfo ;
int readcount, k ;
float normfactor ;
char *cptr ;
printf ("\nFixing : %s\n", filename) ;
if ((infile = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Not able to open input file %s\n", filename) ;
exit (1) ;
} ;
if (strlen (filename) >= sizeof (newfilename) - 1)
{ puts ("Error : Path name too long.\n") ;
exit (1) ;
} ;
strncpy (newfilename, filename, sizeof (newfilename)) ;
newfilename [sizeof (newfilename) - 1] = 0 ;
if ((cptr = strrchr (newfilename, '/')) == NULL)
cptr = strrchr (newfilename, '\\') ;
if (cptr)
{ cptr [1] = 0 ;
strncat (newfilename, "fixed.wav", sizeof (newfilename) - strlen (newfilename) - 1) ;
}
else
strncpy (newfilename, "fixed.wav", sizeof (newfilename) - 1) ;
newfilename [sizeof (newfilename) - 1] = 0 ;
printf (" Output : %s\n", newfilename) ;
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_FLOAT ;
if ((outfile = sf_open (newfilename, SFM_WRITE, &sfinfo)) == NULL)
{ printf ("Not able to output open file %s\n", filename) ;
exit (1) ;
} ;
/* Find the file peak. sf-command (SFC_CALC_SIGNAL_MAX) cannot be used. */
normfactor = 0.0 ;
while ((readcount = sf_read_int (infile, buffer.i, BUFFER_LEN)) > 0)
{ for (k = 0 ; k < readcount ; k++)
if (fabs (buffer.f [k]) > normfactor)
normfactor = fabs (buffer.f [k]) ;
} ;
printf (" Peak : %g\n", normfactor) ;
normfactor = 1.0 / normfactor ;
sf_seek (infile, 0, SEEK_SET) ;
while ((readcount = sf_read_int (infile, buffer.i, BUFFER_LEN)) > 0)
{ for (k = 0 ; k < readcount ; k++)
buffer.f [k] *= normfactor ;
sf_write_float (outfile, buffer.f, readcount) ;
} ;
sf_close (infile) ;
sf_close (outfile) ;
if (abs (file_size (filename) - file_size (newfilename)) > 50)
{ puts ("Error : file size mismatch.\n") ;
exit (1) ;
} ;
printf (" Renaming : %s\n", filename) ;
if (remove (filename) != 0)
{ perror ("rename") ;
exit (1) ;
} ;
if (rename (newfilename, filename) != 0)
{ perror ("rename") ;
exit (1) ;
} ;
return ;
} /* fix_file */
static off_t
file_size (char *filename)
{ struct stat buf ;
if (stat (filename, &buf) != 0)
{ perror ("stat") ;
exit (1) ;
} ;
return buf.st_size ;
} /* file_size */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 5475655e-3898-40ff-969b-c8ab2351b0e4
*/

View File

@ -0,0 +1,125 @@
/*
** Copyright (C) 2002-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "sfconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sndfile.h>
#define BUFFER_LEN 4096
static void encode_file (const char *infilename, const char *outfilename, int filetype) ;
int
main (int argc, char **argv)
{
if (argc != 2)
{ puts ("\nEncode a single input file into a number of different output ") ;
puts ("encodings. These output encodings can then be moved to another ") ;
puts ("OS for testing.\n") ;
puts (" Usage : generate <filename>\n") ;
exit (1) ;
} ;
/* A couple of standard WAV files. Make sure Win32 plays these. */
encode_file (argv [1], "pcmu8.wav" , SF_FORMAT_WAV | SF_FORMAT_PCM_U8) ;
encode_file (argv [1], "pcm16.wav" , SF_FORMAT_WAV | SF_FORMAT_PCM_16) ;
encode_file (argv [1], "imaadpcm.wav", SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ;
encode_file (argv [1], "msadpcm.wav", SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ;
encode_file (argv [1], "gsm610.wav" , SF_FORMAT_WAV | SF_FORMAT_GSM610) ;
/* Soundforge W64. */
encode_file (argv [1], "pcmu8.w64" , SF_FORMAT_W64 | SF_FORMAT_PCM_U8) ;
encode_file (argv [1], "pcm16.w64" , SF_FORMAT_W64 | SF_FORMAT_PCM_16) ;
encode_file (argv [1], "imaadpcm.w64", SF_FORMAT_W64 | SF_FORMAT_MS_ADPCM) ;
encode_file (argv [1], "msadpcm.w64", SF_FORMAT_W64 | SF_FORMAT_IMA_ADPCM) ;
encode_file (argv [1], "gsm610.w64" , SF_FORMAT_W64 | SF_FORMAT_GSM610) ;
return 0 ;
} /* main */
/*============================================================================================
** Helper functions and macros.
*/
#define PUT_DOTS(k) \
{ while (k--) \
putchar ('.') ; \
putchar (' ') ; \
}
/*========================================================================================
*/
static void
encode_file (const char *infilename, const char *outfilename, int filetype)
{ static float buffer [BUFFER_LEN] ;
SNDFILE *infile, *outfile ;
SF_INFO sfinfo ;
int k, readcount ;
printf (" %s -> %s ", infilename, outfilename) ;
fflush (stdout) ;
k = 16 - strlen (outfilename) ;
PUT_DOTS (k) ;
if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
{ printf ("Error : could not open file : %s\n", infilename) ;
puts (sf_strerror (NULL)) ;
exit (1) ;
}
sfinfo.format = filetype ;
if (! sf_format_check (&sfinfo))
{ sf_close (infile) ;
printf ("Invalid encoding\n") ;
return ;
} ;
if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
{ printf ("Error : could not open file : %s\n", outfilename) ;
puts (sf_strerror (NULL)) ;
exit (1) ;
} ;
while ((readcount = sf_read_float (infile, buffer, BUFFER_LEN)) > 0)
sf_write_float (outfile, buffer, BUFFER_LEN) ;
sf_close (infile) ;
sf_close (outfile) ;
printf ("ok\n") ;
return ;
} /* encode_file */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: fe28ef37-ae89-4f61-966b-0b1f68e37425
*/

View File

@ -0,0 +1,76 @@
/*
** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sndfile.h>
int
main (void)
{ SF_FORMAT_INFO info ;
SF_INFO sfinfo ;
char buffer [128] ;
int format, major_count, subtype_count, m, s ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
buffer [0] = 0 ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
if (strlen (buffer) < 1)
{ printf ("Line %d: could not retrieve lib version.\n", __LINE__) ;
exit (1) ;
} ;
printf ("Version : %s\n\n", buffer) ;
sf_command (NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof (int)) ;
sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)) ;
sfinfo.channels = 1 ;
for (m = 0 ; m < major_count ; m++)
{ info.format = m ;
sf_command (NULL, SFC_GET_FORMAT_MAJOR, &info, sizeof (info)) ;
printf ("%s (extension \"%s\")\n", info.name, info.extension) ;
format = info.format ;
for (s = 0 ; s < subtype_count ; s++)
{ info.format = s ;
sf_command (NULL, SFC_GET_FORMAT_SUBTYPE, &info, sizeof (info)) ;
format = (format & SF_FORMAT_TYPEMASK) | info.format ;
sfinfo.format = format ;
if (sf_format_check (&sfinfo))
printf (" %s\n", info.name) ;
} ;
puts ("") ;
} ;
puts ("") ;
return 0 ;
} /* main */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 58127a0c-93a2-46cf-b615-fcb9adacf3f1
*/

View File

@ -0,0 +1,89 @@
/*
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sndfile.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846264338
#endif
#define SAMPLE_RATE 44100
#define SAMPLE_COUNT (SAMPLE_RATE * 4) /* 4 seconds */
#define AMPLITUDE (1.0 * 0x7F000000)
#define LEFT_FREQ (344.0 / SAMPLE_RATE)
#define RIGHT_FREQ (466.0 / SAMPLE_RATE)
int
main (void)
{ SNDFILE *file ;
SF_INFO sfinfo ;
int k ;
int *buffer ;
if (! (buffer = malloc (2 * SAMPLE_COUNT * sizeof (int))))
{ printf ("Malloc failed.\n") ;
exit (0) ;
} ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
sfinfo.samplerate = SAMPLE_RATE ;
sfinfo.frames = SAMPLE_COUNT ;
sfinfo.channels = 2 ;
sfinfo.format = (SF_FORMAT_WAV | SF_FORMAT_PCM_24) ;
if (! (file = sf_open ("sine.wav", SFM_WRITE, &sfinfo)))
{ printf ("Error : Not able to open output file.\n") ;
return 1 ;
} ;
if (sfinfo.channels == 1)
{ for (k = 0 ; k < SAMPLE_COUNT ; k++)
buffer [k] = AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI) ;
}
else if (sfinfo.channels == 2)
{ for (k = 0 ; k < SAMPLE_COUNT ; k++)
{ buffer [2 * k] = AMPLITUDE * sin (LEFT_FREQ * 2 * k * M_PI) ;
buffer [2 * k + 1] = AMPLITUDE * sin (RIGHT_FREQ * 2 * k * M_PI) ;
} ;
}
else
{ printf ("makesine can only generate mono or stereo files.\n") ;
exit (1) ;
} ;
if (sf_write_int (file, buffer, sfinfo.channels * SAMPLE_COUNT) !=
sfinfo.channels * SAMPLE_COUNT)
puts (sf_strerror (file)) ;
sf_close (file) ;
return 0 ;
} /* main */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: fd945a2c-a306-49ef-a262-6336ced15246
*/

View File

@ -0,0 +1,131 @@
/*
** Copyright (C) 2001-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
/* Include this header file to use functions from libsndfile. */
#include <sndfile.h>
/* This will be the length of the buffer used to hold.frames while
** we process them.
*/
#define BUFFER_LEN 1024
/* libsndfile can handle more than 6 channels but we'll restrict it to 6. */
#define MAX_CHANNELS 6
/* Function prototype. */
static void process_data (double *data, int count, int channels) ;
int
main (void)
{ /* This is a buffer of double precision floating point values
** which will hold our data while we process it.
*/
static double data [BUFFER_LEN] ;
/* A SNDFILE is very much like a FILE in the Standard C library. The
** sf_open function return an SNDFILE* pointer when they sucessfully
** open the specified file.
*/
SNDFILE *infile, *outfile ;
/* A pointer to an SF_INFO stutct is passed to sf_open.
** On read, the library fills this struct with information about the file.
** On write, the struct must be filled in before calling sf_open.
*/
SF_INFO sfinfo ;
int readcount ;
const char *infilename = "input.wav" ;
const char *outfilename = "output.wav" ;
/* Here's where we open the input file. We pass sf_open the file name and
** a pointer to an SF_INFO struct.
** On successful open, sf_open returns a SNDFILE* pointer which is used
** for all subsequent operations on that file.
** If an error occurs during sf_open, the function returns a NULL pointer.
**
** If you are trying to open a raw headerless file you will need to set the
** format and channels fields of sfinfo before calling sf_open(). For
** instance to open a raw 16 bit stereo PCM file you would need the following
** two lines:
**
** sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16 ;
** sfinfo.channels = 2 ;
*/
if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
{ /* Open failed so print an error message. */
printf ("Not able to open input file %s.\n", infilename) ;
/* Print the error message from libsndfile. */
puts (sf_strerror (NULL)) ;
return 1 ;
} ;
if (sfinfo.channels > MAX_CHANNELS)
{ printf ("Not able to process more than %d channels\n", MAX_CHANNELS) ;
return 1 ;
} ;
/* Open the output file. */
if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
{ printf ("Not able to open output file %s.\n", outfilename) ;
puts (sf_strerror (NULL)) ;
return 1 ;
} ;
/* While there are.frames in the input file, read them, process
** them and write them to the output file.
*/
while ((readcount = sf_read_double (infile, data, BUFFER_LEN)))
{ process_data (data, readcount, sfinfo.channels) ;
sf_write_double (outfile, data, readcount) ;
} ;
/* Close input and output files. */
sf_close (infile) ;
sf_close (outfile) ;
return 0 ;
} /* main */
static void
process_data (double *data, int count, int channels)
{ double channel_gain [MAX_CHANNELS] = { 0.5, 0.8, 0.1, 0.4, 0.4, 0.9 } ;
int k, chan ;
/* Process the data here.
** If the soundfile contains more then 1 channel you need to take care of
** the data interleaving youself.
** Current we just apply a channel dependant gain.
*/
for (chan = 0 ; chan < channels ; chan ++)
for (k = chan ; k < count ; k+= channels)
data [k] *= channel_gain [chan] ;
return ;
} /* process_data */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: de9fdd1e-b807-41ef-9d51-075ba383e536
*/

View File

@ -0,0 +1,376 @@
/*
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sndfile.h>
#define BUFFER_LEN 1024
typedef struct
{ char *infilename, *outfilename ;
SF_INFO infileinfo, outfileinfo ;
} OptionData ;
typedef struct
{ const char *ext ;
int len ;
int format ;
} OUTPUT_FORMAT_MAP ;
static void copy_metadata (SNDFILE *outfile, SNDFILE *infile) ;
static void copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels) ;
static void copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
static OUTPUT_FORMAT_MAP format_map [] =
{
{ "aif", 3, SF_FORMAT_AIFF },
{ "wav", 0, SF_FORMAT_WAV },
{ "au", 0, SF_FORMAT_AU },
{ "caf", 0, SF_FORMAT_CAF },
{ "flac", 0, SF_FORMAT_FLAC },
{ "snd", 0, SF_FORMAT_AU },
{ "svx", 0, SF_FORMAT_SVX },
{ "paf", 0, SF_ENDIAN_BIG | SF_FORMAT_PAF },
{ "fap", 0, SF_ENDIAN_LITTLE | SF_FORMAT_PAF },
{ "gsm", 0, SF_FORMAT_RAW },
{ "nist", 0, SF_FORMAT_NIST },
{ "ircam", 0, SF_FORMAT_IRCAM },
{ "sf", 0, SF_FORMAT_IRCAM },
{ "voc", 0, SF_FORMAT_VOC },
{ "w64", 0, SF_FORMAT_W64 },
{ "raw", 0, SF_FORMAT_RAW },
{ "mat4", 0, SF_FORMAT_MAT4 },
{ "mat5", 0, SF_FORMAT_MAT5 },
{ "mat", 0, SF_FORMAT_MAT4 },
{ "pvf", 0, SF_FORMAT_PVF },
{ "sds", 0, SF_FORMAT_SDS },
{ "sd2", 0, SF_FORMAT_SD2 },
{ "vox", 0, SF_FORMAT_RAW },
{ "xi", 0, SF_FORMAT_XI }
} ; /* format_map */
static int
guess_output_file_type (char *str, int format)
{ char buffer [16], *cptr ;
int k ;
format &= SF_FORMAT_SUBMASK ;
if ((cptr = strrchr (str, '.')) == NULL)
return 0 ;
strncpy (buffer, cptr + 1, 15) ;
buffer [15] = 0 ;
for (k = 0 ; buffer [k] ; k++)
buffer [k] = tolower ((buffer [k])) ;
if (strcmp (buffer, "gsm") == 0)
return SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
if (strcmp (buffer, "vox") == 0)
return SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
for (k = 0 ; k < (int) (sizeof (format_map) / sizeof (format_map [0])) ; k++)
{ if (format_map [k].len > 0 && strncmp (buffer, format_map [k].ext, format_map [k].len) == 0)
return format_map [k].format | format ;
else if (strcmp (buffer, format_map [k].ext) == 0)
return format_map [k].format | format ;
} ;
return 0 ;
} /* guess_output_file_type */
static void
print_usage (char *progname)
{ SF_FORMAT_INFO info ;
int k ;
printf ("\nUsage : %s [encoding] <input file> <output file>\n", progname) ;
puts ("\n"
" where [encoding] may be one of the following:\n\n"
" -pcms8 : force the output to signed 8 bit pcm\n"
" -pcmu8 : force the output to unsigned 8 bit pcm\n"
" -pcm16 : force the output to 16 bit pcm\n"
" -pcm24 : force the output to 24 bit pcm\n"
" -pcm32 : force the output to 32 bit pcm\n"
" -float32 : force the output to 32 bit floating point"
) ;
puts (
" -ulaw : force the output ULAW\n"
" -alaw : force the output ALAW\n"
" -ima-adpcm : force the output to IMA ADPCM (WAV only)\n"
" -ms-adpcm : force the output to MS ADPCM (WAV only)\n"
" -gsm610 : force the GSM6.10 (WAV only)\n"
" -dwvw12 : force the output to 12 bit DWVW (AIFF only)\n"
" -dwvw16 : force the output to 16 bit DWVW (AIFF only)\n"
" -dwvw24 : force the output to 24 bit DWVW (AIFF only)\n"
) ;
puts (
" The format of the output file is determined by the file extension of the\n"
" output file name. The following extensions are currently understood:\n"
) ;
for (k = 0 ; k < (int) (sizeof (format_map) / sizeof (format_map [0])) ; k++)
{ info.format = format_map [k].format ;
sf_command (NULL, SFC_GET_FORMAT_INFO, &info, sizeof (info)) ;
printf (" %-10s : %s\n", format_map [k].ext, info.name) ;
} ;
puts ("") ;
} /* print_usage */
int
main (int argc, char * argv [])
{ char *progname, *infilename, *outfilename ;
SNDFILE *infile = NULL, *outfile = NULL ;
SF_INFO sfinfo ;
int k, outfilemajor, outfileminor = 0, infileminor ;
progname = strrchr (argv [0], '/') ;
progname = progname ? progname + 1 : argv [0] ;
if (argc < 3 || argc > 5)
{ print_usage (progname) ;
return 1 ;
} ;
infilename = argv [argc-2] ;
outfilename = argv [argc-1] ;
if (strcmp (infilename, outfilename) == 0)
{ printf ("Error : Input and output filenames are the same.\n\n") ;
print_usage (progname) ;
return 1 ;
} ;
if (infilename [0] == '-')
{ printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
print_usage (progname) ;
return 1 ;
} ;
if (outfilename [0] == '-')
{ printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
print_usage (progname) ;
return 1 ;
} ;
for (k = 1 ; k < argc - 2 ; k++)
{ if (! strcmp (argv [k], "-pcms8"))
{ outfileminor = SF_FORMAT_PCM_S8 ;
continue ;
} ;
if (! strcmp (argv [k], "-pcmu8"))
{ outfileminor = SF_FORMAT_PCM_U8 ;
continue ;
} ;
if (! strcmp (argv [k], "-pcm16"))
{ outfileminor = SF_FORMAT_PCM_16 ;
continue ;
} ;
if (! strcmp (argv [k], "-pcm24"))
{ outfileminor = SF_FORMAT_PCM_24 ;
continue ;
} ;
if (! strcmp (argv [k], "-pcm32"))
{ outfileminor = SF_FORMAT_PCM_32 ;
continue ;
} ;
if (! strcmp (argv [k], "-float32"))
{ outfileminor = SF_FORMAT_FLOAT ;
continue ;
} ;
if (! strcmp (argv [k], "-ulaw"))
{ outfileminor = SF_FORMAT_ULAW ;
continue ;
} ;
if (! strcmp (argv [k], "-alaw"))
{ outfileminor = SF_FORMAT_ALAW ;
continue ;
} ;
if (! strcmp (argv [k], "-ima-adpcm"))
{ outfileminor = SF_FORMAT_IMA_ADPCM ;
continue ;
} ;
if (! strcmp (argv [k], "-ms-adpcm"))
{ outfileminor = SF_FORMAT_MS_ADPCM ;
continue ;
} ;
if (! strcmp (argv [k], "-gsm610"))
{ outfileminor = SF_FORMAT_GSM610 ;
continue ;
} ;
if (! strcmp (argv [k], "-dwvw12"))
{ outfileminor = SF_FORMAT_DWVW_12 ;
continue ;
} ;
if (! strcmp (argv [k], "-dwvw16"))
{ outfileminor = SF_FORMAT_DWVW_16 ;
continue ;
} ;
if (! strcmp (argv [k], "-dwvw24"))
{ outfileminor = SF_FORMAT_DWVW_24 ;
continue ;
} ;
printf ("Error : Not able to decode argunment '%s'.\n", argv [k]) ;
exit (1) ;
} ;
if ((infile = sf_open (infilename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Not able to open input file %s.\n", infilename) ;
puts (sf_strerror (NULL)) ;
return 1 ;
} ;
infileminor = sfinfo.format & SF_FORMAT_SUBMASK ;
if ((sfinfo.format = guess_output_file_type (outfilename, sfinfo.format)) == 0)
{ printf ("Error : Not able to determine output file type for %s.\n", outfilename) ;
return 1 ;
} ;
outfilemajor = sfinfo.format & (SF_FORMAT_TYPEMASK | SF_FORMAT_ENDMASK) ;
if (outfileminor == 0)
outfileminor = sfinfo.format & SF_FORMAT_SUBMASK ;
if (outfileminor != 0)
sfinfo.format = outfilemajor | outfileminor ;
else
sfinfo.format = outfilemajor | (sfinfo.format & SF_FORMAT_SUBMASK) ;
if ((sfinfo.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_XI)
switch (sfinfo.format & SF_FORMAT_SUBMASK)
{ case SF_FORMAT_PCM_16 :
sfinfo.format = outfilemajor | SF_FORMAT_DPCM_16 ;
break ;
case SF_FORMAT_PCM_S8 :
case SF_FORMAT_PCM_U8 :
sfinfo.format = outfilemajor | SF_FORMAT_DPCM_8 ;
break ;
} ;
if (sf_format_check (&sfinfo) == 0)
{ printf ("Error : output file format is invalid (0x%08X).\n", sfinfo.format) ;
return 1 ;
} ;
/* Open the output file. */
if ((outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)) == NULL)
{ printf ("Not able to open output file %s : %s\n", outfilename, sf_strerror (NULL)) ;
return 1 ;
} ;
/* Copy the metadata */
copy_metadata (outfile, infile) ;
if ((outfileminor == SF_FORMAT_DOUBLE) || (outfileminor == SF_FORMAT_FLOAT) ||
(infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT))
copy_data_fp (outfile, infile, sfinfo.channels) ;
else
copy_data_int (outfile, infile, sfinfo.channels) ;
sf_close (infile) ;
sf_close (outfile) ;
return 0 ;
} /* main */
static void
copy_metadata (SNDFILE *outfile, SNDFILE *infile)
{ SF_INSTRUMENT inst ;
const char *str ;
int k, err = 0 ;
for (k = SF_STR_FIRST ; k <= SF_STR_LAST ; k++)
{ str = sf_get_string (infile, k) ;
if (str != NULL)
err = sf_set_string (outfile, k, str) ;
} ;
memset (&inst, 0, sizeof (inst)) ;
if (sf_command (infile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
sf_command (outfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) ;
} /* copy_metadata */
static void
copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels)
{ static double data [BUFFER_LEN], max ;
int frames, readcount, k ;
frames = BUFFER_LEN / channels ;
readcount = frames ;
sf_command (infile, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
if (max < 1.0)
{ while (readcount > 0)
{ readcount = sf_readf_double (infile, data, frames) ;
sf_writef_double (outfile, data, readcount) ;
} ;
}
else
{ sf_command (infile, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
while (readcount > 0)
{ readcount = sf_readf_double (infile, data, frames) ;
for (k = 0 ; k < readcount * channels ; k++)
data [k] /= max ;
sf_writef_double (outfile, data, readcount) ;
} ;
} ;
return ;
} /* copy_data_fp */
static void
copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels)
{ static int data [BUFFER_LEN] ;
int frames, readcount ;
frames = BUFFER_LEN / channels ;
readcount = frames ;
while (readcount > 0)
{ readcount = sf_readf_int (infile, data, frames) ;
sf_writef_int (outfile, data, readcount) ;
} ;
return ;
} /* copy_data_int */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 259682b3-2887-48a6-b5bb-3cde00521ba3
*/

View File

@ -0,0 +1,354 @@
/*
** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <sndfile.h>
#define BUFFER_LEN (1 << 16)
#if (defined (WIN32) || defined (_WIN32))
#define snprintf _snprintf
#endif
static void print_version (void) ;
static void print_usage (const char *progname) ;
static void info_dump (const char *filename) ;
static void instrument_dump (const char *filename) ;
static void broadcast_dump (const char *filename) ;
int
main (int argc, char *argv [])
{ int k ;
print_version () ;
if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
{ char *progname ;
progname = strrchr (argv [0], '/') ;
progname = progname ? progname + 1 : argv [0] ;
print_usage (progname) ;
return 1 ;
} ;
if (strcmp (argv [1], "-i") == 0)
{ instrument_dump (argv [2]) ;
return 0 ;
} ;
if (strcmp (argv [1], "-b") == 0)
{ broadcast_dump (argv [2]) ;
return 0 ;
} ;
for (k = 1 ; k < argc ; k++)
info_dump (argv [k]) ;
return 0 ;
} /* main */
/*==============================================================================
** Print version and usage.
*/
static double data [BUFFER_LEN] ;
static void
print_version (void)
{ char buffer [256] ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
printf ("\nVersion : %s\n\n", buffer) ;
} /* print_version */
static void
print_usage (const char *progname)
{ printf ("Usage :\n %s <file> ...\n", progname) ;
printf (" Prints out information about one or more sound files.\n\n") ;
printf (" %s -i <file>\n", progname) ;
printf (" Prints out the instrument data for the given file.\n\n") ;
printf (" %s -b <file>\n", progname) ;
printf (" Prints out the broadcast WAV info for the given file.\n\n") ;
#if (defined (_WIN32) || defined (WIN32))
printf ("This is a Unix style command line application which\n"
"should be run in a MSDOS box or Command Shell window.\n\n") ;
printf ("Sleeping for 5 seconds before exiting.\n\n") ;
fflush (stdout) ;
/* This is the officially blessed by microsoft way but I can't get
** it to link.
** Sleep (15) ;
** Instead, use this:
*/
_sleep (5 * 1000) ;
#endif
} /* print_usage */
/*==============================================================================
** Dumping of sndfile info.
*/
static double data [BUFFER_LEN] ;
static double
get_signal_max (SNDFILE *file)
{ double max, temp ;
int readcount, k, save_state ;
save_state = sf_command (file, SFC_GET_NORM_DOUBLE, NULL, 0) ;
sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
max = 0.0 ;
while ((readcount = sf_read_double (file, data, BUFFER_LEN)))
{ for (k = 0 ; k < readcount ; k++)
{ temp = fabs (data [k]) ;
if (temp > max)
max = temp ;
} ;
} ;
sf_command (file, SFC_SET_NORM_DOUBLE, NULL, save_state) ;
return max ;
} /* get_signal_max */
static double
calc_decibels (SF_INFO * sfinfo, double max)
{ double decibels ;
switch (sfinfo->format & SF_FORMAT_SUBMASK)
{ case SF_FORMAT_PCM_U8 :
case SF_FORMAT_PCM_S8 :
decibels = max / 0x80 ;
break ;
case SF_FORMAT_PCM_16 :
decibels = max / 0x8000 ;
break ;
case SF_FORMAT_PCM_24 :
decibels = max / 0x800000 ;
break ;
case SF_FORMAT_PCM_32 :
decibels = max / 0x80000000 ;
break ;
case SF_FORMAT_FLOAT :
case SF_FORMAT_DOUBLE :
decibels = max / 1.0 ;
break ;
default :
decibels = max / 0x8000 ;
break ;
} ;
return 20.0 * log10 (decibels) ;
} /* calc_decibels */
static const char *
generate_duration_str (SF_INFO *sfinfo)
{ static char str [128] ;
int seconds ;
memset (str, 0, sizeof (str)) ;
if (sfinfo->samplerate < 1)
return NULL ;
if (sfinfo->frames / sfinfo->samplerate > 0x7FFFFFFF)
return "unknown" ;
seconds = sfinfo->frames / sfinfo->samplerate ;
snprintf (str, sizeof (str) - 1, "%02d:", seconds / 60 / 60) ;
seconds = seconds % (60 * 60) ;
snprintf (str + strlen (str), sizeof (str) - strlen (str) - 1, "%02d:", seconds / 60) ;
seconds = seconds % 60 ;
snprintf (str + strlen (str), sizeof (str) - strlen (str) - 1, "%02d.", seconds) ;
seconds = ((1000 * sfinfo->frames) / sfinfo->samplerate) % 1000 ;
snprintf (str + strlen (str), sizeof (str) - strlen (str) - 1, "%03d", seconds) ;
return str ;
} /* generate_duration_str */
static void
info_dump (const char *filename)
{ static char strbuffer [BUFFER_LEN] ;
SNDFILE *file ;
SF_INFO sfinfo ;
double signal_max, decibels ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Error : Not able to open input file %s.\n", filename) ;
fflush (stdout) ;
memset (data, 0, sizeof (data)) ;
sf_command (file, SFC_GET_LOG_INFO, strbuffer, BUFFER_LEN) ;
puts (strbuffer) ;
puts (sf_strerror (NULL)) ;
return ;
} ;
printf ("========================================\n") ;
sf_command (file, SFC_GET_LOG_INFO, strbuffer, BUFFER_LEN) ;
puts (strbuffer) ;
printf ("----------------------------------------\n") ;
if (file == NULL)
{ printf ("Error : Not able to open input file %s.\n", filename) ;
fflush (stdout) ;
memset (data, 0, sizeof (data)) ;
puts (sf_strerror (NULL)) ;
}
else
{ printf ("Sample Rate : %d\n", sfinfo.samplerate) ;
if (sfinfo.frames > 0x7FFFFFFF)
printf ("Frames : unknown\n") ;
else
printf ("Frames : %ld\n", (long) sfinfo.frames) ;
printf ("Channels : %d\n", sfinfo.channels) ;
printf ("Format : 0x%08X\n", sfinfo.format) ;
printf ("Sections : %d\n", sfinfo.sections) ;
printf ("Seekable : %s\n", (sfinfo.seekable ? "TRUE" : "FALSE")) ;
printf ("Duration : %s\n", generate_duration_str (&sfinfo)) ;
/* Do not use sf_signal_max because it doesn work for non-seekable files . */
signal_max = get_signal_max (file) ;
decibels = calc_decibels (&sfinfo, signal_max) ;
printf ("Signal Max : %g (%4.2f dB)\n\n", signal_max, decibels) ;
} ;
sf_close (file) ;
} /* info_dump */
/*==============================================================================
** Dumping of SF_INSTRUMENT data.
*/
static const char *
str_of_type (int mode)
{ switch (mode)
{ case SF_LOOP_NONE : return "none" ;
case SF_LOOP_FORWARD : return "fwd " ;
case SF_LOOP_BACKWARD : return "back" ;
case SF_LOOP_ALTERNATING : return "alt " ;
default : break ;
} ;
return "????" ;
} /* str_of_mode */
static void
instrument_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
SF_INSTRUMENT inst ;
int got_inst, k ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Error : Not able to open input file %s.\n", filename) ;
fflush (stdout) ;
memset (data, 0, sizeof (data)) ;
puts (sf_strerror (NULL)) ;
return ;
} ;
got_inst = sf_command (file, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) ;
sf_close (file) ;
if (got_inst == SF_FALSE)
{ printf ("Error : File '%s' does not contain instrument data.\n\n", filename) ;
return ;
} ;
printf ("Instrument : %s\n\n", filename) ;
printf (" Gain : %d\n", inst.gain) ;
printf (" Base note : %d\n", inst.basenote) ;
printf (" Velocity : %d - %d\n", (int) inst.velocity_lo, (int) inst.velocity_hi) ;
printf (" Key : %d - %d\n", (int) inst.key_lo, (int) inst.key_hi) ;
printf (" Loop points : %d\n", inst.loop_count) ;
for (k = 0 ; k < inst.loop_count ; k++)
printf (" %-2d Mode : %s Start : %6d End : %6d Count : %6d\n", k, str_of_type (inst.loops [k].mode), inst.loops [k].start, inst.loops [k].end, inst.loops [k].count) ;
putchar ('\n') ;
} /* instrument_dump */
static void
broadcast_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
SF_BROADCAST_INFO bext ;
int got_bext ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Error : Not able to open input file %s.\n", filename) ;
fflush (stdout) ;
memset (data, 0, sizeof (data)) ;
puts (sf_strerror (NULL)) ;
return ;
} ;
memset (&bext, 0, sizeof (SF_BROADCAST_INFO)) ;
got_bext = sf_command (file, SFC_GET_BROADCAST_INFO, &bext, sizeof (bext)) ;
sf_close (file) ;
if (got_bext == SF_FALSE)
{ printf ("Error : File '%s' does not contain broadcast information.\n\n", filename) ;
return ;
} ;
printf ("Description : %.*s\n", (int) sizeof (bext.description), bext.description) ;
printf ("Originator : %.*s\n", (int) sizeof (bext.originator), bext.originator) ;
printf ("Origination ref : %.*s\n", (int) sizeof (bext.originator_reference), bext.originator_reference) ;
printf ("Origination date : %.*s\n", (int) sizeof (bext.origination_date), bext.origination_date) ;
printf ("Origination time : %.*s\n", (int) sizeof (bext.origination_time), bext.origination_time) ;
printf ("BWF version : %d\n", bext.version) ;
printf ("UMID : %.*s\n", (int) sizeof (bext.umid), bext.umid) ;
printf ("Coding history : %.*s\n", bext.coding_history_size, bext.coding_history) ;
} /* broadcast_dump */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: f59a05db-a182-41de-aedd-d717ce2bb099
*/

View File

@ -0,0 +1,153 @@
/*
** Copyright (C) 2001 Marcus Overhagen <marcus@overhagen.de>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <Application.h>
#include <SoundPlayer.h>
#include <string.h>
#include <sndfile.h>
#define BUFFER_LEN 1024
/*------------------------------------------------------------------------------
** BeOS functions for playing a sound.
*/
#if defined (__BEOS__)
struct shared_data
{
BSoundPlayer *player;
SNDFILE *sndfile;
SF_INFO sfinfo;
sem_id finished;
};
static void
buffer_callback(void *theCookie, void *buf, size_t size, const media_raw_audio_format &format)
{
shared_data *data = (shared_data *)theCookie;
short *buffer = (short *)buf;
int count = size / sizeof(short);
int m, readcount;
if (!data->player->HasData())
return;
readcount = sf_read_short(data->sndfile, buffer, count);
if (readcount == 0)
{ data->player->SetHasData(false);
release_sem(data->finished);
}
if (readcount < count)
{ for (m = readcount ; m < count ; m++)
buffer [m] = 0 ;
}
if (data->sfinfo.pcmbitwidth < 16)
{ for (m = 0 ; m < count ; m++)
buffer [m] *= 256 ;
}
}
static void
beos_play (int argc, char *argv [])
{
shared_data data;
status_t status;
int k;
/* BSoundPlayer requires a BApplication object */
BApplication app("application/x-vnd.MarcusOverhagen-sfplay");
for (k = 1 ; k < argc ; k++)
{ printf ("Playing %s\n", argv [k]) ;
if (! (data.sndfile = sf_open_read (argv [k], &data.sfinfo)))
{ sf_perror (NULL) ;
continue ;
} ;
if (data.sfinfo.channels < 1 || data.sfinfo.channels > 2)
{ printf ("Error : channels = %d.\n", data.sfinfo.channels) ;
sf_close (data.sndfile) ;
continue ;
} ;
data.finished = create_sem(0,"finished");
media_raw_audio_format format =
{ data.sfinfo.samplerate,
data.sfinfo.channels,
media_raw_audio_format::B_AUDIO_SHORT,
B_HOST_IS_LENDIAN ? B_MEDIA_LITTLE_ENDIAN : B_MEDIA_BIG_ENDIAN,
BUFFER_LEN * sizeof(short)
};
BSoundPlayer player(&format,"player",buffer_callback,NULL,&data);
data.player = &player;
if ((status = player.InitCheck()) != B_OK)
{
printf ("Error : BSoundPlayer init failed, %s.\n", strerror(status)) ;
delete_sem(data.finished);
sf_close (data.sndfile) ;
continue ;
}
player.SetVolume(1.0);
player.Start();
player.SetHasData(true);
acquire_sem(data.finished);
player.Stop();
delete_sem(data.finished);
sf_close (data.sndfile) ;
} ;
} /* beos_play */
#endif
/*==============================================================================
** Main function.
*/
int
main (int argc, char *argv [])
{
if (argc < 2)
{ printf ("Usage : %s <input sound file>\n\n", argv [0]) ;
return 1 ;
} ;
beos_play (argc, argv) ;
return 0 ;
} /* main */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 5407a79d-88de-41c7-8d8e-9acf2cf13cc1
*/

View File

@ -0,0 +1,960 @@
/*
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "sfconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#if HAVE_ALSA_ASOUNDLIB_H
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h>
#include <sys/time.h>
#endif
#if defined (__linux__)
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#elif (defined (__MACH__) && defined (__APPLE__))
#include <Carbon.h>
#include <CoreAudio/AudioHardware.h>
#elif (defined (sun) && defined (unix))
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/audioio.h>
#elif (OS_IS_WIN32 == 1)
#include <windows.h>
#include <mmsystem.h>
#endif
#include <sndfile.h>
#define SIGNED_SIZEOF(x) ((int) sizeof (x))
#define BUFFER_LEN (2048)
/*------------------------------------------------------------------------------
** Linux/OSS functions for playing a sound.
*/
#if HAVE_ALSA_ASOUNDLIB_H
static snd_pcm_t * alsa_open (int channels, unsigned srate, int realtime) ;
static int alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels) ;
static void
alsa_play (int argc, char *argv [])
{ static float buffer [BUFFER_LEN] ;
SNDFILE *sndfile ;
SF_INFO sfinfo ;
snd_pcm_t * alsa_dev ;
int k, readcount, subformat ;
for (k = 1 ; k < argc ; k++)
{ memset (&sfinfo, 0, sizeof (sfinfo)) ;
printf ("Playing %s\n", argv [k]) ;
if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
{ puts (sf_strerror (NULL)) ;
continue ;
} ;
if (sfinfo.channels < 1 || sfinfo.channels > 2)
{ printf ("Error : channels = %d.\n", sfinfo.channels) ;
continue ;
} ;
if ((alsa_dev = alsa_open (sfinfo.channels, (unsigned) sfinfo.samplerate, SF_FALSE)) == NULL)
continue ;
subformat = sfinfo.format & SF_FORMAT_SUBMASK ;
if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
{ double scale ;
int m ;
sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
if (scale < 1e-10)
scale = 1.0 ;
else
scale = 32700.0 / scale ;
while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
{ for (m = 0 ; m < readcount ; m++)
buffer [m] *= scale ;
alsa_write_float (alsa_dev, buffer, BUFFER_LEN / sfinfo.channels, sfinfo.channels) ;
} ;
}
else
{ while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
alsa_write_float (alsa_dev, buffer, BUFFER_LEN / sfinfo.channels, sfinfo.channels) ;
} ;
snd_pcm_drain (alsa_dev) ;
snd_pcm_close (alsa_dev) ;
sf_close (sndfile) ;
} ;
return ;
} /* alsa_play */
static snd_pcm_t *
alsa_open (int channels, unsigned samplerate, int realtime)
{ const char * device = "plughw:0" ;
snd_pcm_t *alsa_dev = NULL ;
snd_pcm_hw_params_t *hw_params ;
snd_pcm_uframes_t buffer_size, xfer_align, start_threshold ;
snd_pcm_uframes_t alsa_period_size, alsa_buffer_frames ;
snd_pcm_sw_params_t *sw_params ;
int err ;
if (realtime)
{ alsa_period_size = 256 ;
alsa_buffer_frames = 3 * alsa_period_size ;
}
else
{ alsa_period_size = 1024 ;
alsa_buffer_frames = 4 * alsa_period_size ;
} ;
if ((err = snd_pcm_open (&alsa_dev, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
{ fprintf (stderr, "cannot open audio device \"%s\" (%s)\n", device, snd_strerror (err)) ;
goto catch_error ;
} ;
snd_pcm_nonblock (alsa_dev, 0) ;
if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0)
{ fprintf (stderr, "cannot allocate hardware parameter structure (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_hw_params_any (alsa_dev, hw_params)) < 0)
{ fprintf (stderr, "cannot initialize hardware parameter structure (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_hw_params_set_access (alsa_dev, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
{ fprintf (stderr, "cannot set access type (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_hw_params_set_format (alsa_dev, hw_params, SND_PCM_FORMAT_FLOAT)) < 0)
{ fprintf (stderr, "cannot set sample format (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_hw_params_set_rate_near (alsa_dev, hw_params, &samplerate, 0)) < 0)
{ fprintf (stderr, "cannot set sample rate (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_hw_params_set_channels (alsa_dev, hw_params, channels)) < 0)
{ fprintf (stderr, "cannot set channel count (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_hw_params_set_buffer_size_near (alsa_dev, hw_params, &alsa_buffer_frames)) < 0)
{ fprintf (stderr, "cannot set buffer size (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_hw_params_set_period_size_near (alsa_dev, hw_params, &alsa_period_size, 0)) < 0)
{ fprintf (stderr, "cannot set period size (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_hw_params (alsa_dev, hw_params)) < 0)
{ fprintf (stderr, "cannot set parameters (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
/* extra check: if we have only one period, this code won't work */
snd_pcm_hw_params_get_period_size (hw_params, &alsa_period_size, 0) ;
snd_pcm_hw_params_get_buffer_size (hw_params, &buffer_size) ;
if (alsa_period_size == buffer_size)
{ fprintf (stderr, "Can't use period equal to buffer size (%lu == %lu)", alsa_period_size, buffer_size) ;
goto catch_error ;
} ;
snd_pcm_hw_params_free (hw_params) ;
if ((err = snd_pcm_sw_params_malloc (&sw_params)) != 0)
{ fprintf (stderr, "%s: snd_pcm_sw_params_malloc: %s", __func__, snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_sw_params_current (alsa_dev, sw_params)) != 0)
{ fprintf (stderr, "%s: snd_pcm_sw_params_current: %s", __func__, snd_strerror (err)) ;
goto catch_error ;
} ;
/* note: set start threshold to delay start until the ring buffer is full */
snd_pcm_sw_params_current (alsa_dev, sw_params) ;
if ((err = snd_pcm_sw_params_get_xfer_align (sw_params, &xfer_align)) < 0)
{ fprintf (stderr, "cannot get xfer align (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
/* round up to closest transfer boundary */
start_threshold = (buffer_size / xfer_align) * xfer_align ;
if (start_threshold < 1)
start_threshold = 1 ;
if ((err = snd_pcm_sw_params_set_start_threshold (alsa_dev, sw_params, start_threshold)) < 0)
{ fprintf (stderr, "cannot set start threshold (%s)\n", snd_strerror (err)) ;
goto catch_error ;
} ;
if ((err = snd_pcm_sw_params (alsa_dev, sw_params)) != 0)
{ fprintf (stderr, "%s: snd_pcm_sw_params: %s", __func__, snd_strerror (err)) ;
goto catch_error ;
} ;
snd_pcm_sw_params_free (sw_params) ;
snd_pcm_reset (alsa_dev) ;
catch_error :
if (err < 0 && alsa_dev != NULL)
{ snd_pcm_close (alsa_dev) ;
return NULL ;
} ;
return alsa_dev ;
} /* alsa_open */
static int
alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels)
{ static int epipe_count = 0 ;
snd_pcm_status_t *status ;
int total = 0 ;
int retval ;
if (epipe_count > 0)
epipe_count -- ;
while (total < frames)
{ retval = snd_pcm_writei (alsa_dev, data + total * channels, frames - total) ;
if (retval >= 0)
{ total += retval ;
if (total == frames)
return total ;
continue ;
} ;
switch (retval)
{ case -EAGAIN :
puts ("alsa_write_float: EAGAIN") ;
continue ;
break ;
case -EPIPE :
if (epipe_count > 0)
{ printf ("alsa_write_float: EPIPE %d\n", epipe_count) ;
if (epipe_count > 140)
return retval ;
} ;
epipe_count += 100 ;
if (0)
{ snd_pcm_status_alloca (&status) ;
if ((retval = snd_pcm_status (alsa_dev, status)) < 0)
fprintf (stderr, "alsa_out: xrun. can't determine length\n") ;
else if (snd_pcm_status_get_state (status) == SND_PCM_STATE_XRUN)
{ struct timeval now, diff, tstamp ;
gettimeofday (&now, 0) ;
snd_pcm_status_get_trigger_tstamp (status, &tstamp) ;
timersub (&now, &tstamp, &diff) ;
fprintf (stderr, "alsa_write_float xrun: of at least %.3f msecs. resetting stream\n",
diff.tv_sec * 1000 + diff.tv_usec / 1000.0) ;
}
else
fprintf (stderr, "alsa_write_float: xrun. can't determine length\n") ;
} ;
snd_pcm_prepare (alsa_dev) ;
break ;
case -EBADFD :
fprintf (stderr, "alsa_write_float: Bad PCM state.n") ;
return 0 ;
break ;
case -ESTRPIPE :
fprintf (stderr, "alsa_write_float: Suspend event.n") ;
return 0 ;
break ;
case -EIO :
puts ("alsa_write_float: EIO") ;
return 0 ;
default :
fprintf (stderr, "alsa_write_float: retval = %d\n", retval) ;
return 0 ;
break ;
} ; /* switch */
} ; /* while */
return total ;
} /* alsa_write_float */
#endif /* HAVE_ALSA_ASOUNDLIB_H */
/*------------------------------------------------------------------------------
** Linux/OSS functions for playing a sound.
*/
#if defined (__linux__)
static int linux_open_dsp_device (int channels, int srate) ;
static void
linux_play (int argc, char *argv [])
{ static short buffer [BUFFER_LEN] ;
SNDFILE *sndfile ;
SF_INFO sfinfo ;
int k, audio_device, readcount, subformat ;
for (k = 1 ; k < argc ; k++)
{ memset (&sfinfo, 0, sizeof (sfinfo)) ;
printf ("Playing %s\n", argv [k]) ;
if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
{ puts (sf_strerror (NULL)) ;
continue ;
} ;
if (sfinfo.channels < 1 || sfinfo.channels > 2)
{ printf ("Error : channels = %d.\n", sfinfo.channels) ;
continue ;
} ;
audio_device = linux_open_dsp_device (sfinfo.channels, sfinfo.samplerate) ;
subformat = sfinfo.format & SF_FORMAT_SUBMASK ;
if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
{ static float float_buffer [BUFFER_LEN] ;
double scale ;
int m ;
sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
if (scale < 1e-10)
scale = 1.0 ;
else
scale = 32700.0 / scale ;
while ((readcount = sf_read_float (sndfile, float_buffer, BUFFER_LEN)))
{ for (m = 0 ; m < readcount ; m++)
buffer [m] = scale * float_buffer [m] ;
write (audio_device, buffer, readcount * sizeof (short)) ;
} ;
}
else
{ while ((readcount = sf_read_short (sndfile, buffer, BUFFER_LEN)))
write (audio_device, buffer, readcount * sizeof (short)) ;
} ;
if (ioctl (audio_device, SNDCTL_DSP_POST, 0) == -1)
perror ("ioctl (SNDCTL_DSP_POST) ") ;
if (ioctl (audio_device, SNDCTL_DSP_SYNC, 0) == -1)
perror ("ioctl (SNDCTL_DSP_SYNC) ") ;
close (audio_device) ;
sf_close (sndfile) ;
} ;
return ;
} /* linux_play */
static int
linux_open_dsp_device (int channels, int srate)
{ int fd, stereo, fmt ;
if ((fd = open ("/dev/dsp", O_WRONLY, 0)) == -1 &&
(fd = open ("/dev/sound/dsp", O_WRONLY, 0)) == -1)
{ perror ("linux_open_dsp_device : open ") ;
exit (1) ;
} ;
stereo = 0 ;
if (ioctl (fd, SNDCTL_DSP_STEREO, &stereo) == -1)
{ /* Fatal error */
perror ("linux_open_dsp_device : stereo ") ;
exit (1) ;
} ;
if (ioctl (fd, SNDCTL_DSP_RESET, 0))
{ perror ("linux_open_dsp_device : reset ") ;
exit (1) ;
} ;
fmt = CPU_IS_BIG_ENDIAN ? AFMT_S16_BE : AFMT_S16_LE ;
if (ioctl (fd, SOUND_PCM_SETFMT, &fmt) != 0)
{ perror ("linux_open_dsp_device : set format ") ;
exit (1) ;
} ;
if (ioctl (fd, SOUND_PCM_WRITE_CHANNELS, &channels) != 0)
{ perror ("linux_open_dsp_device : channels ") ;
exit (1) ;
} ;
if (ioctl (fd, SOUND_PCM_WRITE_RATE, &srate) != 0)
{ perror ("linux_open_dsp_device : sample rate ") ;
exit (1) ;
} ;
if (ioctl (fd, SNDCTL_DSP_SYNC, 0) != 0)
{ perror ("linux_open_dsp_device : sync ") ;
exit (1) ;
} ;
return fd ;
} /* linux_open_dsp_device */
#endif /* __linux__ */
/*------------------------------------------------------------------------------
** Mac OS X functions for playing a sound.
*/
#if (defined (__MACH__) && defined (__APPLE__)) /* MacOSX */
typedef struct
{ AudioStreamBasicDescription format ;
UInt32 buf_size ;
AudioDeviceID device ;
SNDFILE *sndfile ;
SF_INFO sfinfo ;
int fake_stereo ;
int done_playing ;
} MacOSXAudioData ;
#include <math.h>
static OSStatus
macosx_audio_out_callback (AudioDeviceID device, const AudioTimeStamp* current_time,
const AudioBufferList* data_in, const AudioTimeStamp* time_in,
AudioBufferList* data_out, const AudioTimeStamp* time_out,
void* client_data)
{ MacOSXAudioData *audio_data ;
int size, sample_count, read_count, k ;
float *buffer ;
/* Prevent compiler warnings. */
device = device ;
current_time = current_time ;
data_in = data_in ;
time_in = time_in ;
time_out = time_out ;
audio_data = (MacOSXAudioData*) client_data ;
size = data_out->mBuffers [0].mDataByteSize ;
sample_count = size / sizeof (float) ;
buffer = (float*) data_out->mBuffers [0].mData ;
if (audio_data->fake_stereo != 0)
{ read_count = sf_read_float (audio_data->sndfile, buffer, sample_count / 2) ;
for (k = read_count - 1 ; k >= 0 ; k--)
{ buffer [2 * k ] = buffer [k] ;
buffer [2 * k + 1] = buffer [k] ;
} ;
read_count *= 2 ;
}
else
read_count = sf_read_float (audio_data->sndfile, buffer, sample_count) ;
/* Fill the remainder with zeroes. */
if (read_count < sample_count)
{ if (audio_data->fake_stereo == 0)
memset (&(buffer [read_count]), 0, (sample_count - read_count) * sizeof (float)) ;
/* Tell the main application to terminate. */
audio_data->done_playing = SF_TRUE ;
} ;
return noErr ;
} /* macosx_audio_out_callback */
static void
macosx_play (int argc, char *argv [])
{ MacOSXAudioData audio_data ;
OSStatus err ;
UInt32 count, buffer_size ;
int k ;
audio_data.fake_stereo = 0 ;
audio_data.device = kAudioDeviceUnknown ;
/* get the default output device for the HAL */
count = sizeof (AudioDeviceID) ;
if ((err = AudioHardwareGetProperty (kAudioHardwarePropertyDefaultOutputDevice,
&count, (void *) &(audio_data.device))) != noErr)
{ printf ("AudioHardwareGetProperty (kAudioDevicePropertyDefaultOutputDevice) failed.\n") ;
return ;
} ;
/* get the buffersize that the default device uses for IO */
count = sizeof (UInt32) ;
if ((err = AudioDeviceGetProperty (audio_data.device, 0, false, kAudioDevicePropertyBufferSize,
&count, &buffer_size)) != noErr)
{ printf ("AudioDeviceGetProperty (kAudioDevicePropertyBufferSize) failed.\n") ;
return ;
} ;
/* get a description of the data format used by the default device */
count = sizeof (AudioStreamBasicDescription) ;
if ((err = AudioDeviceGetProperty (audio_data.device, 0, false, kAudioDevicePropertyStreamFormat,
&count, &(audio_data.format))) != noErr)
{ printf ("AudioDeviceGetProperty (kAudioDevicePropertyStreamFormat) failed.\n") ;
return ;
} ;
/* Base setup completed. Now play files. */
for (k = 1 ; k < argc ; k++)
{ printf ("Playing %s\n", argv [k]) ;
if (! (audio_data.sndfile = sf_open (argv [k], SFM_READ, &(audio_data.sfinfo))))
{ puts (sf_strerror (NULL)) ;
continue ;
} ;
if (audio_data.sfinfo.channels < 1 || audio_data.sfinfo.channels > 2)
{ printf ("Error : channels = %d.\n", audio_data.sfinfo.channels) ;
continue ;
} ;
audio_data.format.mSampleRate = audio_data.sfinfo.samplerate ;
if (audio_data.sfinfo.channels == 1)
{ audio_data.format.mChannelsPerFrame = 2 ;
audio_data.fake_stereo = 1 ;
}
else
audio_data.format.mChannelsPerFrame = audio_data.sfinfo.channels ;
if ((err = AudioDeviceSetProperty (audio_data.device, NULL, 0, false, kAudioDevicePropertyStreamFormat,
sizeof (AudioStreamBasicDescription), &(audio_data.format))) != noErr)
{ printf ("AudioDeviceSetProperty (kAudioDevicePropertyStreamFormat) failed.\n") ;
return ;
} ;
/* we want linear pcm */
if (audio_data.format.mFormatID != kAudioFormatLinearPCM)
return ;
/* Fire off the device. */
if ((err = AudioDeviceAddIOProc (audio_data.device, macosx_audio_out_callback,
(void *) &audio_data)) != noErr)
{ printf ("AudioDeviceAddIOProc failed.\n") ;
return ;
} ;
err = AudioDeviceStart (audio_data.device, macosx_audio_out_callback) ;
if (err != noErr)
return ;
audio_data.done_playing = SF_FALSE ;
while (audio_data.done_playing == SF_FALSE)
usleep (10 * 1000) ; /* 10 000 milliseconds. */
if ((err = AudioDeviceStop (audio_data.device, macosx_audio_out_callback)) != noErr)
{ printf ("AudioDeviceStop failed.\n") ;
return ;
} ;
err = AudioDeviceRemoveIOProc (audio_data.device, macosx_audio_out_callback) ;
if (err != noErr)
{ printf ("AudioDeviceRemoveIOProc failed.\n") ;
return ;
} ;
sf_close (audio_data.sndfile) ;
} ;
return ;
} /* macosx_play */
#endif /* MacOSX */
/*------------------------------------------------------------------------------
** Win32 functions for playing a sound.
**
** This API sucks. Its needlessly complicated and is *WAY* too loose with
** passing pointers arounf in integers and and using char* pointers to
** point to data instead of short*. It plain sucks!
*/
#if (OS_IS_WIN32 == 1)
#define WIN32_BUFFER_LEN (1<<15)
typedef struct
{ HWAVEOUT hwave ;
WAVEHDR whdr [2] ;
CRITICAL_SECTION mutex ; /* to control access to BuffersInUSe */
HANDLE Event ; /* signal that a buffer is free */
short buffer [WIN32_BUFFER_LEN / sizeof (short)] ;
int current, bufferlen ;
int BuffersInUse ;
SNDFILE *sndfile ;
SF_INFO sfinfo ;
sf_count_t remaining ;
} Win32_Audio_Data ;
static void
win32_play_data (Win32_Audio_Data *audio_data)
{ int thisread, readcount ;
/* fill a buffer if there is more data and we can read it sucessfully */
readcount = (audio_data->remaining > audio_data->bufferlen) ? audio_data->bufferlen : (int) audio_data->remaining ;
thisread = (int) sf_read_short (audio_data->sndfile, (short *) (audio_data->whdr [audio_data->current].lpData), readcount) ;
audio_data->remaining -= thisread ;
if (thisread > 0)
{ /* Fix buffer length if this is only a partial block. */
if (thisread < audio_data->bufferlen)
audio_data->whdr [audio_data->current].dwBufferLength = thisread * sizeof (short) ;
/* Queue the WAVEHDR */
waveOutWrite (audio_data->hwave, (LPWAVEHDR) &(audio_data->whdr [audio_data->current]), sizeof (WAVEHDR)) ;
/* count another buffer in use */
EnterCriticalSection (&audio_data->mutex) ;
audio_data->BuffersInUse ++ ;
LeaveCriticalSection (&audio_data->mutex) ;
/* use the other buffer next time */
audio_data->current = (audio_data->current + 1) % 2 ;
} ;
return ;
} /* win32_play_data */
static void CALLBACK
win32_audio_out_callback (HWAVEOUT hwave, UINT msg, DWORD data, DWORD param1, DWORD param2)
{ Win32_Audio_Data *audio_data ;
/* Prevent compiler warnings. */
hwave = hwave ;
param1 = param2 ;
if (data == 0)
return ;
/*
** I consider this technique of passing a pointer via an integer as
** fundamentally broken but thats the way microsoft has defined the
** interface.
*/
audio_data = (Win32_Audio_Data*) data ;
/* let main loop know a buffer is free */
if (msg == MM_WOM_DONE)
{ EnterCriticalSection (&audio_data->mutex) ;
audio_data->BuffersInUse -- ;
LeaveCriticalSection (&audio_data->mutex) ;
SetEvent (audio_data->Event) ;
} ;
return ;
} /* win32_audio_out_callback */
/* This is needed for earlier versions of the M$ development tools. */
#ifndef DWORD_PTR
#define DWORD_PTR DWORD
#endif
static void
win32_play (int argc, char *argv [])
{ Win32_Audio_Data audio_data ;
WAVEFORMATEX wf ;
int k, error ;
audio_data.sndfile = NULL ;
audio_data.hwave = 0 ;
for (k = 1 ; k < argc ; k++)
{ printf ("Playing %s\n", argv [k]) ;
if (! (audio_data.sndfile = sf_open (argv [k], SFM_READ, &(audio_data.sfinfo))))
{ puts (sf_strerror (NULL)) ;
continue ;
} ;
audio_data.remaining = audio_data.sfinfo.frames * audio_data.sfinfo.channels ;
audio_data.current = 0 ;
InitializeCriticalSection (&audio_data.mutex) ;
audio_data.Event = CreateEvent (0, FALSE, FALSE, 0) ;
wf.nChannels = audio_data.sfinfo.channels ;
wf.wFormatTag = WAVE_FORMAT_PCM ;
wf.cbSize = 0 ;
wf.wBitsPerSample = 16 ;
wf.nSamplesPerSec = audio_data.sfinfo.samplerate ;
wf.nBlockAlign = audio_data.sfinfo.channels * sizeof (short) ;
wf.nAvgBytesPerSec = wf.nBlockAlign * wf.nSamplesPerSec ;
error = waveOutOpen (&(audio_data.hwave), WAVE_MAPPER, &wf, (DWORD_PTR) win32_audio_out_callback,
(DWORD_PTR) &audio_data, CALLBACK_FUNCTION) ;
if (error)
{ puts ("waveOutOpen failed.") ;
audio_data.hwave = 0 ;
continue ;
} ;
audio_data.whdr [0].lpData = (char*) audio_data.buffer ;
audio_data.whdr [1].lpData = ((char*) audio_data.buffer) + sizeof (audio_data.buffer) / 2 ;
audio_data.whdr [0].dwBufferLength = sizeof (audio_data.buffer) / 2 ;
audio_data.whdr [1].dwBufferLength = sizeof (audio_data.buffer) / 2 ;
audio_data.whdr [0].dwFlags = 0 ;
audio_data.whdr [1].dwFlags = 0 ;
/* length of each audio buffer in samples */
audio_data.bufferlen = sizeof (audio_data.buffer) / 2 / sizeof (short) ;
/* Prepare the WAVEHDRs */
if ((error = waveOutPrepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR))))
{ printf ("waveOutPrepareHeader [0] failed : %08X\n", error) ;
waveOutClose (audio_data.hwave) ;
continue ;
} ;
if ((error = waveOutPrepareHeader (audio_data.hwave, &(audio_data.whdr [1]), sizeof (WAVEHDR))))
{ printf ("waveOutPrepareHeader [1] failed : %08X\n", error) ;
waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR)) ;
waveOutClose (audio_data.hwave) ;
continue ;
} ;
/* Fill up both buffers with audio data */
audio_data.BuffersInUse = 0 ;
win32_play_data (&audio_data) ;
win32_play_data (&audio_data) ;
/* loop until both buffers are released */
while (audio_data.BuffersInUse > 0)
{
/* wait for buffer to be released */
WaitForSingleObject (audio_data.Event, INFINITE) ;
/* refill the buffer if there is more data to play */
win32_play_data (&audio_data) ;
} ;
waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [0]), sizeof (WAVEHDR)) ;
waveOutUnprepareHeader (audio_data.hwave, &(audio_data.whdr [1]), sizeof (WAVEHDR)) ;
waveOutClose (audio_data.hwave) ;
audio_data.hwave = 0 ;
DeleteCriticalSection (&audio_data.mutex) ;
sf_close (audio_data.sndfile) ;
} ;
} /* win32_play */
#endif /* Win32 */
/*------------------------------------------------------------------------------
** Solaris.
*/
#if (defined (sun) && defined (unix)) /* ie Solaris */
static void
solaris_play (int argc, char *argv [])
{ static short buffer [BUFFER_LEN] ;
audio_info_t audio_info ;
SNDFILE *sndfile ;
SF_INFO sfinfo ;
unsigned long delay_time ;
long k, start_count, output_count, write_count, read_count ;
int audio_fd, error, done ;
for (k = 1 ; k < argc ; k++)
{ printf ("Playing %s\n", argv [k]) ;
if (! (sndfile = sf_open (argv [k], SFM_READ, &sfinfo)))
{ puts (sf_strerror (NULL)) ;
continue ;
} ;
if (sfinfo.channels < 1 || sfinfo.channels > 2)
{ printf ("Error : channels = %d.\n", sfinfo.channels) ;
continue ;
} ;
/* open the audio device - write only, non-blocking */
if ((audio_fd = open ("/dev/audio", O_WRONLY | O_NONBLOCK)) < 0)
{ perror ("open (/dev/audio) failed") ;
return ;
} ;
/* Retrive standard values. */
AUDIO_INITINFO (&audio_info) ;
audio_info.play.sample_rate = sfinfo.samplerate ;
audio_info.play.channels = sfinfo.channels ;
audio_info.play.precision = 16 ;
audio_info.play.encoding = AUDIO_ENCODING_LINEAR ;
audio_info.play.gain = AUDIO_MAX_GAIN ;
audio_info.play.balance = AUDIO_MID_BALANCE ;
if ((error = ioctl (audio_fd, AUDIO_SETINFO, &audio_info)))
{ perror ("ioctl (AUDIO_SETINFO) failed") ;
return ;
} ;
/* Delay time equal to 1/4 of a buffer in microseconds. */
delay_time = (BUFFER_LEN * 1000000) / (audio_info.play.sample_rate * 4) ;
done = 0 ;
while (! done)
{ read_count = sf_read_short (sndfile, buffer, BUFFER_LEN) ;
if (read_count < BUFFER_LEN)
{ memset (&(buffer [read_count]), 0, (BUFFER_LEN - read_count) * sizeof (short)) ;
/* Tell the main application to terminate. */
done = SF_TRUE ;
} ;
start_count = 0 ;
output_count = BUFFER_LEN * sizeof (short) ;
while (output_count > 0)
{ /* write as much data as possible */
write_count = write (audio_fd, &(buffer [start_count]), output_count) ;
if (write_count > 0)
{ output_count -= write_count ;
start_count += write_count ;
}
else
{ /* Give the audio output time to catch up. */
usleep (delay_time) ;
} ;
} ; /* while (outpur_count > 0) */
} ; /* while (! done) */
close (audio_fd) ;
} ;
return ;
} /* solaris_play */
#endif /* Solaris */
/*==============================================================================
** Main function.
*/
int
main (int argc, char *argv [])
{
if (argc < 2)
{
printf ("\nUsage : %s <input sound file>\n\n", argv [0]) ;
#if (OS_IS_WIN32 == 1)
printf ("This is a Unix style command line application which\n"
"should be run in a MSDOS box or Command Shell window.\n\n") ;
printf ("Sleeping for 5 seconds before exiting.\n\n") ;
/* This is the officially blessed by microsoft way but I can't get
** it to link.
** Sleep (15) ;
** Instead, use this:
*/
_sleep (5 * 1000) ;
#endif
return 1 ;
} ;
#if defined (__linux__)
#if HAVE_ALSA_ASOUNDLIB_H
if (access ("/proc/asound/cards", R_OK) == 0)
alsa_play (argc, argv) ;
else
#endif
linux_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__))
macosx_play (argc, argv) ;
#elif (defined (sun) && defined (unix))
solaris_play (argc, argv) ;
#elif (OS_IS_WIN32 == 1)
win32_play (argc, argv) ;
#elif defined (__BEOS__)
printf ("This program cannot be compiled on BeOS.\n") ;
printf ("Instead, compile the file sfplay_beos.cpp.\n") ;
return 1 ;
#else
puts ("*** Playing sound not yet supported on this platform.") ;
puts ("*** Please feel free to submit a patch.") ;
return 1 ;
#endif
return 0 ;
} /* main */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 8fc4110d-6cec-4e03-91df-0f384cabedac
*/

323
libs/libsndfile/install-sh Normal file
View File

@ -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:

View File

@ -0,0 +1,69 @@
%define name @PACKAGE@
%define version @VERSION@
%define release 1
Summary: A library to handle various audio file formats.
Name: %{name}
Version: %{version}
Release: %{release}
Copyright: LGPL
Group: Libraries/Sound
Source: http://www.mega-nerd.com/libsndfile/libsndfile-%{version}.tar.gz
URL: http://www.mega-nerd.com/libsndfile/
BuildRoot: /var/tmp/%{name}-%{version}
%description
libsndfile is a C library for reading and writing sound files such as
AIFF, AU and WAV files through one standard interface. It can currently
read/write 8, 16, 24 and 32-bit PCM files as well as 32-bit floating
point WAV files and a number of compressed formats.
%package devel
Summary: Libraries, includes, etc to develop libsndfile applications
Group: Libraries
%description devel
Libraries, include files, etc you can use to develop libsndfile applications.
%prep
%setup
%build
%configure
make
%install
if [ -d $RPM_BUILD_ROOT ]; then rm -rf $RPM_BUILD_ROOT; fi
mkdir -p $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%clean
if [ -d $RPM_BUILD_ROOT ]; then rm -rf $RPM_BUILD_ROOT; fi
%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README TODO doc
%{_libdir}/libsndfile.so.*
%{_bindir}/*
%{_mandir}/man1/*
%{_datadir}/octave/site/m/*
%{_defaultdocdir}/libsndfile1-dev/html/*
%files devel
%defattr(-,root,root)
%{_libdir}/libsndfile.a
%{_libdir}/libsndfile.la
%{_libdir}/libsndfile.so
%{_includedir}/sndfile.h
%{_libdir}/pkgconfig/sndfile.pc
%changelog
* Sun May 15 2005 Erik de Castro Lopo <erikd@mega-nerd.com>
- Add html files to the files section.
* Tue Sep 16 2003 Erik de Castro Lopo <erikd@mega-nerd.com>
- Apply corrections from Andrew Schultz.
* Mon Oct 21 2002 Erik de Castro Lopo <erikd@mega-nerd.com>
- Force installation of sndfile.pc file.
* Thu Jul 6 2000 Josh Green <jgreen@users.sourceforge.net>
- Created libsndfile.spec.in

6871
libs/libsndfile/ltmain.sh Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
## Process this file with automake to produce Makefile.in
man_MANS = sndfile-info.1 sndfile-play.1 sndfile-convert.1
EXTRA_DIST = sndfile-info.1 sndfile-play.1 sndfile-convert.1
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: a7e49b1a-d2f1-414d-aa5a-3a91ef566d9f

View File

@ -0,0 +1,397 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = man
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/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@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
man_MANS = sndfile-info.1 sndfile-play.1 sndfile-convert.1
EXTRA_DIST = sndfile-info.1 sndfile-play.1 sndfile-convert.1
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
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
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 clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
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 mostlyclean-libtool
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 clean-libtool \
distclean distclean-generic distclean-libtool 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 mostlyclean-libtool 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:

View File

@ -0,0 +1,28 @@
.TH SNDFILE-CONVERT 1 "October 09, 2002"
.SH NAME
sndfile-convert \- convert a sound files from one format to another
.SH SYNOPSIS
.B sndfile-convert
.RI "[encoding] input_file output_file"
.LP
.B sndfile-convert
.RI --help
.SH DESCRIPTION
sndfile-convert converts sound files from one format to another using
libsndfile (http://www.mega-nerd.com/libsndfile/) to read and write
the data.
.LP
The format of the output file is determined by the filename extension
of the output file.
.LP
The optional encoding parameter allows setting of the data encoding for
the output file. Run "sndfile-convert --help" for more information.
.SH AUTHOR
This manual page was written by Erik de Castro Lopo <erikd@mega-nerd.com>.
.\" Do not edit or modify anything in this comment block.
.\" The following line is a file identity tag for the GNU Arch
.\" revision control system.
.\" arch-tag: 23aa443e-f38d-488b-b7e3-290fc5c77d20

View File

@ -0,0 +1,22 @@
.TH SNDFILE-INFO 1 "July 28, 2002"
.SH NAME
sndfile-info \- display information about a sound file
.SH SYNOPSIS
.B sndfile-info
.RI file
.SH DESCRIPTION
sndfile-info will display basic information about a sound file such as
its format, its sample rate, and the number of channels. This information
is obtained using libsndfile (http://www.mega-nerd.com/libsndfile/).
.SH AUTHOR
This manual page was originally written by Joshua Haberman
<joshua@debian.org>, for the Debian GNU/Linux system (but may be used by
others). Further additions have been made by Erik de Castro Lopo
<erikd@mega-nerd.com>.
.\" Do not edit or modify anything in this comment block.
.\" The following line is a file identity tag for the GNU Arch
.\" revision control system.
.\" arch-tag: f9eca35e-5519-434d-bc55-fe845df977cd

View File

@ -0,0 +1,40 @@
.de EX
.ne 5
.if n .sp 1
.if t .sp .5
.nf
.in +.5i
..
.de EE
.fi
.in -.5i
.if n .sp 1
.if t .sp .5
..
.TH SNDFILE-PLAY 1 "July 28, 2002"
.SH NAME
sndfile-play \- play a sound file
.SH SYNOPSIS
.B sndfile-play
.RI file
.SH DESCRIPTION
sndfile-play plays the specified sound file using :
.EX
/dev/dsp on systems supporting OSS (including Linux)
/dev/audio on Sun Solaris
CoreAudio on Apple MacOSX
waveOut on Microsoft Win32
.EE
sndfile-play uses libsndfile (http://www.mega-nerd.com/libsndfile/)
to read the file.
.SH AUTHOR
This manual page was originally written by Joshua Haberman
<joshua@debian.org>, for the Debian GNU/Linux system (but may be used by
others). Further additions have been made by Erik de Castro Lopo
<erikd@mega-nerd.com>.
.\" Do not edit or modify anything in this comment block.
.\" The arch-tag line is a file identity tag for the GNU Arch
.\" revision control system.
.\" arch-tag: 5a0120d9-040c-464e-b01e-89dc2c2428c9

360
libs/libsndfile/missing Normal file
View File

@ -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:

View File

@ -0,0 +1,63 @@
#!/usr/bin/make -f
# The auto tools MUST be run in the following order:
#
# 1. aclocal
# 2. libtoolize (if you use libtool)
# 3. autoconf
# 4. autoheader (if you use autoheader)
# 5. automake (if you use automake)
#
# The following makefile runs these in the correct order according to their
# dependancies. It also makes up for Mac OSX's fucked-upped-ness.
ACLOCAL = aclocal
ifneq ($(shell uname -s), Darwin)
LIBTOOLIZE = libtoolize
else
# Fuck Apple! Why the hell did they rename libtoolize????
LIBTOOLIZE = glibtoolize
# Fink sucks as well, but this seems necessary.
ACLOCAL_INC = -I /sw/share/aclocal
endif
genfiles : config.status
(cd src && make genfiles)
(cd tests && make genfiles)
config.status: configure src/config.h.in Makefile.in src/Makefile.in tests/Makefile.in
./configure --enable-gcc-werror
configure: ltmain.sh
autoconf
Makefile.in: Makefile.am
automake --copy --add-missing
src/Makefile.in: src/Makefile.am
automake --copy --add-missing
tests/Makefile.in: tests/Makefile.am
automake --copy --add-missing
src/config.h.in: configure
autoheader
libtool ltmain.sh: aclocal.m4
$(LIBTOOLIZE) --copy --force
# Need to re-run aclocal whenever acinclude.m4 is modified.
aclocal.m4: acinclude.m4
$(ACLOCAL) $(ACLOCAL_INC)
clean:
rm -f libtool ltmain.sh aclocal.m4 Makefile.in src/config.h.in config.cache config.status
find . -name .deps -type d -exec rm -rf {} \;
# Do not edit or modify anything in this comment block.
# The arch-tag line is a file identity tag for the GNU Arch
# revision control system.
#
# arch-tag: 2b02bfd0-d5ed-489b-a554-2bf36903cca9

View File

@ -0,0 +1,18 @@
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = sndfile-regtest
noinst_HEADERS = regtest.h
SNDFILEDIR =../src
INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
sndfile_regtest_SOURCES = sndfile-regtest.c database.c checksum.c
sndfile_regtest_LDADD = $(SNDFILEDIR)/libsndfile.la $(SQLITE3_LIBS)
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: ac4a9626-49ce-4bb4-9fb6-e43de0a23432

View File

@ -0,0 +1,486 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
bin_PROGRAMS = sndfile-regtest$(EXEEXT)
subdir = regtest
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_sndfile_regtest_OBJECTS = sndfile-regtest.$(OBJEXT) \
database.$(OBJEXT) checksum.$(OBJEXT)
sndfile_regtest_OBJECTS = $(am_sndfile_regtest_OBJECTS)
am__DEPENDENCIES_1 =
sndfile_regtest_DEPENDENCIES = $(SNDFILEDIR)/libsndfile.la \
$(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(sndfile_regtest_SOURCES)
DIST_SOURCES = $(sndfile_regtest_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
noinst_HEADERS = regtest.h
SNDFILEDIR = ../src
INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS)
sndfile_regtest_SOURCES = sndfile-regtest.c database.c checksum.c
sndfile_regtest_LDADD = $(SNDFILEDIR)/libsndfile.la $(SQLITE3_LIBS)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu regtest/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu regtest/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 \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(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:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
sndfile-regtest$(EXEEXT): $(sndfile_regtest_OBJECTS) $(sndfile_regtest_DEPENDENCIES)
@rm -f sndfile-regtest$(EXEEXT)
$(LINK) $(sndfile_regtest_LDFLAGS) $(sndfile_regtest_OBJECTS) $(sndfile_regtest_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checksum.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/database.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-regtest.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) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
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) $(HEADERS)
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 clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool 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 \
mostlyclean-libtool
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 clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool 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 mostlyclean-libtool \
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:

View File

@ -0,0 +1,125 @@
/*
** Copyright (C) 2005 Erik de Castro Lopo
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
** A simple checksum for short, int and float data.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sndfile.h>
#include "float_cast.h"
#include "regtest.h"
#define BIG_PRIME 999983
#define ARRAY_LEN(x) ((int) (sizeof (x)) / (sizeof ((x) [0])))
static int short_checksum (SNDFILE * file, int start) ;
static int int_checksum (SNDFILE * file, int start) ;
static int float_checksum (SNDFILE * file, int start) ;
int
calc_checksum (SNDFILE * file, const SF_INFO * info)
{ int start ;
/* Seed the checksum with data from the SF_INFO struct. */
start = info->samplerate ;
start = start * BIG_PRIME + info->channels ;
start = start * BIG_PRIME + info->format ;
switch (info->format & SF_FORMAT_SUBMASK)
{ case SF_FORMAT_FLOAT :
case SF_FORMAT_DOUBLE :
return float_checksum (file, start) ;
case SF_FORMAT_PCM_24 :
case SF_FORMAT_PCM_32 :
return int_checksum (file, start) ;
default :
return short_checksum (file, start) ;
} ;
return 0 ;
} /* calc_checksum */
/*------------------------------------------------------------------------------
*/
static union
{ short s [1 << 16] ;
int i [1 << 15] ;
float f [1 << 15] ;
} data ;
static int
short_checksum (SNDFILE * file, int start)
{ int k, count ;
do
{ count = (int) sf_read_short (file, data.s, ARRAY_LEN (data.s)) ;
for (k = 0 ; k < count ; k++)
start = start * BIG_PRIME + data.s [k] ;
}
while (count > 0) ;
return start ;
} /* short_checksum */
static int
int_checksum (SNDFILE * file, int start)
{ int k, count ;
do
{ count = (int) sf_read_int (file, data.i, ARRAY_LEN (data.i)) ;
for (k = 0 ; k < count ; k++)
start = start * BIG_PRIME + data.i [k] ;
}
while (count > 0) ;
return start ;
} /* int_checksum */
static int
float_checksum (SNDFILE * file, int start)
{ int k, count ;
do
{ count = (int) sf_read_float (file, data.f, ARRAY_LEN (data.f)) ;
for (k = 0 ; k < count ; k++)
start = start * BIG_PRIME + lrintf (0x7FFFFFFF * data.f [k]) ;
}
while (count > 0) ;
return start ;
} /* float_checksum */
/*
** Do not edit or modify anything in this comment block.
** The following line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 6ae999d1-dd5a-4306-9e11-d4cfc9e8ae27
*/

View File

@ -0,0 +1,502 @@
/*
** Copyright (C) 2005 Erik de Castro Lopo
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sndfile.h>
#include "regtest.h"
#if HAVE_SQLITE3
#include <sqlite3.h>
typedef struct
{ sqlite3 *sql ;
int count ;
int ekey_max ;
/* Filename and pathname for file. */
char filename [256] ;
char pathname [512] ;
/* Storage for createding SQL commands. Must be larger than logbuf below. */
char cmdbuf [1 << 15] ;
/* Storage for log buffer retrieved from SNDFILE* .*/
char logbuf [1 << 14] ;
} REGTEST_DB ;
/* In checksum.c */
int calc_checksum (SNDFILE * file, const SF_INFO * info) ;
static void get_filename_pathname (REGTEST_DB * db, const char *filepath) ;
static void single_quote_replace (char * buf) ;
static int get_ekey_from_filename (REGTEST_DB * db, const char *filepath) ;
static int get_filename_pathname_by_ekey (REGTEST_DB * db, int ekey) ;
static int check_file_by_ekey (REGTEST_DB * db, int ekey) ;
static int count_callback (REGTEST_DB * db, int argc, char **argv, char **colname) ;
static int ekey_max_callback (REGTEST_DB * db, int argc, char **argv, char **colname) ;
static int callback (void *unused, int argc, char **argv, char **colname) ;
REG_DB *
db_open (const char * db_name)
{ REGTEST_DB * db ;
int err ;
if ((db = malloc (sizeof (REGTEST_DB))) == NULL)
{ perror ("malloc") ;
exit (1) ;
} ;
if ((err = sqlite3_open (db_name, &(db->sql))) != 0)
{ printf ("Can't open database: %s\n", sqlite3_errmsg (db->sql)) ;
sqlite3_close (db->sql) ;
free (db) ;
exit (1) ;
} ;
return (REG_DB *) db ;
} /* db_open */
int
db_create (const char * db_name)
{ REGTEST_DB * db ;
const char *cmd ;
char * errmsg = NULL ;
int err ;
db = (REGTEST_DB *) db_open (db_name) ;
cmd = "create table sndfile (ekey INTEGER PRIMARY KEY,"
"fname VARCHAR(1),"
"fpath VARCHAR(1),"
"srate INTEGER,"
"frames VARCHAR(1),"
"channels INTEGER,"
"format VARCHAR(1),"
"checksum VARCHAR(1),"
"logbuf VARCHAR(1)"
");" ;
err = sqlite3_exec (db->sql, cmd, callback, 0, &errmsg) ;
if (err != SQLITE_OK)
printf ("Line %d : SQL error: %s\n", __LINE__, errmsg) ;
sqlite3_close (db->sql) ;
free (db) ;
return 0 ;
} /* db_create */
int
db_close (REG_DB * db_handle)
{ REGTEST_DB * db ;
db = (REGTEST_DB *) db_handle ;
sqlite3_close (db->sql) ;
free (db) ;
return 0 ;
} /* db_close */
/*==============================================================================
*/
int
db_file_exists (REG_DB * db_handle, const char * filename)
{ REGTEST_DB * db ;
const char * cptr ;
char * errmsg ;
int err ;
db = (REGTEST_DB *) db_handle ;
if ((cptr = strrchr (filename, '/')) != NULL)
filename = cptr + 1 ;
snprintf (db->cmdbuf, sizeof (db->cmdbuf), "select fname from sndfile where fname='%s'", filename) ;
db->count = 0 ;
err = sqlite3_exec (db->sql, db->cmdbuf, (sqlite3_callback) count_callback, db, &errmsg) ;
if (db->count == 1)
return 1 ;
return 0 ;
} /* db_file_exists */
int
db_add_file (REG_DB * db_handle, const char * filepath)
{ REGTEST_DB * db ;
SNDFILE * sndfile ;
SF_INFO info ;
char * errmsg ;
int err, checksum ;
db = (REGTEST_DB *) db_handle ;
get_filename_pathname (db, filepath) ;
if (db_file_exists (db_handle, filepath))
{ printf (" %s : already in database\n", db->filename) ;
return 0 ;
} ;
memset (&info, 0, sizeof (info)) ;
sndfile = sf_open (db->pathname, SFM_READ, &info) ;
sf_command (sndfile, SFC_GET_LOG_INFO, db->logbuf, sizeof (db->logbuf)) ;
checksum = (sndfile == NULL) ? 0 : calc_checksum (sndfile, &info) ;
sf_close (sndfile) ;
if (sndfile == NULL)
{ printf (" %s : could not open : %s\n", db->filename, sf_strerror (NULL)) ;
puts (db->logbuf) ;
return 1 ;
} ;
single_quote_replace (db->logbuf) ;
snprintf (db->cmdbuf, sizeof (db->cmdbuf), "insert into sndfile "
"(fname, fpath, srate, frames, channels, format, checksum, logbuf) values"
"('%s','%s',%d,'%lld', %d, '0x%08x', '0x%08x', '%s');",
db->filename, db->pathname, info.samplerate, info.frames, info.channels, info.format, checksum, db->logbuf) ;
if (strlen (db->cmdbuf) >= sizeof (db->cmdbuf) - 1)
{ printf ("strlen (db->cmdbuf) too long.\n") ;
exit (1) ;
} ;
err = sqlite3_exec (db->sql, db->cmdbuf, callback, 0, &errmsg) ;
if (err != SQLITE_OK)
{ printf ("Line %d : SQL error: %s\n", __LINE__, errmsg) ;
puts (db->cmdbuf) ;
} ;
return 0 ;
} /* db_add_file */
int
db_check_file (REG_DB * db_handle, const char * filepath)
{ REGTEST_DB * db ;
int ekey ;
if (db_file_exists (db_handle, filepath) == 0)
{ printf ("\nFile not in database.\n\n") ;
exit (0) ;
} ;
db = (REGTEST_DB *) db_handle ;
ekey = get_ekey_from_filename (db, filepath) ;
return check_file_by_ekey (db, ekey) ;
} /* db_check_file */
/*==============================================================================
*/
int
db_check_all (REG_DB * db_handle)
{ REGTEST_DB * db ;
char * errmsg ;
int err, ekey ;
db = (REGTEST_DB *) db_handle ;
db->ekey_max = 0 ;
snprintf (db->cmdbuf, sizeof (db->cmdbuf), "select ekey from sndfile") ;
err = sqlite3_exec (db->sql, db->cmdbuf, (sqlite3_callback) ekey_max_callback, db, &errmsg) ;
if (err != SQLITE_OK)
{ printf ("Line %d : SQL error: %s\n", __LINE__, errmsg) ;
puts (db->cmdbuf) ;
} ;
for (ekey = 1 ; ekey <= db->ekey_max ; ekey++)
if (get_filename_pathname_by_ekey (db, ekey) != 0)
check_file_by_ekey (db, ekey) ;
return 0 ;
} /* db_check_all */
int
db_list_all (REG_DB * db_handle)
{
printf ("%s : %p\n", __func__, db_handle) ;
return 0 ;
} /* db_list_all */
int
db_del_entry (REG_DB * db_handle, const char * entry)
{
printf ("%s : %p %s\n", __func__, db_handle, entry) ;
return 0 ;
} /* db_del_entry */
/*==============================================================================
*/
static int
get_ekey_from_filename (REGTEST_DB * db, const char *filepath)
{ char * errmsg, **result ;
int err, ekey = 0, rows, cols ;
get_filename_pathname (db, filepath) ;
snprintf (db->cmdbuf, sizeof (db->cmdbuf), "select ekey from sndfile where fname='%s'", db->filename) ;
err = sqlite3_get_table (db->sql, db->cmdbuf, &result, &rows, &cols, &errmsg) ;
if (err != SQLITE_OK)
{ printf ("Line %d : SQL error: %s\n", __LINE__, errmsg) ;
puts (db->cmdbuf) ;
} ;
if (cols != 1 || rows != 1)
{ printf ("Bad juju!! rows = %d cols = %d\n", rows, cols) ;
exit (1) ;
} ;
ekey = strtol (result [1], NULL, 10) ;
sqlite3_free_table (result) ;
return ekey ;
} /* get_ekey_from_filename */
static int
get_filename_pathname_by_ekey (REGTEST_DB * db, int ekey)
{ char *errmsg, **result ;
int err, rows, cols ;
snprintf (db->cmdbuf, sizeof (db->cmdbuf), "select fname,fpath from sndfile where ekey='%d'", ekey) ;
err = sqlite3_get_table (db->sql, db->cmdbuf, &result, &rows, &cols, &errmsg) ;
if (err != SQLITE_OK)
{ printf ("Line %d : SQL error: %s\n", __LINE__, errmsg) ;
puts (db->cmdbuf) ;
return 0 ;
} ;
if (cols != 2 || rows != 1)
{ printf ("\nError (%s %d) : rows = %d cols = %d\n", __func__, __LINE__, rows, cols) ;
exit (1) ;
} ;
strncpy (db->filename, result [2], sizeof (db->filename)) ;
strncpy (db->pathname, result [3], sizeof (db->pathname)) ;
sqlite3_free_table (result) ;
return 1 ;
} /* get_filename_pathname_by_ekey */
static int
check_file_by_ekey (REGTEST_DB * db, int ekey)
{ SNDFILE * sndfile ;
SF_INFO info ;
char * errmsg, **result ;
int err, k, rows, cols, checksum ;
printf (" %s : ", db->filename) ;
fflush (stdout) ;
memset (&info, 0, sizeof (info)) ;
sndfile = sf_open (db->pathname, SFM_READ, &info) ;
sf_command (sndfile, SFC_GET_LOG_INFO, db->logbuf, sizeof (db->logbuf)) ;
checksum = (sndfile == NULL) ? 0 : calc_checksum (sndfile, &info) ;
sf_close (sndfile) ;
if (sndfile == NULL)
{ printf ("\n\nError : Could not open '%s' : %s\n", db->pathname, sf_strerror (NULL)) ;
puts (db->logbuf) ;
exit (1) ;
} ;
single_quote_replace (db->logbuf) ;
snprintf (db->cmdbuf, sizeof (db->cmdbuf), "select fname,srate,frames,channels,format,"
"checksum,logbuf from sndfile where ekey='%d'", ekey) ;
err = sqlite3_get_table (db->sql, db->cmdbuf, &result, &rows, &cols, &errmsg) ;
if (err != SQLITE_OK)
{ printf ("Line %d : SQL error: %s\n", __LINE__, errmsg) ;
puts (db->cmdbuf) ;
} ;
for (k = 0 ; k < cols ; k++)
{ if (strcmp (result [k], "fname") == 0)
{ if (strcmp (result [k + cols], db->filename) == 0)
continue ;
printf ("\n\nError : fname doesn't match : %s != %s\n", result [k + cols], db->filename) ;
} ;
if (strcmp (result [k], "srate") == 0)
{ if (strtol (result [k + cols], NULL, 10) == info.samplerate)
continue ;
printf ("\n\nError : srate doesn't match : %s == %d\n", result [k + cols], info.samplerate) ;
} ;
if (strcmp (result [k], "frames") == 0)
{ if (strtoll (result [k + cols], NULL, 10) == info.frames)
continue ;
printf ("\n\nError : frames doesn't match : %s == %lld\n", result [k + cols], info.frames) ;
} ;
if (strcmp (result [k], "channels") == 0)
{ if (strtol (result [k + cols], NULL, 10) == info.channels)
continue ;
printf ("\n\nError : channels doesn't match : %s == %d\n", result [k + cols], info.channels) ;
} ;
if (strcmp (result [k], "format") == 0)
{ if (strtol (result [k + cols], NULL, 16) == info.format)
continue ;
printf ("\n\nError : format doesn't match : %s == 0x%08x\n", result [k + cols], info.format) ;
} ;
if (strcmp (result [k], "checksum") == 0)
{ int db_val = (int) strtoll (result [k + cols], NULL, 16) ;
if (db_val == checksum)
continue ;
printf ("\n\nError : checksum doesn't match : 0x%08x == 0x%08x\n", db_val, checksum) ;
} ;
if (strcmp (result [k], "logbuf") == 0)
continue ;
printf ("\nHere is the old logubuffer :\n\n%s\n\nand the new :\n\n%s\n\n", result [2 * cols - 1], db->logbuf) ;
exit (1) ;
} ;
sqlite3_free_table (result) ;
puts ("ok") ;
return 0 ;
} /* check_file_by_ekey */
/*==============================================================================
*/
static void
get_filename_pathname (REGTEST_DB * db, const char *filepath)
{ const char * cptr ;
if (filepath [0] != '/')
{ memset (db->pathname, 0, sizeof (db->pathname)) ;
if (getcwd (db->pathname, sizeof (db->pathname)) == NULL)
{ perror ("\ngetcwd failed") ;
exit (1) ;
} ;
db->pathname [strlen (db->pathname)] = '/' ;
strncat (db->pathname, filepath, sizeof (db->pathname)) ;
}
else
strncpy (db->pathname, filepath, sizeof (db->pathname)) ;
if ((cptr = strrchr (db->pathname, '/')) == NULL)
{ printf ("\nError : bad pathname %s\n", filepath) ;
exit (1) ;
} ;
strncpy (db->filename, cptr + 1, sizeof (db->filename)) ;
} /* get filename_pathname */
static void
single_quote_replace (char * buf)
{ while ((buf = strchr (buf, '\'')) != 0)
buf [0] = '"' ;
} /* single_quote_replace */
static int
count_callback (REGTEST_DB * db, int argc, char **argv, char **colname)
{ db->count ++ ;
argc = 0 ;
argv = NULL ;
colname = NULL ;
return 0 ;
} /* count_callback */
static int
ekey_max_callback (REGTEST_DB * db, int argc, char **argv, char **unused)
{ int ekey ;
argc = 0 ;
unused = NULL ;
ekey = strtol (argv [0], NULL, 10) ;
if (ekey > db->ekey_max)
db->ekey_max = ekey ;
return 0 ;
} /* ekey_max_callback */
static int
callback (void *unused, int argc, char **argv, char **colname)
{ int k ;
unused = NULL ;
for (k = 0 ; k < argc ; k++)
printf ("%s = %s\n", colname [k], argv [k] ? argv [k] : "NULL") ;
printf ("\n") ;
return 0 ;
} /* callback */
#else
int dummy (void) ;
int
dummy (void)
{ /*
** Empty dummy fnction so tha compiler doesn't winge about an
** empty file.
*/
return 0 ;
} /* dummy */
#endif
/*
** Do not edit or modify anything in this comment block.
** The following line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: c6bcb7cb-0d9e-47b6-a89a-66304df4d462
*/

View File

@ -0,0 +1,45 @@
/*
** Copyright (C) 2005 Erik de Castro Lopo
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
typedef struct REG_DB_tag REG_DB ;
/* In database.c */
REG_DB * db_open (const char * db_name) ;
int db_create (const char * dbname) ;
int db_close (REG_DB * db_handle) ;
int db_file_exists (REG_DB * db_handle, const char * filename) ;
int db_add_file (REG_DB * db_handle, const char * filename) ;
int db_check_file (REG_DB * db_handle, const char * filename) ;
int db_list_all (REG_DB * db_handle) ;
int db_check_all (REG_DB * db_handle) ;
int db_del_entry (REG_DB * db_handle, const char * entry) ;
/* In checksum.c */
int calc_checksum (SNDFILE * file, const SF_INFO * info) ;
/*
** Do not edit or modify anything in this comment block.
** The following line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 80138e38-f373-48d3-8152-7f7882a62cd7
*/

View File

@ -0,0 +1,128 @@
/*
** Copyright (C) 2005 Erik de Castro Lopo
**
** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sndfile.h>
#if HAVE_SQLITE3
#include "regtest.h"
enum
{ OPT_ADD_FILE = 0x0100,
OPT_CREATE_DB = 0x0200,
OPT_DEL_ENTRY = 0x0400,
OPT_LIST_ALL = 0x0800,
OPT_TEST_ALL = 0x1000,
OPT_VERBOSE = 0x2000
} ;
static void print_libsndfile_version (void) ;
int
main (int argc, char * argv [])
{ const char *db_name = "./.sndfile-regtest.db" ;
REG_DB *reg_db ;
int k, retval ;
if (argc < 2)
{ printf ("\nUsage message goes here.\n\n") ;
exit (0) ;
} ;
if (argc == 2 && strcmp (argv [1], "--create-db") == 0)
return db_create (db_name) ;
reg_db = db_open (db_name) ;
if (argc == 2)
{ if (strcmp (argv [1], "--list-all") == 0)
return db_list_all (reg_db) ;
if (strcmp (argv [1], "--check-all") == 0)
{ print_libsndfile_version () ;
retval = db_check_all (reg_db) ;
puts ("\nDone.\n") ;
return retval ;
} ;
} ;
if (argc == 3 && strcmp (argv [1], "--del-entry") == 0)
{ db_del_entry (reg_db, argv [2]) ;
db_close (reg_db) ;
return 0 ;
} ;
if (strcmp (argv [1], "--check-file") == 0)
{ print_libsndfile_version () ;
for (k = 2 ; k < argc ; k++)
db_check_file (reg_db, argv [k]) ;
db_close (reg_db) ;
return 0 ;
} ;
if (strcmp (argv [1], "--add-file") == 0)
{ print_libsndfile_version () ;
for (k = 2 ; k < argc ; k++)
db_add_file (reg_db, argv [k]) ;
db_close (reg_db) ;
return 0 ;
} ;
printf ("\nError : unhandled command line args :") ;
for (k = 1 ; k < argc ; k++)
printf (" %s", argv [k]) ;
puts ("\n") ;
return 1 ;
} /* main */
static void
print_libsndfile_version (void)
{ char version [64] ;
sf_command (NULL, SFC_GET_LIB_VERSION, version, sizeof (version)) ;
printf ("\nsndfile-regtest : using %s\n\n", version) ;
} /* print_lib_version */
#else
int
main (void)
{
puts ("\nThis program was not compiled with libsqlite3 and hence doesn't work.\n") ;
return 0 ;
} /* main */
#endif
/*
** Do not edit or modify anything in this comment block.
** The following line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 7f318f08-9bfa-4249-856d-fe994819bdce
*/

View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: sndfile
Description: A library for reading and writing audio files
Requires:
Version: @VERSION@
Libs: -L${libdir} -lsndfile
Cflags: -I${includedir}

View File

@ -0,0 +1,50 @@
2001-06-05 Erik de Castro Lopo <erikd@mega-nerd.com>
* g72x.c
Added {} in function update () to prevent 'ambiguous else' warning messages.
2000-07-14 Erik de Castro Lopo <erikd@mega-nerd.com>
* g72x.c
Modified g72x_init_state () to fit in with the new structure of the code.
Implemented g72x_encode_block () and g72x_decode_block ().
2000-07-12 Erik de Castro Lopo <erikd@mega-nerd.com>
* g72x.h
Moved nearly all definitions and function prototypes from this file have been
moved to private.h.
Added an enum defining the 4 different G72x ADPCM codecs.
Added new function prototypes to define a cleaner interface to the encoder
and decoder. This new interface also allows samples to be processed in blocks
rather than on a sample by sample basis like the original code.
* private.h
Added prototypes moved from g72x.h.
Changed struct g72x_state to a typedef struct { .. } G72x_PRIVATE.
Added fields to G72x_PRIVATE required for working on blocks of samples.
2000-06-07 Erik de Castro Lopo <erikd@mega-nerd.com>
* g72x.c
Fixed all compiler warnings.
Removed functions tandem_adjust() which is not required by libsndfile.
* g721.c
Fixed all compiler warnings.
Removed functions tandem_adjust_alaw() and tandem_adjust_ulaw () which are not
required by libsndfile.
Removed second parameter to g721_encoder () which is not required.
* g72x.h
Removed in_coding and out_coding parameters from all functions. These allowed
g72x encoding/decoding to/from A-law or u-law and are not required by libsndfile.
Removed unneeded defines for A-law, u-law and linear encoding.
* g723_16.c
Removed second parameter (in_coding) for g723_16_encoder().
Removed second parameter (out_coding) for g723_16_decoder().
* private.h
New file containing prototypes and tyepdefs private to G72x code.

View File

@ -0,0 +1,28 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = README README.original ChangeLog
noinst_HEADERS = g72x.h g72x_priv.h
noinst_LTLIBRARIES = libg72x.la
noinst_PROGRAMS = g72x_test
CFILES = g72x.c g721.c g723_16.c g723_24.c g723_40.c
libg72x_la_SOURCES = $(CFILES) $(noinst_HEADERS)
g72x_test_SOURCES = g72x_test.c
g72x_test_LDADD = ./libg72x.la -lm
check: g72x_test
./g72x_test all
# Disable autoheader.
AUTOHEADER=echo
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: d417a8e8-da7f-423d-884d-f03c93379348

View File

@ -0,0 +1,486 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
noinst_PROGRAMS = g72x_test$(EXEEXT)
subdir = src/G72x
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libg72x_la_LIBADD =
am__objects_1 = g72x.lo g721.lo g723_16.lo g723_24.lo g723_40.lo
am__objects_2 =
am_libg72x_la_OBJECTS = $(am__objects_1) $(am__objects_2)
libg72x_la_OBJECTS = $(am_libg72x_la_OBJECTS)
PROGRAMS = $(noinst_PROGRAMS)
am_g72x_test_OBJECTS = g72x_test.$(OBJEXT)
g72x_test_OBJECTS = $(am_g72x_test_OBJECTS)
g72x_test_DEPENDENCIES = ./libg72x.la
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libg72x_la_SOURCES) $(g72x_test_SOURCES)
DIST_SOURCES = $(libg72x_la_SOURCES) $(g72x_test_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
# Disable autoheader.
AUTOHEADER = echo
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
EXTRA_DIST = README README.original ChangeLog
noinst_HEADERS = g72x.h g72x_priv.h
noinst_LTLIBRARIES = libg72x.la
CFILES = g72x.c g721.c g723_16.c g723_24.c g723_40.c
libg72x_la_SOURCES = $(CFILES) $(noinst_HEADERS)
g72x_test_SOURCES = g72x_test.c
g72x_test_LDADD = ./libg72x.la -lm
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/G72x/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/G72x/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
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libg72x.la: $(libg72x_la_OBJECTS) $(libg72x_la_DEPENDENCIES)
$(LINK) $(libg72x_la_LDFLAGS) $(libg72x_la_OBJECTS) $(libg72x_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
g72x_test$(EXEEXT): $(g72x_test_OBJECTS) $(g72x_test_DEPENDENCIES)
@rm -f g72x_test$(EXEEXT)
$(LINK) $(g72x_test_LDFLAGS) $(g72x_test_OBJECTS) $(g72x_test_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g721.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g723_16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g723_24.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g723_40.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g72x.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g72x_test.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) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
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 $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(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 clean-libtool clean-noinstLTLIBRARIES \
clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
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 \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES clean-noinstPROGRAMS \
ctags distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-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 mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am
check: g72x_test
./g72x_test all
# 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:

View File

View File

@ -0,0 +1,94 @@
The files in this directory comprise ANSI-C language reference implementations
of the CCITT (International Telegraph and Telephone Consultative Committee)
G.711, G.721 and G.723 voice compressions. They have been tested on Sun
SPARCstations and passed 82 out of 84 test vectors published by CCITT
(Dec. 20, 1988) for G.721 and G.723. [The two remaining test vectors,
which the G.721 decoder implementation for u-law samples did not pass,
may be in error because they are identical to two other vectors for G.723_40.]
This source code is released by Sun Microsystems, Inc. to the public domain.
Please give your acknowledgement in product literature if this code is used
in your product implementation.
Sun Microsystems supports some CCITT audio formats in Solaris 2.0 system
software. However, Sun's implementations have been optimized for higher
performance on SPARCstations.
The source files for CCITT conversion routines in this directory are:
g72x.h header file for g721.c, g723_24.c and g723_40.c
g711.c CCITT G.711 u-law and A-law compression
g72x.c common denominator of G.721 and G.723 ADPCM codes
g721.c CCITT G.721 32Kbps ADPCM coder (with g72x.c)
g723_24.c CCITT G.723 24Kbps ADPCM coder (with g72x.c)
g723_40.c CCITT G.723 40Kbps ADPCM coder (with g72x.c)
Simple conversions between u-law, A-law, and 16-bit linear PCM are invoked
as follows:
unsigned char ucode, acode;
short pcm_val;
ucode = linear2ulaw(pcm_val);
ucode = alaw2ulaw(acode);
acode = linear2alaw(pcm_val);
acode = ulaw2alaw(ucode);
pcm_val = ulaw2linear(ucode);
pcm_val = alaw2linear(acode);
The other CCITT compression routines are invoked as follows:
#include "g72x.h"
struct g72x_state state;
int sample, code;
g72x_init_state(&state);
code = {g721,g723_24,g723_40}_encoder(sample, coding, &state);
sample = {g721,g723_24,g723_40}_decoder(code, coding, &state);
where
coding = AUDIO_ENCODING_ULAW for 8-bit u-law samples
AUDIO_ENCODING_ALAW for 8-bit A-law samples
AUDIO_ENCODING_LINEAR for 16-bit linear PCM samples
This directory also includes the following sample programs:
encode.c CCITT ADPCM encoder
decode.c CCITT ADPCM decoder
Makefile makefile for the sample programs
The sample programs contain examples of how to call the various compression
routines and pack/unpack the bits. The sample programs read byte streams from
stdin and write to stdout. The input/output data is raw data (no file header
or other identifying information is embedded). The sample programs are
invoked as follows:
encode [-3|4|5] [-a|u|l] <infile >outfile
decode [-3|4|5] [-a|u|l] <infile >outfile
where:
-3 encode to (decode from) G.723 24kbps (3-bit) data
-4 encode to (decode from) G.721 32kbps (4-bit) data [the default]
-5 encode to (decode from) G.723 40kbps (5-bit) data
-a encode from (decode to) A-law data
-u encode from (decode to) u-law data [the default]
-l encode from (decode to) 16-bit linear data
Examples:
# Read 16-bit linear and output G.721
encode -4 -l <pcmfile >g721file
# Read 40Kbps G.723 and output A-law
decode -5 -a <g723file >alawfile
# Compress and then decompress u-law data using 24Kbps G.723
encode -3 <ulawin | deoced -3 >ulawout

View File

@ -0,0 +1,162 @@
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* g721.c
*
* Description:
*
* g721_encoder(), g721_decoder()
*
* These routines comprise an implementation of the CCITT G.721 ADPCM
* coding algorithm. Essentially, this implementation is identical to
* the bit level description except for a few deviations which
* take advantage of work station attributes, such as hardware 2's
* complement arithmetic and large memory. Specifically, certain time
* consuming operations such as multiplications are replaced
* with lookup tables and software 2's complement operations are
* replaced with hardware 2's complement.
*
* The deviation from the bit level specification (lookup tables)
* preserves the bit level performance specifications.
*
* As outlined in the G.721 Recommendation, the algorithm is broken
* down into modules. Each section of code below is preceded by
* the name of the module which it is implementing.
*
*/
#include "g72x.h"
#include "g72x_priv.h"
static short qtab_721[7] = {-124, 80, 178, 246, 300, 349, 400};
/*
* Maps G.721 code word to reconstructed scale factor normalized log
* magnitude values.
*/
static short _dqlntab[16] = {-2048, 4, 135, 213, 273, 323, 373, 425,
425, 373, 323, 273, 213, 135, 4, -2048};
/* Maps G.721 code word to log of scale factor multiplier. */
static short _witab[16] = {-12, 18, 41, 64, 112, 198, 355, 1122,
1122, 355, 198, 112, 64, 41, 18, -12};
/*
* Maps G.721 code words to a set of values whose long and short
* term averages are computed and then compared to give an indication
* how stationary (steady state) the signal is.
*/
static short _fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00,
0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0};
/*
* g721_encoder()
*
* Encodes the input vale of linear PCM, A-law or u-law data sl and returns
* the resulting code. -1 is returned for unknown input coding value.
*/
int
g721_encoder(
int sl,
G72x_STATE *state_ptr)
{
short sezi, se, sez; /* ACCUM */
short d; /* SUBTA */
short sr; /* ADDB */
short y; /* MIX */
short dqsez; /* ADDC */
short dq, i;
/* linearize input sample to 14-bit PCM */
sl >>= 2; /* 14-bit dynamic range */
sezi = predictor_zero(state_ptr);
sez = sezi >> 1;
se = (sezi + predictor_pole(state_ptr)) >> 1; /* estimated signal */
d = sl - se; /* estimation difference */
/* quantize the prediction difference */
y = step_size(state_ptr); /* quantizer step size */
i = quantize(d, y, qtab_721, 7); /* i = ADPCM code */
dq = reconstruct(i & 8, _dqlntab[i], y); /* quantized est diff */
sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconst. signal */
dqsez = sr + sez - se; /* pole prediction diff. */
update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr);
return (i);
}
/*
* g721_decoder()
*
* Description:
*
* Decodes a 4-bit code of G.721 encoded data of i and
* returns the resulting linear PCM, A-law or u-law value.
* return -1 for unknown out_coding value.
*/
int
g721_decoder(
int i,
G72x_STATE *state_ptr)
{
short sezi, sei, sez, se; /* ACCUM */
short y; /* MIX */
short sr; /* ADDB */
short dq;
short dqsez;
i &= 0x0f; /* mask to get proper bits */
sezi = predictor_zero(state_ptr);
sez = sezi >> 1;
sei = sezi + predictor_pole(state_ptr);
se = sei >> 1; /* se = estimated signal */
y = step_size(state_ptr); /* dynamic quantizer step size */
dq = reconstruct(i & 0x08, _dqlntab[i], y); /* quantized diff. */
sr = (dq < 0) ? (se - (dq & 0x3FFF)) : se + dq; /* reconst. signal */
dqsez = sr - se + sez; /* pole prediction diff. */
update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr);
/* sr was 14-bit dynamic range */
return (sr << 2);
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 101b6e25-457d-490a-99ae-e2e74a26ea24
*/

View File

@ -0,0 +1,169 @@
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/* 16kbps version created, used 24kbps code and changing as little as possible.
* G.726 specs are available from ITU's gopher or WWW site (http://www.itu.ch)
* If any errors are found, please contact me at mrand@tamu.edu
* -Marc Randolph
*/
/*
* g723_16.c
*
* Description:
*
* g723_16_encoder(), g723_16_decoder()
*
* These routines comprise an implementation of the CCITT G.726 16 Kbps
* ADPCM coding algorithm. Essentially, this implementation is identical to
* the bit level description except for a few deviations which take advantage
* of workstation attributes, such as hardware 2's complement arithmetic.
*
*/
#include "g72x.h"
#include "g72x_priv.h"
/*
* Maps G.723_16 code word to reconstructed scale factor normalized log
* magnitude values. Comes from Table 11/G.726
*/
static short _dqlntab[4] = { 116, 365, 365, 116};
/* Maps G.723_16 code word to log of scale factor multiplier.
*
* _witab[4] is actually {-22 , 439, 439, -22}, but FILTD wants it
* as WI << 5 (multiplied by 32), so we'll do that here
*/
static short _witab[4] = {-704, 14048, 14048, -704};
/*
* Maps G.723_16 code words to a set of values whose long and short
* term averages are computed and then compared to give an indication
* how stationary (steady state) the signal is.
*/
/* Comes from FUNCTF */
static short _fitab[4] = {0, 0xE00, 0xE00, 0};
/* Comes from quantizer decision level tables (Table 7/G.726)
*/
static short qtab_723_16[1] = {261};
/*
* g723_16_encoder()
*
* Encodes a linear PCM, A-law or u-law input sample and returns its 2-bit code.
* Returns -1 if invalid input coding value.
*/
int
g723_16_encoder(
int sl,
G72x_STATE *state_ptr)
{
short sei, sezi, se, sez; /* ACCUM */
short d; /* SUBTA */
short y; /* MIX */
short sr; /* ADDB */
short dqsez; /* ADDC */
short dq, i;
/* linearize input sample to 14-bit PCM */
sl >>= 2; /* sl of 14-bit dynamic range */
sezi = predictor_zero(state_ptr);
sez = sezi >> 1;
sei = sezi + predictor_pole(state_ptr);
se = sei >> 1; /* se = estimated signal */
d = sl - se; /* d = estimation diff. */
/* quantize prediction difference d */
y = step_size(state_ptr); /* quantizer step size */
i = quantize(d, y, qtab_723_16, 1); /* i = ADPCM code */
/* Since quantize() only produces a three level output
* (1, 2, or 3), we must create the fourth one on our own
*/
if (i == 3) /* i code for the zero region */
if ((d & 0x8000) == 0) /* If d > 0, i=3 isn't right... */
i = 0;
dq = reconstruct(i & 2, _dqlntab[i], y); /* quantized diff. */
sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */
dqsez = sr + sez - se; /* pole prediction diff. */
update(2, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
return (i);
}
/*
* g723_16_decoder()
*
* Decodes a 2-bit CCITT G.723_16 ADPCM code and returns
* the resulting 16-bit linear PCM, A-law or u-law sample value.
* -1 is returned if the output coding is unknown.
*/
int
g723_16_decoder(
int i,
G72x_STATE *state_ptr)
{
short sezi, sei, sez, se; /* ACCUM */
short y; /* MIX */
short sr; /* ADDB */
short dq;
short dqsez;
i &= 0x03; /* mask to get proper bits */
sezi = predictor_zero(state_ptr);
sez = sezi >> 1;
sei = sezi + predictor_pole(state_ptr);
se = sei >> 1; /* se = estimated signal */
y = step_size(state_ptr); /* adaptive quantizer step size */
dq = reconstruct(i & 0x02, _dqlntab[i], y); /* unquantize pred diff */
sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */
dqsez = sr - se + sez; /* pole prediction diff. */
update(2, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
/* sr was of 14-bit dynamic range */
return (sr << 2);
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: ae265466-c3fc-4f83-bb32-edae488a5ca5
*/

View File

@ -0,0 +1,146 @@
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* g723_24.c
*
* Description:
*
* g723_24_encoder(), g723_24_decoder()
*
* These routines comprise an implementation of the CCITT G.723 24 Kbps
* ADPCM coding algorithm. Essentially, this implementation is identical to
* the bit level description except for a few deviations which take advantage
* of workstation attributes, such as hardware 2's complement arithmetic.
*
*/
#include "g72x.h"
#include "g72x_priv.h"
/*
* Maps G.723_24 code word to reconstructed scale factor normalized log
* magnitude values.
*/
static short _dqlntab[8] = {-2048, 135, 273, 373, 373, 273, 135, -2048};
/* Maps G.723_24 code word to log of scale factor multiplier. */
static short _witab[8] = {-128, 960, 4384, 18624, 18624, 4384, 960, -128};
/*
* Maps G.723_24 code words to a set of values whose long and short
* term averages are computed and then compared to give an indication
* how stationary (steady state) the signal is.
*/
static short _fitab[8] = {0, 0x200, 0x400, 0xE00, 0xE00, 0x400, 0x200, 0};
static short qtab_723_24[3] = {8, 218, 331};
/*
* g723_24_encoder()
*
* Encodes a linear PCM, A-law or u-law input sample and returns its 3-bit code.
* Returns -1 if invalid input coding value.
*/
int
g723_24_encoder(
int sl,
G72x_STATE *state_ptr)
{
short sei, sezi, se, sez; /* ACCUM */
short d; /* SUBTA */
short y; /* MIX */
short sr; /* ADDB */
short dqsez; /* ADDC */
short dq, i;
/* linearize input sample to 14-bit PCM */
sl >>= 2; /* sl of 14-bit dynamic range */
sezi = predictor_zero(state_ptr);
sez = sezi >> 1;
sei = sezi + predictor_pole(state_ptr);
se = sei >> 1; /* se = estimated signal */
d = sl - se; /* d = estimation diff. */
/* quantize prediction difference d */
y = step_size(state_ptr); /* quantizer step size */
i = quantize(d, y, qtab_723_24, 3); /* i = ADPCM code */
dq = reconstruct(i & 4, _dqlntab[i], y); /* quantized diff. */
sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */
dqsez = sr + sez - se; /* pole prediction diff. */
update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
return (i);
}
/*
* g723_24_decoder()
*
* Decodes a 3-bit CCITT G.723_24 ADPCM code and returns
* the resulting 16-bit linear PCM, A-law or u-law sample value.
* -1 is returned if the output coding is unknown.
*/
int
g723_24_decoder(
int i,
G72x_STATE *state_ptr)
{
short sezi, sei, sez, se; /* ACCUM */
short y; /* MIX */
short sr; /* ADDB */
short dq;
short dqsez;
i &= 0x07; /* mask to get proper bits */
sezi = predictor_zero(state_ptr);
sez = sezi >> 1;
sei = sezi + predictor_pole(state_ptr);
se = sei >> 1; /* se = estimated signal */
y = step_size(state_ptr); /* adaptive quantizer step size */
dq = reconstruct(i & 0x04, _dqlntab[i], y); /* unquantize pred diff */
sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */
dqsez = sr - se + sez; /* pole prediction diff. */
update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
return (sr << 2); /* sr was of 14-bit dynamic range */
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 75389236-650b-4427-98f3-0df6e8fb24bc
*/

View File

@ -0,0 +1,160 @@
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* g723_40.c
*
* Description:
*
* g723_40_encoder(), g723_40_decoder()
*
* These routines comprise an implementation of the CCITT G.723 40Kbps
* ADPCM coding algorithm. Essentially, this implementation is identical to
* the bit level description except for a few deviations which
* take advantage of workstation attributes, such as hardware 2's
* complement arithmetic.
*
* The deviation from the bit level specification (lookup tables),
* preserves the bit level performance specifications.
*
* As outlined in the G.723 Recommendation, the algorithm is broken
* down into modules. Each section of code below is preceded by
* the name of the module which it is implementing.
*
*/
#include "g72x.h"
#include "g72x_priv.h"
/*
* Maps G.723_40 code word to ructeconstructed scale factor normalized log
* magnitude values.
*/
static short _dqlntab[32] = {-2048, -66, 28, 104, 169, 224, 274, 318,
358, 395, 429, 459, 488, 514, 539, 566,
566, 539, 514, 488, 459, 429, 395, 358,
318, 274, 224, 169, 104, 28, -66, -2048};
/* Maps G.723_40 code word to log of scale factor multiplier. */
static short _witab[32] = {448, 448, 768, 1248, 1280, 1312, 1856, 3200,
4512, 5728, 7008, 8960, 11456, 14080, 16928, 22272,
22272, 16928, 14080, 11456, 8960, 7008, 5728, 4512,
3200, 1856, 1312, 1280, 1248, 768, 448, 448};
/*
* Maps G.723_40 code words to a set of values whose long and short
* term averages are computed and then compared to give an indication
* how stationary (steady state) the signal is.
*/
static short _fitab[32] = {0, 0, 0, 0, 0, 0x200, 0x200, 0x200,
0x200, 0x200, 0x400, 0x600, 0x800, 0xA00, 0xC00, 0xC00,
0xC00, 0xC00, 0xA00, 0x800, 0x600, 0x400, 0x200, 0x200,
0x200, 0x200, 0x200, 0, 0, 0, 0, 0};
static short qtab_723_40[15] = {-122, -16, 68, 139, 198, 250, 298, 339,
378, 413, 445, 475, 502, 528, 553};
/*
* g723_40_encoder()
*
* Encodes a 16-bit linear PCM, A-law or u-law input sample and retuens
* the resulting 5-bit CCITT G.723 40Kbps code.
* Returns -1 if the input coding value is invalid.
*/
int g723_40_encoder (int sl, G72x_STATE *state_ptr)
{
short sei, sezi, se, sez; /* ACCUM */
short d; /* SUBTA */
short y; /* MIX */
short sr; /* ADDB */
short dqsez; /* ADDC */
short dq, i;
/* linearize input sample to 14-bit PCM */
sl >>= 2; /* sl of 14-bit dynamic range */
sezi = predictor_zero(state_ptr);
sez = sezi >> 1;
sei = sezi + predictor_pole(state_ptr);
se = sei >> 1; /* se = estimated signal */
d = sl - se; /* d = estimation difference */
/* quantize prediction difference */
y = step_size(state_ptr); /* adaptive quantizer step size */
i = quantize(d, y, qtab_723_40, 15); /* i = ADPCM code */
dq = reconstruct(i & 0x10, _dqlntab[i], y); /* quantized diff */
sr = (dq < 0) ? se - (dq & 0x7FFF) : se + dq; /* reconstructed signal */
dqsez = sr + sez - se; /* dqsez = pole prediction diff. */
update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
return (i);
}
/*
* g723_40_decoder()
*
* Decodes a 5-bit CCITT G.723 40Kbps code and returns
* the resulting 16-bit linear PCM, A-law or u-law sample value.
* -1 is returned if the output coding is unknown.
*/
int g723_40_decoder (int i, G72x_STATE *state_ptr)
{
short sezi, sei, sez, se; /* ACCUM */
short y ; /* MIX */
short sr; /* ADDB */
short dq;
short dqsez;
i &= 0x1f; /* mask to get proper bits */
sezi = predictor_zero(state_ptr);
sez = sezi >> 1;
sei = sezi + predictor_pole(state_ptr);
se = sei >> 1; /* se = estimated signal */
y = step_size(state_ptr); /* adaptive quantizer step size */
dq = reconstruct(i & 0x10, _dqlntab[i], y); /* estimation diff. */
sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq); /* reconst. signal */
dqsez = sr - se + sez; /* pole prediction diff. */
update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
return (sr << 2); /* sr was of 14-bit dynamic range */
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: eb8d9a00-32bf-4dd2-b287-01b0336d72bf
*/

View File

@ -0,0 +1,652 @@
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
/*
* g72x.c
*
* Common routines for G.721 and G.723 conversions.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "g72x.h"
#include "g72x_priv.h"
static G72x_STATE * g72x_state_new (void) ;
static int unpack_bytes (int bits, int blocksize, const unsigned char * block, short * samples) ;
static int pack_bytes (int bits, const short * samples, unsigned char * block) ;
static
short power2 [15] =
{ 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80,
0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000
} ;
/*
* quan()
*
* quantizes the input val against the table of size short integers.
* It returns i if table[i - 1] <= val < table[i].
*
* Using linear search for simple coding.
*/
static
int quan (int val, short *table, int size)
{
int i;
for (i = 0; i < size; i++)
if (val < *table++)
break;
return (i);
}
/*
* fmult()
*
* returns the integer product of the 14-bit integer "an" and
* "floating point" representation (4-bit exponent, 6-bit mantessa) "srn".
*/
static
int fmult (int an, int srn)
{
short anmag, anexp, anmant;
short wanexp, wanmant;
short retval;
anmag = (an > 0) ? an : ((-an) & 0x1FFF);
anexp = quan(anmag, power2, 15) - 6;
anmant = (anmag == 0) ? 32 :
(anexp >= 0) ? anmag >> anexp : anmag << -anexp;
wanexp = anexp + ((srn >> 6) & 0xF) - 13;
/*
** The original was :
** wanmant = (anmant * (srn & 0x37) + 0x30) >> 4 ;
** but could see no valid reason for the + 0x30.
** Removed it and it improved the SNR of the codec.
*/
wanmant = (anmant * (srn & 0x37)) >> 4 ;
retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) :
(wanmant >> -wanexp);
return (((an ^ srn) < 0) ? -retval : retval);
}
static G72x_STATE * g72x_state_new (void)
{ return calloc (1, sizeof (G72x_STATE)) ;
}
/*
* private_init_state()
*
* This routine initializes and/or resets the G72x_PRIVATE structure
* pointed to by 'state_ptr'.
* All the initial state values are specified in the CCITT G.721 document.
*/
void private_init_state (G72x_STATE *state_ptr)
{
int cnta;
state_ptr->yl = 34816;
state_ptr->yu = 544;
state_ptr->dms = 0;
state_ptr->dml = 0;
state_ptr->ap = 0;
for (cnta = 0; cnta < 2; cnta++) {
state_ptr->a[cnta] = 0;
state_ptr->pk[cnta] = 0;
state_ptr->sr[cnta] = 32;
}
for (cnta = 0; cnta < 6; cnta++) {
state_ptr->b[cnta] = 0;
state_ptr->dq[cnta] = 32;
}
state_ptr->td = 0;
} /* private_init_state */
struct g72x_state * g72x_reader_init (int codec, int *blocksize, int *samplesperblock)
{ G72x_STATE *pstate ;
if ((pstate = g72x_state_new ()) == NULL)
return NULL ;
private_init_state (pstate) ;
pstate->encoder = NULL ;
switch (codec)
{ case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
pstate->decoder = g723_16_decoder ;
*blocksize = G723_16_BYTES_PER_BLOCK ;
*samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
pstate->codec_bits = 2 ;
pstate->blocksize = G723_16_BYTES_PER_BLOCK ;
pstate->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
break ;
case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
pstate->decoder = g723_24_decoder ;
*blocksize = G723_24_BYTES_PER_BLOCK ;
*samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
pstate->codec_bits = 3 ;
pstate->blocksize = G723_24_BYTES_PER_BLOCK ;
pstate->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
break ;
case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
pstate->decoder = g721_decoder ;
*blocksize = G721_32_BYTES_PER_BLOCK ;
*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
pstate->codec_bits = 4 ;
pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
break ;
case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
pstate->decoder = g723_40_decoder ;
*blocksize = G721_40_BYTES_PER_BLOCK ;
*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
pstate->codec_bits = 5 ;
pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
break ;
default :
free (pstate) ;
return NULL ;
} ;
return pstate ;
} /* g72x_reader_init */
struct g72x_state * g72x_writer_init (int codec, int *blocksize, int *samplesperblock)
{ G72x_STATE *pstate ;
if ((pstate = g72x_state_new ()) == NULL)
return NULL ;
private_init_state (pstate) ;
pstate->decoder = NULL ;
switch (codec)
{ case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
pstate->encoder = g723_16_encoder ;
*blocksize = G723_16_BYTES_PER_BLOCK ;
*samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
pstate->codec_bits = 2 ;
pstate->blocksize = G723_16_BYTES_PER_BLOCK ;
pstate->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
break ;
case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
pstate->encoder = g723_24_encoder ;
*blocksize = G723_24_BYTES_PER_BLOCK ;
*samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
pstate->codec_bits = 3 ;
pstate->blocksize = G723_24_BYTES_PER_BLOCK ;
pstate->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
break ;
case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
pstate->encoder = g721_encoder ;
*blocksize = G721_32_BYTES_PER_BLOCK ;
*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
pstate->codec_bits = 4 ;
pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
break ;
case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
pstate->encoder = g723_40_encoder ;
*blocksize = G721_40_BYTES_PER_BLOCK ;
*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
pstate->codec_bits = 5 ;
pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
break ;
default :
free (pstate) ;
return NULL ;
} ;
return pstate ;
} /* g72x_writer_init */
int g72x_decode_block (G72x_STATE *pstate, const unsigned char *block, short *samples)
{ int k, count ;
count = unpack_bytes (pstate->codec_bits, pstate->blocksize, block, samples) ;
for (k = 0 ; k < count ; k++)
samples [k] = pstate->decoder (samples [k], pstate) ;
return 0 ;
} /* g72x_decode_block */
int g72x_encode_block (G72x_STATE *pstate, short *samples, unsigned char *block)
{ int k, count ;
for (k = 0 ; k < pstate->samplesperblock ; k++)
samples [k] = pstate->encoder (samples [k], pstate) ;
count = pack_bytes (pstate->codec_bits, samples, block) ;
return count ;
} /* g72x_encode_block */
/*
* predictor_zero()
*
* computes the estimated signal from 6-zero predictor.
*
*/
int predictor_zero (G72x_STATE *state_ptr)
{
int i;
int sezi;
sezi = fmult(state_ptr->b[0] >> 2, state_ptr->dq[0]);
for (i = 1; i < 6; i++) /* ACCUM */
sezi += fmult(state_ptr->b[i] >> 2, state_ptr->dq[i]);
return (sezi);
}
/*
* predictor_pole()
*
* computes the estimated signal from 2-pole predictor.
*
*/
int predictor_pole(G72x_STATE *state_ptr)
{
return (fmult(state_ptr->a[1] >> 2, state_ptr->sr[1]) +
fmult(state_ptr->a[0] >> 2, state_ptr->sr[0]));
}
/*
* step_size()
*
* computes the quantization step size of the adaptive quantizer.
*
*/
int step_size (G72x_STATE *state_ptr)
{
int y;
int dif;
int al;
if (state_ptr->ap >= 256)
return (state_ptr->yu);
else {
y = state_ptr->yl >> 6;
dif = state_ptr->yu - y;
al = state_ptr->ap >> 2;
if (dif > 0)
y += (dif * al) >> 6;
else if (dif < 0)
y += (dif * al + 0x3F) >> 6;
return (y);
}
}
/*
* quantize()
*
* Given a raw sample, 'd', of the difference signal and a
* quantization step size scale factor, 'y', this routine returns the
* ADPCM codeword to which that sample gets quantized. The step
* size scale factor division operation is done in the log base 2 domain
* as a subtraction.
*/
int quantize(
int d, /* Raw difference signal sample */
int y, /* Step size multiplier */
short *table, /* quantization table */
int size) /* table size of short integers */
{
short dqm; /* Magnitude of 'd' */
short expon; /* Integer part of base 2 log of 'd' */
short mant; /* Fractional part of base 2 log */
short dl; /* Log of magnitude of 'd' */
short dln; /* Step size scale factor normalized log */
int i;
/*
* LOG
*
* Compute base 2 log of 'd', and store in 'dl'.
*/
dqm = abs(d);
expon = quan(dqm >> 1, power2, 15);
mant = ((dqm << 7) >> expon) & 0x7F; /* Fractional portion. */
dl = (expon << 7) + mant;
/*
* SUBTB
*
* "Divide" by step size multiplier.
*/
dln = dl - (y >> 2);
/*
* QUAN
*
* Obtain codword i for 'd'.
*/
i = quan(dln, table, size);
if (d < 0) /* take 1's complement of i */
return ((size << 1) + 1 - i);
else if (i == 0) /* take 1's complement of 0 */
return ((size << 1) + 1); /* new in 1988 */
else
return (i);
}
/*
* reconstruct()
*
* Returns reconstructed difference signal 'dq' obtained from
* codeword 'i' and quantization step size scale factor 'y'.
* Multiplication is performed in log base 2 domain as addition.
*/
int
reconstruct(
int sign, /* 0 for non-negative value */
int dqln, /* G.72x codeword */
int y) /* Step size multiplier */
{
short dql; /* Log of 'dq' magnitude */
short dex; /* Integer part of log */
short dqt;
short dq; /* Reconstructed difference signal sample */
dql = dqln + (y >> 2); /* ADDA */
if (dql < 0) {
return ((sign) ? -0x8000 : 0);
} else { /* ANTILOG */
dex = (dql >> 7) & 15;
dqt = 128 + (dql & 127);
dq = (dqt << 7) >> (14 - dex);
return ((sign) ? (dq - 0x8000) : dq);
}
}
/*
* update()
*
* updates the state variables for each output code
*/
void
update(
int code_size, /* distinguish 723_40 with others */
int y, /* quantizer step size */
int wi, /* scale factor multiplier */
int fi, /* for long/short term energies */
int dq, /* quantized prediction difference */
int sr, /* reconstructed signal */
int dqsez, /* difference from 2-pole predictor */
G72x_STATE *state_ptr) /* coder state pointer */
{
int cnt;
short mag, expon; /* Adaptive predictor, FLOAT A */
short a2p = 0; /* LIMC */
short a1ul; /* UPA1 */
short pks1; /* UPA2 */
short fa1;
char tr; /* tone/transition detector */
short ylint, thr2, dqthr;
short ylfrac, thr1;
short pk0;
pk0 = (dqsez < 0) ? 1 : 0; /* needed in updating predictor poles */
mag = dq & 0x7FFF; /* prediction difference magnitude */
/* TRANS */
ylint = state_ptr->yl >> 15; /* exponent part of yl */
ylfrac = (state_ptr->yl >> 10) & 0x1F; /* fractional part of yl */
thr1 = (32 + ylfrac) << ylint; /* threshold */
thr2 = (ylint > 9) ? 31 << 10 : thr1; /* limit thr2 to 31 << 10 */
dqthr = (thr2 + (thr2 >> 1)) >> 1; /* dqthr = 0.75 * thr2 */
if (state_ptr->td == 0) /* signal supposed voice */
tr = 0;
else if (mag <= dqthr) /* supposed data, but small mag */
tr = 0; /* treated as voice */
else /* signal is data (modem) */
tr = 1;
/*
* Quantizer scale factor adaptation.
*/
/* FUNCTW & FILTD & DELAY */
/* update non-steady state step size multiplier */
state_ptr->yu = y + ((wi - y) >> 5);
/* LIMB */
if (state_ptr->yu < 544) /* 544 <= yu <= 5120 */
state_ptr->yu = 544;
else if (state_ptr->yu > 5120)
state_ptr->yu = 5120;
/* FILTE & DELAY */
/* update steady state step size multiplier */
state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6);
/*
* Adaptive predictor coefficients.
*/
if (tr == 1) { /* reset a's and b's for modem signal */
state_ptr->a[0] = 0;
state_ptr->a[1] = 0;
state_ptr->b[0] = 0;
state_ptr->b[1] = 0;
state_ptr->b[2] = 0;
state_ptr->b[3] = 0;
state_ptr->b[4] = 0;
state_ptr->b[5] = 0;
} else { /* update a's and b's */
pks1 = pk0 ^ state_ptr->pk[0]; /* UPA2 */
/* update predictor pole a[1] */
a2p = state_ptr->a[1] - (state_ptr->a[1] >> 7);
if (dqsez != 0) {
fa1 = (pks1) ? state_ptr->a[0] : -state_ptr->a[0];
if (fa1 < -8191) /* a2p = function of fa1 */
a2p -= 0x100;
else if (fa1 > 8191)
a2p += 0xFF;
else
a2p += fa1 >> 5;
if (pk0 ^ state_ptr->pk[1])
{ /* LIMC */
if (a2p <= -12160)
a2p = -12288;
else if (a2p >= 12416)
a2p = 12288;
else
a2p -= 0x80;
}
else if (a2p <= -12416)
a2p = -12288;
else if (a2p >= 12160)
a2p = 12288;
else
a2p += 0x80;
}
/* TRIGB & DELAY */
state_ptr->a[1] = a2p;
/* UPA1 */
/* update predictor pole a[0] */
state_ptr->a[0] -= state_ptr->a[0] >> 8;
if (dqsez != 0)
{ if (pks1 == 0)
state_ptr->a[0] += 192;
else
state_ptr->a[0] -= 192;
} ;
/* LIMD */
a1ul = 15360 - a2p;
if (state_ptr->a[0] < -a1ul)
state_ptr->a[0] = -a1ul;
else if (state_ptr->a[0] > a1ul)
state_ptr->a[0] = a1ul;
/* UPB : update predictor zeros b[6] */
for (cnt = 0; cnt < 6; cnt++) {
if (code_size == 5) /* for 40Kbps G.723 */
state_ptr->b[cnt] -= state_ptr->b[cnt] >> 9;
else /* for G.721 and 24Kbps G.723 */
state_ptr->b[cnt] -= state_ptr->b[cnt] >> 8;
if (dq & 0x7FFF) { /* XOR */
if ((dq ^ state_ptr->dq[cnt]) >= 0)
state_ptr->b[cnt] += 128;
else
state_ptr->b[cnt] -= 128;
}
}
}
for (cnt = 5; cnt > 0; cnt--)
state_ptr->dq[cnt] = state_ptr->dq[cnt-1];
/* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */
if (mag == 0) {
state_ptr->dq[0] = (dq >= 0) ? 0x20 : 0xFC20;
} else {
expon = quan(mag, power2, 15);
state_ptr->dq[0] = (dq >= 0) ?
(expon << 6) + ((mag << 6) >> expon) :
(expon << 6) + ((mag << 6) >> expon) - 0x400;
}
state_ptr->sr[1] = state_ptr->sr[0];
/* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */
if (sr == 0) {
state_ptr->sr[0] = 0x20;
} else if (sr > 0) {
expon = quan(sr, power2, 15);
state_ptr->sr[0] = (expon << 6) + ((sr << 6) >> expon);
} else if (sr > -32768) {
mag = -sr;
expon = quan(mag, power2, 15);
state_ptr->sr[0] = (expon << 6) + ((mag << 6) >> expon) - 0x400;
} else
state_ptr->sr[0] = (short) 0xFC20;
/* DELAY A */
state_ptr->pk[1] = state_ptr->pk[0];
state_ptr->pk[0] = pk0;
/* TONE */
if (tr == 1) /* this sample has been treated as data */
state_ptr->td = 0; /* next one will be treated as voice */
else if (a2p < -11776) /* small sample-to-sample correlation */
state_ptr->td = 1; /* signal may be data */
else /* signal is voice */
state_ptr->td = 0;
/*
* Adaptation speed control.
*/
state_ptr->dms += (fi - state_ptr->dms) >> 5; /* FILTA */
state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7); /* FILTB */
if (tr == 1)
state_ptr->ap = 256;
else if (y < 1536) /* SUBTC */
state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
else if (state_ptr->td == 1)
state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
else if (abs((state_ptr->dms << 2) - state_ptr->dml) >=
(state_ptr->dml >> 3))
state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
else
state_ptr->ap += (-state_ptr->ap) >> 4;
return ;
} /* update */
/*------------------------------------------------------------------------------
*/
static int
unpack_bytes (int bits, int blocksize, const unsigned char * block, short * samples)
{ unsigned int in_buffer = 0 ;
unsigned char in_byte ;
int k, in_bits = 0, bindex = 0 ;
for (k = 0 ; bindex <= blocksize && k < G72x_BLOCK_SIZE ; k++)
{ if (in_bits < bits)
{ in_byte = block [bindex++] ;
in_buffer |= (in_byte << in_bits);
in_bits += 8;
}
samples [k] = in_buffer & ((1 << bits) - 1);
in_buffer >>= bits;
in_bits -= bits;
} ;
return k ;
} /* unpack_bytes */
static int
pack_bytes (int bits, const short * samples, unsigned char * block)
{
unsigned int out_buffer = 0 ;
int k, bindex = 0, out_bits = 0 ;
unsigned char out_byte ;
for (k = 0 ; k < G72x_BLOCK_SIZE ; k++)
{ out_buffer |= (samples [k] << out_bits) ;
out_bits += bits ;
if (out_bits >= 8)
{ out_byte = out_buffer & 0xFF ;
out_bits -= 8 ;
out_buffer >>= 8 ;
block [bindex++] = out_byte ;
}
} ;
return bindex ;
} /* pack_bytes */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 6298dc75-fd0f-4062-9b90-f73ed69f22d4
*/

View File

@ -0,0 +1,99 @@
/*
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation; either version 2.1 of the License, or
** (at your option) any later version.
**
** This 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 Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
** This file is not the same as the original file from Sun Microsystems. Nearly
** all the original definitions and function prototypes that were in the file
** of this name have been moved to g72x_priv.h.
*/
#ifndef G72X_HEADER_FILE
#define G72X_HEADER_FILE
/*
** Number of samples per block to process.
** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.
*/
#define G72x_BLOCK_SIZE (3 * 5 * 8)
/*
** Identifiers for the differing kinds of G72x ADPCM codecs.
** The identifiers also define the number of encoded bits per sample.
*/
enum
{ G723_16_BITS_PER_SAMPLE = 2,
G723_24_BITS_PER_SAMPLE = 3,
G723_40_BITS_PER_SAMPLE = 5,
G721_32_BITS_PER_SAMPLE = 4,
G721_40_BITS_PER_SAMPLE = 5,
G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE),
G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE),
G723_16_BYTES_PER_BLOCK = (G723_16_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
G723_24_BYTES_PER_BLOCK = (G723_24_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
G723_40_BYTES_PER_BLOCK = (G723_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8
} ;
/* Forward declaration of of g72x_state. */
struct g72x_state ;
/* External function definitions. */
struct g72x_state * g72x_reader_init (int codec, int *blocksize, int *samplesperblock) ;
struct g72x_state * g72x_writer_init (int codec, int *blocksize, int *samplesperblock) ;
/*
** Initialize the ADPCM state table for the given codec.
** Return 0 on success, 1 on fail.
*/
int g72x_decode_block (struct g72x_state *pstate, const unsigned char *block, short *samples) ;
/*
** The caller fills data->block with data->bytes bytes before calling the
** function. The value data->bytes must be an integer multiple of
** data->blocksize and be <= data->max_bytes.
** When it returns, the caller can read out data->samples samples.
*/
int g72x_encode_block (struct g72x_state *pstate, short *samples, unsigned char *block) ;
/*
** The caller fills state->samples some integer multiple data->samples_per_block
** (up to G72x_BLOCK_SIZE) samples before calling the function.
** When it returns, the caller can read out bytes encoded bytes.
*/
#endif /* !G72X_HEADER_FILE */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
*/

View File

@ -0,0 +1,118 @@
/*
* This source code is a product of Sun Microsystems, Inc. and is provided
* for unrestricted use. Users may copy or modify this source code without
* charge.
*
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* Sun source code is provided with no support and without any obligation on
* the part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
*
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
* OR ANY PART THEREOF.
*
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
*
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
*/
#ifndef G72X_PRIVATE_H
#define G72X_PRIVATE_H
#ifdef __cplusplus
#error "This code is not designed to be compiled with a C++ compiler."
#endif
/*
** The following is the definition of the state structure used by the
** G.721/G.723 encoder and decoder to preserve their internal state
** between successive calls. The meanings of the majority of the state
** structure fields are explained in detail in the CCITT Recommendation
** G.721. The field names are essentially identical to variable names
** in the bit level description of the coding algorithm included in this
** Recommendation.
*/
struct g72x_state
{ long yl; /* Locked or steady state step size multiplier. */
short yu; /* Unlocked or non-steady state step size multiplier. */
short dms; /* Short term energy estimate. */
short dml; /* Long term energy estimate. */
short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */
short a[2]; /* Coefficients of pole portion of prediction filter. */
short b[6]; /* Coefficients of zero portion of prediction filter. */
short pk[2]; /*
** Signs of previous two samples of a partially
** reconstructed signal.
**/
short dq[6]; /*
** Previous 6 samples of the quantized difference
** signal represented in an internal floating point
** format.
**/
short sr[2]; /*
** Previous 2 samples of the quantized difference
** signal represented in an internal floating point
** format.
*/
char td; /* delayed tone detect, new in 1988 version */
/* The following struct members were added for libsndfile. The original
** code worked by calling a set of functions on a sample by sample basis
** which is slow on architectures like Intel x86. For libsndfile, this
** was changed so that the encoding and decoding routines could work on
** a block of samples at a time to reduce the function call overhead.
*/
int (*encoder) (int, struct g72x_state* state) ;
int (*decoder) (int, struct g72x_state* state) ;
int codec_bits, blocksize, samplesperblock ;
} ;
typedef struct g72x_state G72x_STATE ;
int predictor_zero (G72x_STATE *state_ptr);
int predictor_pole (G72x_STATE *state_ptr);
int step_size (G72x_STATE *state_ptr);
int quantize (int d, int y, short *table, int size);
int reconstruct (int sign, int dqln, int y);
void update (int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, G72x_STATE *state_ptr);
int g721_encoder (int sample, G72x_STATE *state_ptr);
int g721_decoder (int code, G72x_STATE *state_ptr);
int g723_16_encoder (int sample, G72x_STATE *state_ptr);
int g723_16_decoder (int code, G72x_STATE *state_ptr);
int g723_24_encoder (int sample, G72x_STATE *state_ptr);
int g723_24_decoder (int code, G72x_STATE *state_ptr);
int g723_40_encoder (int sample, G72x_STATE *state_ptr);
int g723_40_decoder (int code, G72x_STATE *state_ptr);
void private_init_state (G72x_STATE *state_ptr) ;
#endif /* G72X_PRIVATE_H */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b
*/

View File

@ -0,0 +1,222 @@
/*
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "g72x.h"
#include "g72x_priv.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846264338
#endif
#define BUFFER_SIZE (1<<14) /* Should be (1<<14) */
#define SAMPLE_RATE 11025
static void g721_test (void) ;
static void g723_test (double margin) ;
static void gen_signal_double (double *data, double scale, int datalen) ;
static int error_function (double data, double orig, double margin) ;
static int oct_save_short (short *a, short *b, int len) ;
int
main (int argc, char *argv [])
{ int bDoAll = 0 ;
int nTests = 0 ;
if (argc != 2)
{ printf ("Usage : %s <test>\n", argv [0]) ;
printf (" Where <test> is one of the following:\n") ;
printf (" g721 - test G721 encoder and decoder\n") ;
printf (" g723 - test G721 encoder and decoder\n") ;
printf (" all - perform all tests\n") ;
exit (1) ;
} ;
bDoAll=!strcmp (argv [1], "all");
if (bDoAll || ! strcmp (argv [1], "g721"))
{ g721_test () ;
nTests++ ;
} ;
if (bDoAll || ! strcmp (argv [1], "g723"))
{ g723_test (0.53) ;
nTests++ ;
} ;
if (nTests == 0)
{ printf ("Mono : ************************************\n") ;
printf ("Mono : * No '%s' test defined.\n", argv [1]) ;
printf ("Mono : ************************************\n") ;
return 1 ;
} ;
return 0 ;
} /* main */
static void
g721_test (void)
{
return ;
} /* g721_test */
static void
g723_test (double margin)
{ static double orig_buffer [BUFFER_SIZE] ;
static short orig [BUFFER_SIZE] ;
static short data [BUFFER_SIZE] ;
G72x_STATE encoder_state, decoder_state ;
long k ;
int code, position, max_err ;
private_init_state (&encoder_state) ;
encoder_state.encoder = g723_24_encoder ;
encoder_state.codec_bits = 3 ;
private_init_state (&decoder_state) ;
decoder_state.decoder = g723_24_decoder ;
decoder_state.codec_bits = 3 ;
memset (data, 0, BUFFER_SIZE * sizeof (short)) ;
memset (orig, 0, BUFFER_SIZE * sizeof (short)) ;
printf (" g723_test : ") ;
fflush (stdout) ;
gen_signal_double (orig_buffer, 32000.0, BUFFER_SIZE) ;
for (k = 0 ; k < BUFFER_SIZE ; k++)
orig [k] = (short) orig_buffer [k] ;
/* Write and read data here. */
position = 0 ;
max_err = 0 ;
for (k = 0 ; k < BUFFER_SIZE ; k++)
{ code = encoder_state.encoder (orig [k], &encoder_state) ;
data [k] = decoder_state.decoder (code, &decoder_state) ;
if (abs (orig [k] - data [k]) > max_err)
{ position = k ;
max_err = abs (orig [k] - data [k]) ;
} ;
} ;
printf ("\n\nMax error of %d at postion %d.\n", max_err, position) ;
for (k = 0 ; k < BUFFER_SIZE ; k++)
{ if (error_function (data [k], orig [k], margin))
{ printf ("Line %d: Incorrect sample A (#%ld : %d should be %d).\n", __LINE__, k, data [k], orig [k]) ;
oct_save_short (orig, data, BUFFER_SIZE) ;
exit (1) ;
} ;
} ;
printf ("ok\n") ;
return ;
} /* g723_test */
#define SIGNAL_MAXVAL 30000.0
#define DECAY_COUNT 1000
static void
gen_signal_double (double *gendata, double scale, int gendatalen)
{ int k, ramplen ;
double amp = 0.0 ;
ramplen = DECAY_COUNT ;
for (k = 0 ; k < gendatalen ; k++)
{ if (k <= ramplen)
amp = scale * k / ((double) ramplen) ;
else if (k > gendatalen - ramplen)
amp = scale * (gendatalen - k) / ((double) ramplen) ;
gendata [k] = amp * (0.4 * sin (33.3 * 2.0 * M_PI * ((double) (k+1)) / ((double) SAMPLE_RATE))
+ 0.3 * cos (201.1 * 2.0 * M_PI * ((double) (k+1)) / ((double) SAMPLE_RATE))) ;
} ;
return ;
} /* gen_signal_double */
static int
error_function (double data, double orig, double margin)
{ double error ;
if (fabs (orig) <= 500.0)
error = fabs (fabs (data) - fabs(orig)) / 2000.0 ;
else if (fabs (orig) <= 1000.0)
error = fabs (data - orig) / 3000.0 ;
else
error = fabs (data - orig) / fabs (orig) ;
if (error > margin)
{ printf ("\n\n*******************\nError : %f\n", error) ;
return 1 ;
} ;
return 0 ;
} /* error_function */
static int
oct_save_short (short *a, short *b, int len)
{ FILE *file ;
int k ;
if (! (file = fopen ("error.dat", "w")))
return 1 ;
fprintf (file, "# Not created by Octave\n") ;
fprintf (file, "# name: a\n") ;
fprintf (file, "# type: matrix\n") ;
fprintf (file, "# rows: %d\n", len) ;
fprintf (file, "# columns: 1\n") ;
for (k = 0 ; k < len ; k++)
fprintf (file, "% d\n", a [k]) ;
fprintf (file, "# name: b\n") ;
fprintf (file, "# type: matrix\n") ;
fprintf (file, "# rows: %d\n", len) ;
fprintf (file, "# columns: 1\n") ;
for (k = 0 ; k < len ; k++)
fprintf (file, "% d\n", b [k]) ;
fclose (file) ;
return 0 ;
} /* oct_save_short */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 0597b442-a5b0-4abf-92a4-92f6c24e85a6
*/

View File

@ -0,0 +1,16 @@
Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
Technische Universitaet Berlin
Any use of this software is permitted provided that this notice is not
removed and that neither the authors nor the Technische Universitaet Berlin
are deemed to have made any representations as to the suitability of this
software for any purpose nor are held responsible for any defects of
this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
As a matter of courtesy, the authors request to be informed about uses
this software has found, about bugs in this software, and about any
improvements that may be of general interest.
Berlin, 28.11.1994
Jutta Degener
Carsten Bormann

View File

@ -0,0 +1,56 @@
2004-05-12 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* gsm610_priv.h
Replace ugly macros with inline functions.
* *.c
Remove temporary variables used by macros and other minor fixes required by
above change.
2003-06-02 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* rpe.c
Renamed variables "exp" to "expon" to avoid shadowed parameter warnigns.
2002-06-08 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* long_term.c
Changes tp removed compiler warnings about shadowed parameters.
2002-06-08 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* private.h
Made declarations of gsm_A, gsm_B, gsm_MIC etc extern. This fixed a compile
problem on MacOSX.
2002-05-10 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* *.[ch]
Removed all pre-ANSI prototype kludges. Removed proto.h and unproto.h.
Started work on making GSM 6.10 files seekable. Currently they are not.
* code.c private.h
Function Gsm_Coder () used a statically defined array. This was obviously
not re-entrant so moved it to struct gsm_state.
2001-09-16 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* code.c
Added #includes for string.h and stdlib.h.
2000-10-27 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* config.h
Removed some commented out #defines (ie //*efine) which were causing problems on
the Sun cc compiler.
2000-02-29 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* private.h
Added #defines to emulate normal compile time options.
2000-02-28 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* everthing
Created this directory and copied files from libgsm.
http://kbs.cs.tu-berlin.de/~jutta/toast.html

View File

@ -0,0 +1,21 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = README COPYRIGHT ChangeLog
noinst_HEADERS = gsm.h config.h gsm610_priv.h
noinst_LTLIBRARIES = libgsm.la
CFILES = add.c decode.c gsm_decode.c gsm_encode.c long_term.c preprocess.c \
short_term.c code.c gsm_create.c gsm_destroy.c gsm_option.c lpc.c rpe.c table.c
libgsm_la_SOURCES = $(CFILES) $(noinst_HEADERS)
# Disable autoheader.
AUTOHEADER=echo
## Do not edit or modify anything in this comment block.
## The arch-tag line is a file identity tag for the GNU Arch
## revision control system.
##
## arch-tag: ba91ffbe-9d1d-4044-a1de-e8ee2f890560

View File

@ -0,0 +1,477 @@
# 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 = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = src/GSM610
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libgsm_la_LIBADD =
am__objects_1 = add.lo decode.lo gsm_decode.lo gsm_encode.lo \
long_term.lo preprocess.lo short_term.lo code.lo gsm_create.lo \
gsm_destroy.lo gsm_option.lo lpc.lo rpe.lo table.lo
am__objects_2 =
am_libgsm_la_OBJECTS = $(am__objects_1) $(am__objects_2)
libgsm_la_OBJECTS = $(am_libgsm_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libgsm_la_SOURCES)
DIST_SOURCES = $(libgsm_la_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALSA_LIBS = @ALSA_LIBS@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
# Disable autoheader.
AUTOHEADER = echo
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COMPILER_IS_GCC = @COMPILER_IS_GCC@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
ENABLE_EXPERIMENTAL_CODE = @ENABLE_EXPERIMENTAL_CODE@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
autogen = @autogen@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
htmldocdir = @htmldocdir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
EXTRA_DIST = README COPYRIGHT ChangeLog
noinst_HEADERS = gsm.h config.h gsm610_priv.h
noinst_LTLIBRARIES = libgsm.la
CFILES = add.c decode.c gsm_decode.c gsm_encode.c long_term.c preprocess.c \
short_term.c code.c gsm_create.c gsm_destroy.c gsm_option.c lpc.c rpe.c table.c
libgsm_la_SOURCES = $(CFILES) $(noinst_HEADERS)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/GSM610/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/GSM610/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
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libgsm.la: $(libgsm_la_OBJECTS) $(libgsm_la_DEPENDENCIES)
$(LINK) $(libgsm_la_LDFLAGS) $(libgsm_la_OBJECTS) $(libgsm_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/code.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_create.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_decode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_destroy.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_encode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsm_option.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/long_term.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preprocess.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpe.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/short_term.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/table.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ 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) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
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 $(LTLIBRARIES) $(HEADERS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(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 clean-libtool clean-noinstLTLIBRARIES \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-exec-am:
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 \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-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 mostlyclean-libtool \
pdf pdf-am ps ps-am tags 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:

View File

@ -0,0 +1,36 @@
GSM 06.10 13 kbit/s RPE/LTP speech codec
----------------------------------------
All the file in this directory were written by Jutta Degener
and Carsten Borman for The Communications and Operating Systems
Research Group (KBS) at the Technische Universitaet Berlin.
Their work was released under the following license which is
assumed to be compatible with The GNU Lesser General Public License.
----------------------------------------------------------------------------
Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
Technische Universitaet Berlin
Any use of this software is permitted provided that this notice is not
removed and that neither the authors nor the Technische Universitaet Berlin
are deemed to have made any representations as to the suitability of this
software for any purpose nor are held responsible for any defects of
this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
As a matter of courtesy, the authors request to be informed about uses
this software has found, about bugs in this software, and about any
improvements that may be of general interest.
Berlin, 28.11.1994
Jutta Degener (jutta@cs.tu-berlin.de)
Carsten Bormann (cabo@cs.tu-berlin.de)
----------------------------------------------------------------------------
Jutta Degener and Carsten Bormann's work can be found on their homepage
at:
http://kbs.cs.tu-berlin.de/~jutta/toast.html

View File

@ -0,0 +1,248 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
/*
* See private.h for the more commonly used macro versions.
*/
#include <stdio.h>
#include <assert.h>
#include "gsm610_priv.h"
#include "gsm.h"
#define saturate(x) \
((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
word gsm_add ( word a, word b)
{
longword sum = (longword)a + (longword)b;
return saturate(sum);
}
word gsm_sub ( word a, word b)
{
longword diff = (longword)a - (longword)b;
return saturate(diff);
}
word gsm_mult ( word a, word b)
{
if (a == MIN_WORD && b == MIN_WORD)
return MAX_WORD;
return SASR_L( (longword)a * (longword)b, 15 );
}
word gsm_mult_r ( word a, word b)
{
if (b == MIN_WORD && a == MIN_WORD) return MAX_WORD;
else {
longword prod = (longword)a * (longword)b + 16384;
prod >>= 15;
return prod & 0xFFFF;
}
}
word gsm_abs (word a)
{
return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a;
}
longword gsm_L_mult (word a, word b)
{
assert( a != MIN_WORD || b != MIN_WORD );
return ((longword)a * (longword)b) << 1;
}
longword gsm_L_add ( longword a, longword b)
{
if (a < 0) {
if (b >= 0) return a + b;
else {
ulongword A = (ulongword)-(a + 1) + (ulongword)-(b + 1);
return A >= MAX_LONGWORD ? MIN_LONGWORD :-(longword)A-2;
}
}
else if (b <= 0) return a + b;
else {
ulongword A = (ulongword)a + (ulongword)b;
return A > MAX_LONGWORD ? MAX_LONGWORD : A;
}
}
longword gsm_L_sub ( longword a, longword b)
{
if (a >= 0) {
if (b >= 0) return a - b;
else {
/* a>=0, b<0 */
ulongword A = (ulongword)a + -(b + 1);
return A >= MAX_LONGWORD ? MAX_LONGWORD : (A + 1);
}
}
else if (b <= 0) return a - b;
else {
/* a<0, b>0 */
ulongword A = (ulongword)-(a + 1) + b;
return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1;
}
}
static unsigned char const bitoff[ 256 ] = {
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
word gsm_norm (longword a )
/*
* the number of left shifts needed to normalize the 32 bit
* variable L_var1 for positive values on the interval
*
* with minimum of
* minimum of 1073741824 (01000000000000000000000000000000) and
* maximum of 2147483647 (01111111111111111111111111111111)
*
*
* and for negative values on the interval with
* minimum of -2147483648 (-10000000000000000000000000000000) and
* maximum of -1073741824 ( -1000000000000000000000000000000).
*
* in order to normalize the result, the following
* operation must be done: L_norm_var1 = L_var1 << norm( L_var1 );
*
* (That's 'ffs', only from the left, not the right..)
*/
{
assert(a != 0);
if (a < 0) {
if (a <= -1073741824) return 0;
a = ~a;
}
return a & 0xffff0000
? ( a & 0xff000000
? -1 + bitoff[ 0xFF & (a >> 24) ]
: 7 + bitoff[ 0xFF & (a >> 16) ] )
: ( a & 0xff00
? 15 + bitoff[ 0xFF & (a >> 8) ]
: 23 + bitoff[ 0xFF & a ] );
}
longword gsm_L_asl (longword a, int n)
{
if (n >= 32) return 0;
if (n <= -32) return -(a < 0);
if (n < 0) return gsm_L_asr(a, -n);
return a << n;
}
word gsm_asr (word a, int n)
{
if (n >= 16) return -(a < 0);
if (n <= -16) return 0;
if (n < 0) return a << -n;
return SASR_W (a, (word) n);
}
word gsm_asl (word a, int n)
{
if (n >= 16) return 0;
if (n <= -16) return -(a < 0);
if (n < 0) return gsm_asr(a, -n);
return a << n;
}
longword gsm_L_asr (longword a, int n)
{
if (n >= 32) return -(a < 0);
if (n <= -32) return 0;
if (n < 0) return a << -n;
return SASR_L (a, (word) n);
}
/*
** word gsm_asr (word a, int n)
** {
** if (n >= 16) return -(a < 0);
** if (n <= -16) return 0;
** if (n < 0) return a << -n;
**
** # ifdef SASR_W
** return a >> n;
** # else
** if (a >= 0) return a >> n;
** else return -(word)( -(uword)a >> n );
** # endif
** }
**
*/
/*
* (From p. 46, end of section 4.2.5)
*
* NOTE: The following lines gives [sic] one correct implementation
* of the div(num, denum) arithmetic operation. Compute div
* which is the integer division of num by denum: with denum
* >= num > 0
*/
word gsm_div (word num, word denum)
{
longword L_num = num;
longword L_denum = denum;
word div = 0;
int k = 15;
/* The parameter num sometimes becomes zero.
* Although this is explicitly guarded against in 4.2.5,
* we assume that the result should then be zero as well.
*/
/* assert(num != 0); */
assert(num >= 0 && denum >= num);
if (num == 0)
return 0;
while (k--) {
div <<= 1;
L_num <<= 1;
if (L_num >= L_denum) {
L_num -= L_denum;
div++;
}
}
return div;
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: a7398579-e2e1-4733-aa2d-4c6efc0c58ff
*/

View File

@ -0,0 +1,97 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "gsm610_priv.h"
#include "gsm.h"
/*
* 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER
*/
void Gsm_Coder (
struct gsm_state * State,
word * s, /* [0..159] samples IN */
/*
* The RPE-LTD coder works on a frame by frame basis. The length of
* the frame is equal to 160 samples. Some computations are done
* once per frame to produce at the output of the coder the
* LARc[1..8] parameters which are the coded LAR coefficients and
* also to realize the inverse filtering operation for the entire
* frame (160 samples of signal d[0..159]). These parts produce at
* the output of the coder:
*/
word * LARc, /* [0..7] LAR coefficients OUT */
/*
* Procedure 4.2.11 to 4.2.18 are to be executed four times per
* frame. That means once for each sub-segment RPE-LTP analysis of
* 40 samples. These parts produce at the output of the coder:
*/
word * Nc, /* [0..3] LTP lag OUT */
word * bc, /* [0..3] coded LTP gain OUT */
word * Mc, /* [0..3] RPE grid selection OUT */
word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
word * xMc /* [13*4] normalized RPE samples OUT */
)
{
int k;
word * dp = State->dp0 + 120; /* [ -120...-1 ] */
word * dpp = dp; /* [ 0...39 ] */
word so[160];
Gsm_Preprocess (State, s, so);
Gsm_LPC_Analysis (State, so, LARc);
Gsm_Short_Term_Analysis_Filter (State, LARc, so);
for (k = 0; k <= 3; k++, xMc += 13) {
Gsm_Long_Term_Predictor ( State,
so+k*40, /* d [0..39] IN */
dp, /* dp [-120..-1] IN */
State->e + 5, /* e [0..39] OUT */
dpp, /* dpp [0..39] OUT */
Nc++,
bc++);
Gsm_RPE_Encoding ( /*-S,-*/
State->e + 5, /* e ][0..39][ IN/OUT */
xmaxc++, Mc++, xMc );
/*
* Gsm_Update_of_reconstructed_short_time_residual_signal
* ( dpp, e + 5, dp );
*/
{ register int i;
for (i = 0; i <= 39; i++)
dp[ i ] = GSM_ADD( State->e[5 + i], dpp[i] );
}
dp += 40;
dpp += 40;
}
(void)memcpy( (char *)State->dp0, (char *)(State->dp0 + 160),
120 * sizeof(*State->dp0) );
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: ae8ef1b2-5a1e-4263-94cd-42b15dca81a3
*/

View File

@ -0,0 +1,33 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
#ifndef CONFIG_H
#define CONFIG_H
#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */
#define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */
#define HAS_FSTAT 1 /* fstat syscall */
#define HAS_FCHMOD 1 /* fchmod syscall */
#define HAS_CHMOD 1 /* chmod syscall */
#define HAS_FCHOWN 1 /* fchown syscall */
#define HAS_CHOWN 1 /* chown syscall */
#define HAS_STRING_H 1 /* /usr/include/string.h */
#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */
#define HAS_UTIME 1 /* POSIX utime(path, times) */
#define HAS_UTIME_H 1 /* UTIME header file */
#endif /* CONFIG_H */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 5338dfef-8e59-4f51-af47-627c9ea85353
*/

View File

@ -0,0 +1,67 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
#include <stdio.h>
#include "gsm610_priv.h"
#include "gsm.h"
/*
* 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
*/
static void Postprocessing (
struct gsm_state * S,
register word * s)
{
register int k;
register word msr = S->msr;
register word tmp;
for (k = 160; k--; s++) {
tmp = GSM_MULT_R( msr, 28180 );
msr = GSM_ADD(*s, tmp); /* Deemphasis */
*s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
}
S->msr = msr;
}
void Gsm_Decoder (
struct gsm_state * S,
word * LARcr, /* [0..7] IN */
word * Ncr, /* [0..3] IN */
word * bcr, /* [0..3] IN */
word * Mcr, /* [0..3] IN */
word * xmaxcr, /* [0..3] IN */
word * xMcr, /* [0..13*4] IN */
word * s) /* [0..159] OUT */
{
int j, k;
word erp[40], wt[160];
word * drp = S->dp0 + 120;
for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
Gsm_RPE_Decoding( /*-S,-*/ *xmaxcr, *Mcr, xMcr, erp );
Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ];
}
Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
Postprocessing(S, s);
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 11ae5b90-2e8b-400b-ac64-a69a1fc6cc41
*/

View File

@ -0,0 +1,58 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
#ifndef GSM_H
#define GSM_H
#include <stdio.h> /* for FILE * */
/*
* Interface
*/
typedef struct gsm_state * gsm;
typedef short gsm_signal; /* signed 16 bit */
typedef unsigned char gsm_byte;
typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */
#define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */
#define GSM_PATCHLEVEL 10
#define GSM_MINOR 0
#define GSM_MAJOR 1
#define GSM_OPT_VERBOSE 1
#define GSM_OPT_FAST 2
#define GSM_OPT_LTP_CUT 3
#define GSM_OPT_WAV49 4
#define GSM_OPT_FRAME_INDEX 5
#define GSM_OPT_FRAME_CHAIN 6
gsm gsm_create (void);
/* Added for libsndfile : May 6, 2002 */
void gsm_init (gsm);
void gsm_destroy (gsm);
int gsm_print (FILE *, gsm, gsm_byte *);
int gsm_option (gsm, int, int *);
void gsm_encode (gsm, gsm_signal *, gsm_byte *);
int gsm_decode (gsm, gsm_byte *, gsm_signal *);
int gsm_explode (gsm, gsm_byte *, gsm_signal *);
void gsm_implode (gsm, gsm_signal *, gsm_byte *);
#endif /* GSM_H */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 8cfc7698-5433-4b6f-aeca-967c6fda4dec
*/

View File

@ -0,0 +1,308 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
#ifndef PRIVATE_H
#define PRIVATE_H
/* Added by Erik de Castro Lopo */
#define USE_FLOAT_MUL
#define FAST
#define WAV49
#ifdef __cplusplus
#error "This code is not designed to be compiled with a C++ compiler."
#endif
/* Added by Erik de Castro Lopo */
typedef short word; /* 16 bit signed int */
typedef int longword; /* 32 bit signed int */
typedef unsigned short uword; /* unsigned word */
typedef unsigned int ulongword; /* unsigned longword */
struct gsm_state
{ word dp0[ 280 ] ;
word z1; /* preprocessing.c, Offset_com. */
longword L_z2; /* Offset_com. */
int mp; /* Preemphasis */
word u[8] ; /* short_term_aly_filter.c */
word LARpp[2][8] ; /* */
word j; /* */
word ltp_cut; /* long_term.c, LTP crosscorr. */
word nrp; /* 40 */ /* long_term.c, synthesis */
word v[9] ; /* short_term.c, synthesis */
word msr; /* decoder.c, Postprocessing */
char verbose; /* only used if !NDEBUG */
char fast; /* only used if FAST */
char wav_fmt; /* only used if WAV49 defined */
unsigned char frame_index; /* odd/even chaining */
unsigned char frame_chain; /* half-byte to carry forward */
/* Moved here from code.c where it was defined as static */
word e[50] ;
} ;
typedef struct gsm_state GSM_STATE ;
#define MIN_WORD (-32767 - 1)
#define MAX_WORD 32767
#define MIN_LONGWORD (-2147483647 - 1)
#define MAX_LONGWORD 2147483647
/* Signed arithmetic shift right. */
static inline word
SASR_W (word x, word by)
{ return (x >> by) ;
} /* SASR */
static inline longword
SASR_L (longword x, word by)
{ return (x >> by) ;
} /* SASR */
/*
* Prototypes from add.c
*/
word gsm_mult (word a, word b) ;
longword gsm_L_mult (word a, word b) ;
word gsm_mult_r (word a, word b) ;
word gsm_div (word num, word denum) ;
word gsm_add (word a, word b ) ;
longword gsm_L_add (longword a, longword b ) ;
word gsm_sub (word a, word b) ;
longword gsm_L_sub (longword a, longword b) ;
word gsm_abs (word a) ;
word gsm_norm (longword a ) ;
longword gsm_L_asl (longword a, int n) ;
word gsm_asl (word a, int n) ;
longword gsm_L_asr (longword a, int n) ;
word gsm_asr (word a, int n) ;
/*
* Inlined functions from add.h
*/
static inline longword
GSM_MULT_R (word a, word b)
{ return (((longword) (a)) * ((longword) (b)) + 16384) >> 15 ;
} /* GSM_MULT_R */
static inline longword
GSM_MULT (word a, word b)
{ return (((longword) (a)) * ((longword) (b))) >> 15 ;
} /* GSM_MULT */
static inline longword
GSM_L_MULT (word a, word b)
{ return ((longword) (a)) * ((longword) (b)) << 1 ;
} /* GSM_L_MULT */
static inline longword
GSM_L_ADD (longword a, longword b)
{ ulongword utmp ;
if (a < 0 && b < 0)
{ utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1) ;
return (utmp >= (ulongword) MAX_LONGWORD) ? MIN_LONGWORD : -(longword)utmp-2 ;
} ;
if (a > 0 && b > 0)
{ utmp = (ulongword) a + (ulongword) b ;
return (utmp >= (ulongword) MAX_LONGWORD) ? MAX_LONGWORD : utmp ;
} ;
return a + b ;
} /* GSM_L_ADD */
static inline longword
GSM_ADD (word a, word b)
{ longword ltmp ;
ltmp = ((longword) a) + ((longword) b) ;
if (ltmp >= MAX_WORD)
return MAX_WORD ;
if (ltmp <= MIN_WORD)
return MIN_WORD ;
return ltmp ;
} /* GSM_ADD */
static inline longword
GSM_SUB (word a, word b)
{ longword ltmp ;
ltmp = ((longword) a) - ((longword) b) ;
if (ltmp >= MAX_WORD)
ltmp = MAX_WORD ;
else if (ltmp <= MIN_WORD)
ltmp = MIN_WORD ;
return ltmp ;
} /* GSM_SUB */
static inline word
GSM_ABS (word a)
{
if (a > 0)
return a ;
if (a == MIN_WORD)
return MAX_WORD ;
return -a ;
} /* GSM_ADD */
/*
* More prototypes from implementations..
*/
void Gsm_Coder (
struct gsm_state * S,
word * s, /* [0..159] samples IN */
word * LARc, /* [0..7] LAR coefficients OUT */
word * Nc, /* [0..3] LTP lag OUT */
word * bc, /* [0..3] coded LTP gain OUT */
word * Mc, /* [0..3] RPE grid selection OUT */
word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
word * xMc) ;/* [13*4] normalized RPE samples OUT */
void Gsm_Long_Term_Predictor ( /* 4x for 160 samples */
struct gsm_state * S,
word * d, /* [0..39] residual signal IN */
word * dp, /* [-120..-1] d' IN */
word * e, /* [0..40] OUT */
word * dpp, /* [0..40] OUT */
word * Nc, /* correlation lag OUT */
word * bc) ; /* gain factor OUT */
void Gsm_LPC_Analysis (
struct gsm_state * S,
word * s, /* 0..159 signals IN/OUT */
word * LARc) ; /* 0..7 LARc's OUT */
void Gsm_Preprocess (
struct gsm_state * S,
word * s, word * so) ;
void Gsm_Encoding (
struct gsm_state * S,
word * e,
word * ep,
word * xmaxc,
word * Mc,
word * xMc) ;
void Gsm_Short_Term_Analysis_Filter (
struct gsm_state * S,
word * LARc, /* coded log area ratio [0..7] IN */
word * d) ; /* st res. signal [0..159] IN/OUT */
void Gsm_Decoder (
struct gsm_state * S,
word * LARcr, /* [0..7] IN */
word * Ncr, /* [0..3] IN */
word * bcr, /* [0..3] IN */
word * Mcr, /* [0..3] IN */
word * xmaxcr, /* [0..3] IN */
word * xMcr, /* [0..13*4] IN */
word * s) ; /* [0..159] OUT */
void Gsm_Decoding (
struct gsm_state * S,
word xmaxcr,
word Mcr,
word * xMcr, /* [0..12] IN */
word * erp) ; /* [0..39] OUT */
void Gsm_Long_Term_Synthesis_Filtering (
struct gsm_state* S,
word Ncr,
word bcr,
word * erp, /* [0..39] IN */
word * drp) ; /* [-120..-1] IN, [0..40] OUT */
void Gsm_RPE_Decoding (
/*-struct gsm_state *S,-*/
word xmaxcr,
word Mcr,
word * xMcr, /* [0..12], 3 bits IN */
word * erp) ; /* [0..39] OUT */
void Gsm_RPE_Encoding (
/*-struct gsm_state * S,-*/
word * e, /* -5..-1][0..39][40..44 IN/OUT */
word * xmaxc, /* OUT */
word * Mc, /* OUT */
word * xMc) ; /* [0..12] OUT */
void Gsm_Short_Term_Synthesis_Filter (
struct gsm_state * S,
word * LARcr, /* log area ratios [0..7] IN */
word * drp, /* received d [0...39] IN */
word * s) ; /* signal s [0..159] OUT */
void Gsm_Update_of_reconstructed_short_time_residual_signal (
word * dpp, /* [0...39] IN */
word * ep, /* [0...39] IN */
word * dp) ; /* [-120...-1] IN/OUT */
/*
* Tables from table.c
*/
#ifndef GSM_TABLE_C
extern word gsm_A [8], gsm_B [8], gsm_MIC [8], gsm_MAC [8] ;
extern word gsm_INVA [8] ;
extern word gsm_DLB [4], gsm_QLB [4] ;
extern word gsm_H [11] ;
extern word gsm_NRFAC [8] ;
extern word gsm_FAC [8] ;
#endif /* GSM_TABLE_C */
/*
* Debugging
*/
#ifdef NDEBUG
# define gsm_debug_words(a, b, c, d) /* nil */
# define gsm_debug_longwords(a, b, c, d) /* nil */
# define gsm_debug_word(a, b) /* nil */
# define gsm_debug_longword(a, b) /* nil */
#else /* !NDEBUG => DEBUG */
void gsm_debug_words (char * name, int, int, word *) ;
void gsm_debug_longwords (char * name, int, int, longword *) ;
void gsm_debug_longword (char * name, longword) ;
void gsm_debug_word (char * name, word) ;
#endif /* !NDEBUG */
#endif /* PRIVATE_H */
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 8bc5fdf2-e8c8-4686-9bd7-a30b512bef0c
*/

View File

@ -0,0 +1,44 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gsm.h"
#include "gsm610_priv.h"
gsm gsm_create (void)
{
gsm r;
r = malloc (sizeof(struct gsm_state));
if (!r) return r;
memset((char *)r, 0, sizeof (struct gsm_state));
r->nrp = 40;
return r;
}
/* Added for libsndfile : May 6, 2002. Not sure if it works. */
void gsm_init (gsm state)
{
memset (state, 0, sizeof (struct gsm_state)) ;
state->nrp = 40 ;
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 9fedb6b3-ed99-40c2-aac1-484c536261fe
*/

View File

@ -0,0 +1,366 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
#include "gsm610_priv.h"
#include "gsm.h"
int gsm_decode (gsm s, gsm_byte * c, gsm_signal * target)
{
word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
#ifdef WAV49
if (s->wav_fmt) {
uword sr = 0;
s->frame_index = !s->frame_index;
if (s->frame_index) {
sr = *c++;
LARc[0] = sr & 0x3f; sr >>= 6;
sr |= (uword)*c++ << 2;
LARc[1] = sr & 0x3f; sr >>= 6;
sr |= (uword)*c++ << 4;
LARc[2] = sr & 0x1f; sr >>= 5;
LARc[3] = sr & 0x1f; sr >>= 5;
sr |= (uword)*c++ << 2;
LARc[4] = sr & 0xf; sr >>= 4;
LARc[5] = sr & 0xf; sr >>= 4;
sr |= (uword)*c++ << 2; /* 5 */
LARc[6] = sr & 0x7; sr >>= 3;
LARc[7] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 4;
Nc[0] = sr & 0x7f; sr >>= 7;
bc[0] = sr & 0x3; sr >>= 2;
Mc[0] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 1;
xmaxc[0] = sr & 0x3f; sr >>= 6;
xmc[0] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[1] = sr & 0x7; sr >>= 3;
xmc[2] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[3] = sr & 0x7; sr >>= 3;
xmc[4] = sr & 0x7; sr >>= 3;
xmc[5] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1; /* 10 */
xmc[6] = sr & 0x7; sr >>= 3;
xmc[7] = sr & 0x7; sr >>= 3;
xmc[8] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[9] = sr & 0x7; sr >>= 3;
xmc[10] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[11] = sr & 0x7; sr >>= 3;
xmc[12] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 4;
Nc[1] = sr & 0x7f; sr >>= 7;
bc[1] = sr & 0x3; sr >>= 2;
Mc[1] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 1;
xmaxc[1] = sr & 0x3f; sr >>= 6;
xmc[13] = sr & 0x7; sr >>= 3;
sr = *c++; /* 15 */
xmc[14] = sr & 0x7; sr >>= 3;
xmc[15] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[16] = sr & 0x7; sr >>= 3;
xmc[17] = sr & 0x7; sr >>= 3;
xmc[18] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[19] = sr & 0x7; sr >>= 3;
xmc[20] = sr & 0x7; sr >>= 3;
xmc[21] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[22] = sr & 0x7; sr >>= 3;
xmc[23] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[24] = sr & 0x7; sr >>= 3;
xmc[25] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 4; /* 20 */
Nc[2] = sr & 0x7f; sr >>= 7;
bc[2] = sr & 0x3; sr >>= 2;
Mc[2] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 1;
xmaxc[2] = sr & 0x3f; sr >>= 6;
xmc[26] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[27] = sr & 0x7; sr >>= 3;
xmc[28] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[29] = sr & 0x7; sr >>= 3;
xmc[30] = sr & 0x7; sr >>= 3;
xmc[31] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[32] = sr & 0x7; sr >>= 3;
xmc[33] = sr & 0x7; sr >>= 3;
xmc[34] = sr & 0x7; sr >>= 3;
sr = *c++; /* 25 */
xmc[35] = sr & 0x7; sr >>= 3;
xmc[36] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[37] = sr & 0x7; sr >>= 3;
xmc[38] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 4;
Nc[3] = sr & 0x7f; sr >>= 7;
bc[3] = sr & 0x3; sr >>= 2;
Mc[3] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 1;
xmaxc[3] = sr & 0x3f; sr >>= 6;
xmc[39] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[40] = sr & 0x7; sr >>= 3;
xmc[41] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2; /* 30 */
xmc[42] = sr & 0x7; sr >>= 3;
xmc[43] = sr & 0x7; sr >>= 3;
xmc[44] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[45] = sr & 0x7; sr >>= 3;
xmc[46] = sr & 0x7; sr >>= 3;
xmc[47] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[48] = sr & 0x7; sr >>= 3;
xmc[49] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[50] = sr & 0x7; sr >>= 3;
xmc[51] = sr & 0x7; sr >>= 3;
s->frame_chain = sr & 0xf;
}
else {
sr = s->frame_chain;
sr |= (uword)*c++ << 4; /* 1 */
LARc[0] = sr & 0x3f; sr >>= 6;
LARc[1] = sr & 0x3f; sr >>= 6;
sr = *c++;
LARc[2] = sr & 0x1f; sr >>= 5;
sr |= (uword)*c++ << 3;
LARc[3] = sr & 0x1f; sr >>= 5;
LARc[4] = sr & 0xf; sr >>= 4;
sr |= (uword)*c++ << 2;
LARc[5] = sr & 0xf; sr >>= 4;
LARc[6] = sr & 0x7; sr >>= 3;
LARc[7] = sr & 0x7; sr >>= 3;
sr = *c++; /* 5 */
Nc[0] = sr & 0x7f; sr >>= 7;
sr |= (uword)*c++ << 1;
bc[0] = sr & 0x3; sr >>= 2;
Mc[0] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 5;
xmaxc[0] = sr & 0x3f; sr >>= 6;
xmc[0] = sr & 0x7; sr >>= 3;
xmc[1] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[2] = sr & 0x7; sr >>= 3;
xmc[3] = sr & 0x7; sr >>= 3;
xmc[4] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[5] = sr & 0x7; sr >>= 3;
xmc[6] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2; /* 10 */
xmc[7] = sr & 0x7; sr >>= 3;
xmc[8] = sr & 0x7; sr >>= 3;
xmc[9] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[10] = sr & 0x7; sr >>= 3;
xmc[11] = sr & 0x7; sr >>= 3;
xmc[12] = sr & 0x7; sr >>= 3;
sr = *c++;
Nc[1] = sr & 0x7f; sr >>= 7;
sr |= (uword)*c++ << 1;
bc[1] = sr & 0x3; sr >>= 2;
Mc[1] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 5;
xmaxc[1] = sr & 0x3f; sr >>= 6;
xmc[13] = sr & 0x7; sr >>= 3;
xmc[14] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1; /* 15 */
xmc[15] = sr & 0x7; sr >>= 3;
xmc[16] = sr & 0x7; sr >>= 3;
xmc[17] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[18] = sr & 0x7; sr >>= 3;
xmc[19] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[20] = sr & 0x7; sr >>= 3;
xmc[21] = sr & 0x7; sr >>= 3;
xmc[22] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[23] = sr & 0x7; sr >>= 3;
xmc[24] = sr & 0x7; sr >>= 3;
xmc[25] = sr & 0x7; sr >>= 3;
sr = *c++;
Nc[2] = sr & 0x7f; sr >>= 7;
sr |= (uword)*c++ << 1; /* 20 */
bc[2] = sr & 0x3; sr >>= 2;
Mc[2] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 5;
xmaxc[2] = sr & 0x3f; sr >>= 6;
xmc[26] = sr & 0x7; sr >>= 3;
xmc[27] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[28] = sr & 0x7; sr >>= 3;
xmc[29] = sr & 0x7; sr >>= 3;
xmc[30] = sr & 0x7; sr >>= 3;
sr = *c++;
xmc[31] = sr & 0x7; sr >>= 3;
xmc[32] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[33] = sr & 0x7; sr >>= 3;
xmc[34] = sr & 0x7; sr >>= 3;
xmc[35] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1; /* 25 */
xmc[36] = sr & 0x7; sr >>= 3;
xmc[37] = sr & 0x7; sr >>= 3;
xmc[38] = sr & 0x7; sr >>= 3;
sr = *c++;
Nc[3] = sr & 0x7f; sr >>= 7;
sr |= (uword)*c++ << 1;
bc[3] = sr & 0x3; sr >>= 2;
Mc[3] = sr & 0x3; sr >>= 2;
sr |= (uword)*c++ << 5;
xmaxc[3] = sr & 0x3f; sr >>= 6;
xmc[39] = sr & 0x7; sr >>= 3;
xmc[40] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[41] = sr & 0x7; sr >>= 3;
xmc[42] = sr & 0x7; sr >>= 3;
xmc[43] = sr & 0x7; sr >>= 3;
sr = *c++; /* 30 */
xmc[44] = sr & 0x7; sr >>= 3;
xmc[45] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 2;
xmc[46] = sr & 0x7; sr >>= 3;
xmc[47] = sr & 0x7; sr >>= 3;
xmc[48] = sr & 0x7; sr >>= 3;
sr |= (uword)*c++ << 1;
xmc[49] = sr & 0x7; sr >>= 3;
xmc[50] = sr & 0x7; sr >>= 3;
xmc[51] = sr & 0x7; sr >>= 3;
}
}
else
#endif
{
/* GSM_MAGIC = (*c >> 4) & 0xF; */
if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
LARc[0] = (*c++ & 0xF) << 2; /* 1 */
LARc[0] |= (*c >> 6) & 0x3;
LARc[1] = *c++ & 0x3F;
LARc[2] = (*c >> 3) & 0x1F;
LARc[3] = (*c++ & 0x7) << 2;
LARc[3] |= (*c >> 6) & 0x3;
LARc[4] = (*c >> 2) & 0xF;
LARc[5] = (*c++ & 0x3) << 2;
LARc[5] |= (*c >> 6) & 0x3;
LARc[6] = (*c >> 3) & 0x7;
LARc[7] = *c++ & 0x7;
Nc[0] = (*c >> 1) & 0x7F;
bc[0] = (*c++ & 0x1) << 1;
bc[0] |= (*c >> 7) & 0x1;
Mc[0] = (*c >> 5) & 0x3;
xmaxc[0] = (*c++ & 0x1F) << 1;
xmaxc[0] |= (*c >> 7) & 0x1;
xmc[0] = (*c >> 4) & 0x7;
xmc[1] = (*c >> 1) & 0x7;
xmc[2] = (*c++ & 0x1) << 2;
xmc[2] |= (*c >> 6) & 0x3;
xmc[3] = (*c >> 3) & 0x7;
xmc[4] = *c++ & 0x7;
xmc[5] = (*c >> 5) & 0x7;
xmc[6] = (*c >> 2) & 0x7;
xmc[7] = (*c++ & 0x3) << 1; /* 10 */
xmc[7] |= (*c >> 7) & 0x1;
xmc[8] = (*c >> 4) & 0x7;
xmc[9] = (*c >> 1) & 0x7;
xmc[10] = (*c++ & 0x1) << 2;
xmc[10] |= (*c >> 6) & 0x3;
xmc[11] = (*c >> 3) & 0x7;
xmc[12] = *c++ & 0x7;
Nc[1] = (*c >> 1) & 0x7F;
bc[1] = (*c++ & 0x1) << 1;
bc[1] |= (*c >> 7) & 0x1;
Mc[1] = (*c >> 5) & 0x3;
xmaxc[1] = (*c++ & 0x1F) << 1;
xmaxc[1] |= (*c >> 7) & 0x1;
xmc[13] = (*c >> 4) & 0x7;
xmc[14] = (*c >> 1) & 0x7;
xmc[15] = (*c++ & 0x1) << 2;
xmc[15] |= (*c >> 6) & 0x3;
xmc[16] = (*c >> 3) & 0x7;
xmc[17] = *c++ & 0x7;
xmc[18] = (*c >> 5) & 0x7;
xmc[19] = (*c >> 2) & 0x7;
xmc[20] = (*c++ & 0x3) << 1;
xmc[20] |= (*c >> 7) & 0x1;
xmc[21] = (*c >> 4) & 0x7;
xmc[22] = (*c >> 1) & 0x7;
xmc[23] = (*c++ & 0x1) << 2;
xmc[23] |= (*c >> 6) & 0x3;
xmc[24] = (*c >> 3) & 0x7;
xmc[25] = *c++ & 0x7;
Nc[2] = (*c >> 1) & 0x7F;
bc[2] = (*c++ & 0x1) << 1; /* 20 */
bc[2] |= (*c >> 7) & 0x1;
Mc[2] = (*c >> 5) & 0x3;
xmaxc[2] = (*c++ & 0x1F) << 1;
xmaxc[2] |= (*c >> 7) & 0x1;
xmc[26] = (*c >> 4) & 0x7;
xmc[27] = (*c >> 1) & 0x7;
xmc[28] = (*c++ & 0x1) << 2;
xmc[28] |= (*c >> 6) & 0x3;
xmc[29] = (*c >> 3) & 0x7;
xmc[30] = *c++ & 0x7;
xmc[31] = (*c >> 5) & 0x7;
xmc[32] = (*c >> 2) & 0x7;
xmc[33] = (*c++ & 0x3) << 1;
xmc[33] |= (*c >> 7) & 0x1;
xmc[34] = (*c >> 4) & 0x7;
xmc[35] = (*c >> 1) & 0x7;
xmc[36] = (*c++ & 0x1) << 2;
xmc[36] |= (*c >> 6) & 0x3;
xmc[37] = (*c >> 3) & 0x7;
xmc[38] = *c++ & 0x7;
Nc[3] = (*c >> 1) & 0x7F;
bc[3] = (*c++ & 0x1) << 1;
bc[3] |= (*c >> 7) & 0x1;
Mc[3] = (*c >> 5) & 0x3;
xmaxc[3] = (*c++ & 0x1F) << 1;
xmaxc[3] |= (*c >> 7) & 0x1;
xmc[39] = (*c >> 4) & 0x7;
xmc[40] = (*c >> 1) & 0x7;
xmc[41] = (*c++ & 0x1) << 2;
xmc[41] |= (*c >> 6) & 0x3;
xmc[42] = (*c >> 3) & 0x7;
xmc[43] = *c++ & 0x7; /* 30 */
xmc[44] = (*c >> 5) & 0x7;
xmc[45] = (*c >> 2) & 0x7;
xmc[46] = (*c++ & 0x3) << 1;
xmc[46] |= (*c >> 7) & 0x1;
xmc[47] = (*c >> 4) & 0x7;
xmc[48] = (*c >> 1) & 0x7;
xmc[49] = (*c++ & 0x1) << 2;
xmc[49] |= (*c >> 6) & 0x3;
xmc[50] = (*c >> 3) & 0x7;
xmc[51] = *c & 0x7; /* 33 */
}
Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target);
return 0;
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: 6a9b6628-821c-4a96-84c1-485ebd35f170
*/

View File

@ -0,0 +1,31 @@
/*
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/
#include "gsm.h"
#include "config.h"
#ifdef HAS_STDLIB_H
# include <stdlib.h>
#else
# ifdef HAS_MALLOC_H
# include <malloc.h>
# else
extern void free();
# endif
#endif
void gsm_destroy (gsm S)
{
if (S) free((char *)S);
}
/*
** Do not edit or modify anything in this comment block.
** The arch-tag line is a file identity tag for the GNU Arch
** revision control system.
**
** arch-tag: f423d09b-6ccc-47e0-9b18-ee1cf7a8e473
*/

Some files were not shown because too many files have changed in this diff Show More