mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 01:49:53 +00:00
First snapshot of the public project.
This commit is contained in:
commit
cb979e10a7
14
AUTHORS
Normal file
14
AUTHORS
Normal 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
COPYING
Normal file
503
COPYING
Normal 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!
|
||||||
|
|
182
INSTALL
Normal file
182
INSTALL
Normal 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.
|
33
Make.bat
Normal file
33
Make.bat
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
if "%1"=="check" GOTO CHECK
|
||||||
|
if "%1"=="clean" GOTO CLEAN
|
||||||
|
|
||||||
|
copy /y Win32\sndfile.h src\sndfile.h
|
||||||
|
copy /y Win32\config.h src\config.h
|
||||||
|
|
||||||
|
nmake -f Win32\Makefile.msvc
|
||||||
|
goto END
|
||||||
|
|
||||||
|
|
||||||
|
:CHECK
|
||||||
|
nmake -f Win32\Makefile.msvc check
|
||||||
|
goto END
|
||||||
|
|
||||||
|
:CLEAN
|
||||||
|
nmake -f Win32\Makefile.msvc clean
|
||||||
|
goto END
|
||||||
|
|
||||||
|
|
||||||
|
:END
|
||||||
|
|
||||||
|
|
||||||
|
goto skipArchTag
|
||||||
|
|
||||||
|
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: 8700080b-8d9a-4852-ad8a-8ecd027f1f61
|
||||||
|
|
||||||
|
:skipArchTag
|
27
Makefile.am
Normal file
27
Makefile.am
Normal 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
|
||||||
|
|
131
NEWS
Normal file
131
NEWS
Normal 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.
|
14
Octave/Makefile.am
Normal file
14
Octave/Makefile.am
Normal 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
|
||||||
|
|
59
Octave/sndfile_load.m
Normal file
59
Octave/sndfile_load.m
Normal 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
|
||||||
|
|
66
Octave/sndfile_play.m
Normal file
66
Octave/sndfile_play.m
Normal 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
|
||||||
|
|
60
Octave/sndfile_save.m
Normal file
60
Octave/sndfile_save.m
Normal 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
README
Normal file
71
README
Normal 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/
|
||||||
|
|
10
Win32/Makefile.am
Normal file
10
Win32/Makefile.am
Normal 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
|
||||||
|
|
401
Win32/Makefile.mingw.in
Normal file
401
Win32/Makefile.mingw.in
Normal file
@ -0,0 +1,401 @@
|
|||||||
|
# MinGW specific Makefile for libsndfile.
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
|
||||||
|
PROGRAMS = sndfile-info.exe sndfile-play.exe sndfile-convert.exe
|
||||||
|
TARGETS = libsndfile.dll $(PROGRAMS) sndfile.pc src/sndfile.h
|
||||||
|
|
||||||
|
AR = @AR@
|
||||||
|
CC = @CC@
|
||||||
|
CFLAGS = @CFLAGS@ -Isrc
|
||||||
|
COMPILER_IS_GCC = @COMPILER_IS_GCC@
|
||||||
|
CPP = @CPP@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CXX = @CXX@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
DLLWRAP = @DLLWRAP@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_DATA = ${INSTALL} -m 644
|
||||||
|
install_sh = @install_sh@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
|
||||||
|
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
|
||||||
|
PEXPORTS = @PEXPORTS@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||||
|
PACKAGE_NAME = @PACKAGE_NAME@
|
||||||
|
PACKAGE_STRING = @PACKAGE_STRING@
|
||||||
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# Target directories.
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
htmldocdir = @htmldocdir@
|
||||||
|
includedir = @includedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
pkgconfigdir = @libdir@/pkgconfig
|
||||||
|
prefix = @prefix@
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# Targets
|
||||||
|
|
||||||
|
all : $(TARGETS)
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm -f $(TARGETS) *.del *.lib src/*.o src/G72x/*.o \
|
||||||
|
src/GSM610/*.o tests/*.o tests/*.exe
|
||||||
|
|
||||||
|
install : $(TARGETS)
|
||||||
|
$(install_sh) -c libsndfile.dll $(libdir)
|
||||||
|
$(install_sh) -c sndfile.pc $(pkgconfigdir)
|
||||||
|
@for prog in $(PROGRAMS); do \
|
||||||
|
echo "installing ... $$prog" ; \
|
||||||
|
$(install_sh) -c "$$prog" $(bindir) ; \
|
||||||
|
done;
|
||||||
|
$(install_sh) -c src/sndfile.h $(includedir)
|
||||||
|
|
||||||
|
uninstall :
|
||||||
|
rm -f $(libdir)/libsndfile.dll
|
||||||
|
rm -f $(pkgconfigdir)/sndfile.pc
|
||||||
|
@for prog in $(PROGRAMS); do \
|
||||||
|
rm -f $(bindir)/"$$prog" ; \
|
||||||
|
done;
|
||||||
|
rm -f $(includedir)/sndfile.h
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
|
||||||
|
LINK_OBJS = \
|
||||||
|
src/GSM610/add.o \
|
||||||
|
src/GSM610/code.o \
|
||||||
|
src/GSM610/decode.o \
|
||||||
|
src/GSM610/gsm_create.o \
|
||||||
|
src/GSM610/gsm_decode.o \
|
||||||
|
src/GSM610/gsm_destroy.o \
|
||||||
|
src/GSM610/gsm_encode.o \
|
||||||
|
src/GSM610/gsm_option.o \
|
||||||
|
src/GSM610/long_term.o \
|
||||||
|
src/GSM610/lpc.o \
|
||||||
|
src/GSM610/preprocess.o \
|
||||||
|
src/GSM610/rpe.o \
|
||||||
|
src/GSM610/short_term.o \
|
||||||
|
src/GSM610/table.o \
|
||||||
|
src/G72x/g721.o \
|
||||||
|
src/G72x/g723_16.o \
|
||||||
|
src/G72x/g723_24.o \
|
||||||
|
src/G72x/g723_40.o \
|
||||||
|
src/G72x/g72x.o \
|
||||||
|
src/aiff.o \
|
||||||
|
src/alaw.o \
|
||||||
|
src/au.o \
|
||||||
|
src/au_g72x.o \
|
||||||
|
src/avr.o \
|
||||||
|
src/common.o \
|
||||||
|
src/double64.o \
|
||||||
|
src/dwvw.o \
|
||||||
|
src/file_io.o \
|
||||||
|
src/dither.o \
|
||||||
|
src/float32.o \
|
||||||
|
src/command.o \
|
||||||
|
src/strings.o \
|
||||||
|
src/ima_adpcm.o \
|
||||||
|
src/ms_adpcm.o \
|
||||||
|
src/nist.o \
|
||||||
|
src/ircam.o \
|
||||||
|
src/paf.o \
|
||||||
|
src/pcm.o \
|
||||||
|
src/raw.o \
|
||||||
|
src/rx2.o \
|
||||||
|
src/sd2.o \
|
||||||
|
src/sndfile.o \
|
||||||
|
src/svx.o \
|
||||||
|
src/txw.o \
|
||||||
|
src/sds.o \
|
||||||
|
src/ulaw.o \
|
||||||
|
src/voc.o \
|
||||||
|
src/w64.o \
|
||||||
|
src/wav.o \
|
||||||
|
src/gsm610.o \
|
||||||
|
src/wav_w64.o \
|
||||||
|
src/dwd.o \
|
||||||
|
src/wve.o \
|
||||||
|
src/mat4.o \
|
||||||
|
src/mat5.o \
|
||||||
|
src/vox_adpcm.o \
|
||||||
|
src/ogg.o \
|
||||||
|
src/pvf.o \
|
||||||
|
src/xi.o \
|
||||||
|
src/htk.o
|
||||||
|
|
||||||
|
libsndfile.dll libsndfile.lib : $(LINK_OBJS)
|
||||||
|
$(DLLWRAP) --def src/libsndfile.def $(LINK_OBJS) --output-lib libsndfile.lib -o libsndfile.dll
|
||||||
|
$(STRIP) libsndfile.dll
|
||||||
|
|
||||||
|
sndfile-info.exe : examples/sndfile-info.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
sndfile-convert.exe : examples/sndfile-convert.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
sndfile-play.exe : examples/sndfile-play.o libsndfile.lib
|
||||||
|
$(CC) $+ -lwinmm -o $@
|
||||||
|
|
||||||
|
generate.exe : examples/generate.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
sndfile.pc : sndfile.pc.in config.status
|
||||||
|
@./config.status $@
|
||||||
|
|
||||||
|
config.status :
|
||||||
|
./configure
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# Testing programs.
|
||||||
|
|
||||||
|
TEST_PROGS = \
|
||||||
|
src/test_file_io.exe \
|
||||||
|
src/test_log_printf.exe \
|
||||||
|
tests/sfversion.exe \
|
||||||
|
tests/error_test.exe \
|
||||||
|
tests/pcm_test.exe \
|
||||||
|
tests/ulaw_test.exe \
|
||||||
|
tests/alaw_test.exe \
|
||||||
|
tests/dwvw_test.exe \
|
||||||
|
tests/command_test.exe \
|
||||||
|
tests/floating_point_test.exe \
|
||||||
|
tests/headerless_test.exe \
|
||||||
|
tests/write_read_test.exe \
|
||||||
|
tests/lossy_comp_test.exe \
|
||||||
|
tests/peak_chunk_test.exe \
|
||||||
|
tests/misc_test.exe \
|
||||||
|
tests/string_test.exe \
|
||||||
|
tests/win32_test.exe \
|
||||||
|
tests/stdio_test.exe \
|
||||||
|
tests/stdin_test.exe \
|
||||||
|
tests/stdout_test.exe \
|
||||||
|
tests/pipe_test.exe \
|
||||||
|
tests/benchmark.exe
|
||||||
|
|
||||||
|
check : $(TEST_PROGS)
|
||||||
|
@echo
|
||||||
|
@echo
|
||||||
|
@echo
|
||||||
|
@echo "============================================================"
|
||||||
|
src/test_file_io.exe
|
||||||
|
src/test_log_printf.exe
|
||||||
|
@echo "============================================================"
|
||||||
|
@echo
|
||||||
|
@echo
|
||||||
|
@echo
|
||||||
|
tests/error_test.exe
|
||||||
|
tests/pcm_test.exe
|
||||||
|
tests/ulaw_test.exe
|
||||||
|
tests/alaw_test.exe
|
||||||
|
tests/dwvw_test.exe
|
||||||
|
tests/command_test.exe ver
|
||||||
|
tests/command_test.exe norm
|
||||||
|
tests/command_test.exe format
|
||||||
|
tests/floating_point_test.exe
|
||||||
|
tests/headerless_test.exe
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo "passed common tests"
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test wav
|
||||||
|
tests/lossy_comp_test wav_ima
|
||||||
|
tests/lossy_comp_test wav_msadpcm
|
||||||
|
tests/lossy_comp_test wav_ulaw
|
||||||
|
tests/lossy_comp_test wav_alaw
|
||||||
|
tests/lossy_comp_test wav_gsm610
|
||||||
|
tests/peak_chunk_test wav
|
||||||
|
tests/misc_test wav
|
||||||
|
tests/string_test wav
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo "passed tests on WAV files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test aiff
|
||||||
|
tests/lossy_comp_test aiff_ulaw
|
||||||
|
tests/lossy_comp_test aiff_alaw
|
||||||
|
tests/peak_chunk_test aiff
|
||||||
|
tests/misc_test aiff
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on AIFF files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test au
|
||||||
|
tests/lossy_comp_test au_ulaw
|
||||||
|
tests/lossy_comp_test au_alaw
|
||||||
|
tests/lossy_comp_test au_g721
|
||||||
|
tests/lossy_comp_test au_g723
|
||||||
|
tests/misc_test au
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on AU files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test raw
|
||||||
|
tests/lossy_comp_test raw_ulaw
|
||||||
|
tests/lossy_comp_test raw_alaw
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on RAW (header-less) files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test paf
|
||||||
|
tests/misc_test paf
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on PAF files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test svx
|
||||||
|
tests/misc_test svx
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on SVX files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test nist
|
||||||
|
tests/misc_test nist
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on NIST files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test ircam
|
||||||
|
tests/lossy_comp_test ircam_ulaw
|
||||||
|
tests/lossy_comp_test ircam_alaw
|
||||||
|
tests/misc_test ircam
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on IRCAM files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test voc
|
||||||
|
tests/lossy_comp_test voc_ulaw
|
||||||
|
tests/lossy_comp_test voc_alaw
|
||||||
|
tests/misc_test voc
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on VOC files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test w64
|
||||||
|
tests/lossy_comp_test w64_ima
|
||||||
|
tests/lossy_comp_test w64_msadpcm
|
||||||
|
tests/lossy_comp_test w64_ulaw
|
||||||
|
tests/lossy_comp_test w64_alaw
|
||||||
|
tests/lossy_comp_test w64_gsm610
|
||||||
|
tests/misc_test w64
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on W64 files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test mat4
|
||||||
|
tests/misc_test mat4
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on MAT4 files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test mat5
|
||||||
|
tests/misc_test mat5
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on MAT5 files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test htk
|
||||||
|
tests/misc_test htk
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on HTK files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
tests/write_read_test avr
|
||||||
|
tests/misc_test avr
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed tests on AVR files."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/stdio_test.exe
|
||||||
|
@tests/pipe_test.exe
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
@tests/sfversion.exe
|
||||||
|
@echo " passed all tests."
|
||||||
|
@echo "----------------------------------------------------------------------"
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# Test programs.
|
||||||
|
|
||||||
|
src/test_file_io.exe : src/file_io.o src/test_file_io.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
# Special case : test_log_printf.c #includes common.c
|
||||||
|
src/test_log_printf.exe : src/test_log_printf.c src/common.c libsndfile.lib
|
||||||
|
$(CC) $(CFLAGS) -c src/test_log_printf.c -o src/test_log_printf.o
|
||||||
|
$(CC) src/test_log_printf.o libsndfile.lib -o $@
|
||||||
|
|
||||||
|
tests/sfversion.exe : tests/sfversion.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/error_test.exe : tests/error_test.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/pcm_test.exe : tests/pcm_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/ulaw_test.exe : tests/ulaw_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/alaw_test.exe : tests/alaw_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/dwvw_test.exe : tests/dwvw_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/command_test.exe : tests/command_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/floating_point_test.exe : tests/floating_point_test.o tests/utils.o tests/dft_cmp.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/headerless_test.exe : tests/headerless_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/write_read_test.exe : tests/write_read_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/lossy_comp_test.exe : tests/lossy_comp_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/peak_chunk_test.exe : tests/peak_chunk_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/misc_test.exe : tests/misc_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/string_test.exe : tests/string_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/win32_test.exe : tests/win32_test.o
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/stdio_test.exe : tests/stdio_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/pipe_test.exe : tests/pipe_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/stdin_test.exe : tests/stdin_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/stdout_test.exe : tests/stdout_test.o tests/utils.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
tests/benchmark.exe : tests/benchmark.o libsndfile.lib
|
||||||
|
$(CC) $+ -o $@
|
||||||
|
|
||||||
|
# End of Makefile
|
||||||
|
#====================================================================
|
||||||
|
# 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: a588878f-6796-4a47-bbef-83a3aaac0983
|
577
Win32/Makefile.msvc
Normal file
577
Win32/Makefile.msvc
Normal file
@ -0,0 +1,577 @@
|
|||||||
|
|
||||||
|
# Set the value of $(MSVCDir) for your installation.
|
||||||
|
# Please note that none of the directory names are allowed to have spaces
|
||||||
|
# in them. You must use the short name.
|
||||||
|
#
|
||||||
|
# "C:\Program Files\Microsoft Visual Studio\VC98" will not work.
|
||||||
|
# "C:\Progra~1\Micros~1\VC98" will work.
|
||||||
|
|
||||||
|
MSVCDir="C:\Progra~1\Micros~1\VC98"
|
||||||
|
|
||||||
|
CPP=cl.exe
|
||||||
|
LINK32=link.exe
|
||||||
|
DLL_LINK_FLAGS=/nologo /dll /incremental:no /libpath:"$(MSVCDir)\Lib" /pdb:"libsndfile.pdb" /implib:".\libsndfile.lib" /machine:I386 /out:"libsndfile.dll"
|
||||||
|
PROG_LINK_FLAGS=/nologo /incremental:no /libpath:"$(MSVCDir)\Lib" /pdb:"libsndfile.pdb" /machine:I386 /exetype:dynamic
|
||||||
|
|
||||||
|
CFLAGS=/nologo /MD /W1 /GX /O2 /I "$(MSVCDir)\Include" /I "src" /D "WIN32" /D "_USRDLL" /D "inline=__inline" /YX /FD
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# Targets
|
||||||
|
|
||||||
|
ALL : libsndfile.dll \
|
||||||
|
"sndfile-info.exe" \
|
||||||
|
"sndfile-convert.exe" \
|
||||||
|
"sndfile-play.exe" \
|
||||||
|
"generate.exe"
|
||||||
|
|
||||||
|
CLEAN :
|
||||||
|
-@erase "src\*.obj"
|
||||||
|
-@erase "src\G72x\*.obj"
|
||||||
|
-@erase "src\GSM610\*.obj"
|
||||||
|
-@erase "tests\*.obj"
|
||||||
|
-@erase "tests\*.exe"
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
|
||||||
|
LINK32_OBJS= \
|
||||||
|
".\src\GSM610\add.obj" \
|
||||||
|
".\src\GSM610\code.obj" \
|
||||||
|
".\src\GSM610\decode.obj" \
|
||||||
|
".\src\GSM610\gsm_create.obj" \
|
||||||
|
".\src\GSM610\gsm_decode.obj" \
|
||||||
|
".\src\GSM610\gsm_destroy.obj" \
|
||||||
|
".\src\GSM610\gsm_encode.obj" \
|
||||||
|
".\src\GSM610\gsm_option.obj" \
|
||||||
|
".\src\GSM610\long_term.obj" \
|
||||||
|
".\src\GSM610\lpc.obj" \
|
||||||
|
".\src\GSM610\preprocess.obj" \
|
||||||
|
".\src\GSM610\rpe.obj" \
|
||||||
|
".\src\GSM610\short_term.obj" \
|
||||||
|
".\src\GSM610\table.obj" \
|
||||||
|
".\src\G72x\g721.obj" \
|
||||||
|
".\src\G72x\g723_16.obj" \
|
||||||
|
".\src\G72x\g723_24.obj" \
|
||||||
|
".\src\G72x\g723_40.obj" \
|
||||||
|
".\src\G72x\g72x.obj" \
|
||||||
|
".\src\aiff.obj" \
|
||||||
|
".\src\alaw.obj" \
|
||||||
|
".\src\au.obj" \
|
||||||
|
".\src\g72x.obj" \
|
||||||
|
".\src\avr.obj" \
|
||||||
|
".\src\common.obj" \
|
||||||
|
".\src\double64.obj" \
|
||||||
|
".\src\dwvw.obj" \
|
||||||
|
".\src\file_io.obj" \
|
||||||
|
".\src\dither.obj" \
|
||||||
|
".\src\float32.obj" \
|
||||||
|
".\src\command.obj" \
|
||||||
|
".\src\strings.obj" \
|
||||||
|
".\src\ima_adpcm.obj" \
|
||||||
|
".\src\ms_adpcm.obj" \
|
||||||
|
".\src\nist.obj" \
|
||||||
|
".\src\ircam.obj" \
|
||||||
|
".\src\paf.obj" \
|
||||||
|
".\src\pcm.obj" \
|
||||||
|
".\src\raw.obj" \
|
||||||
|
".\src\rx2.obj" \
|
||||||
|
".\src\sd2.obj" \
|
||||||
|
".\src\sndfile.obj" \
|
||||||
|
".\src\svx.obj" \
|
||||||
|
".\src\txw.obj" \
|
||||||
|
".\src\sds.obj" \
|
||||||
|
".\src\ulaw.obj" \
|
||||||
|
".\src\voc.obj" \
|
||||||
|
".\src\w64.obj" \
|
||||||
|
".\src\wav.obj" \
|
||||||
|
".\src\gsm610.obj" \
|
||||||
|
".\src\wav_w64.obj" \
|
||||||
|
".\src\dwd.obj" \
|
||||||
|
".\src\wve.obj" \
|
||||||
|
".\src\mat4.obj" \
|
||||||
|
".\src\mat5.obj" \
|
||||||
|
".\src\vox_adpcm.obj" \
|
||||||
|
".\src\ogg.obj" \
|
||||||
|
".\src\pvf.obj" \
|
||||||
|
".\src\xi.obj" \
|
||||||
|
".\src\htk.obj" \
|
||||||
|
".\src\flac.obj" \
|
||||||
|
".\src\caf.obj"
|
||||||
|
|
||||||
|
libsndfile.dll : $(LINK32_OBJS) ".\src\libsndfile.def"
|
||||||
|
$(LINK32) $(DLL_LINK_FLAGS) /def:".\src\libsndfile.def" $(LINK32_OBJS)
|
||||||
|
|
||||||
|
"sndfile-info.exe" : ".\examples\sndfile-info.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\examples\sndfile-info.obj" /c ".\examples\sndfile-info.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:"sndfile-info.exe" ".\examples\sndfile-info.obj" libsndfile.lib
|
||||||
|
|
||||||
|
"sndfile-convert.exe" : ".\examples\sndfile-convert.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\examples\sndfile-convert.obj" /c ".\examples\sndfile-convert.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:"sndfile-convert.exe" ".\examples\sndfile-convert.obj" libsndfile.lib
|
||||||
|
|
||||||
|
"sndfile-play.exe" : ".\examples\sndfile-play.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\examples\sndfile-play.obj" /c ".\examples\sndfile-play.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:"sndfile-play.exe" ".\examples\sndfile-play.obj" libsndfile.lib winmm.lib
|
||||||
|
|
||||||
|
"generate.exe" : ".\examples\generate.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\examples\generate.obj" /c ".\examples\generate.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:"generate.exe" ".\examples\generate.obj" libsndfile.lib
|
||||||
|
|
||||||
|
TEST_PROGS= \
|
||||||
|
".\src\test_file_io.exe" \
|
||||||
|
".\tests\sfversion.exe" \
|
||||||
|
".\tests\error_test.exe" \
|
||||||
|
".\tests\pcm_test.exe" \
|
||||||
|
".\tests\ulaw_test.exe" \
|
||||||
|
".\tests\alaw_test.exe" \
|
||||||
|
".\tests\dwvw_test.exe" \
|
||||||
|
".\tests\command_test.exe" \
|
||||||
|
".\tests\floating_point_test.exe" \
|
||||||
|
".\tests\headerless_test.exe" \
|
||||||
|
".\tests\write_read_test.exe" \
|
||||||
|
".\tests\lossy_comp_test.exe" \
|
||||||
|
".\tests\peak_chunk_test.exe" \
|
||||||
|
".\tests\misc_test.exe" \
|
||||||
|
".\tests\string_test.exe" \
|
||||||
|
".\tests\win32_test.exe" \
|
||||||
|
".\tests\stdio_test.exe" \
|
||||||
|
".\tests\pipe_test.exe" \
|
||||||
|
".\tests\benchmark.exe"
|
||||||
|
|
||||||
|
CHECK: $(TEST_PROGS)
|
||||||
|
".\src\test_file_io.exe"
|
||||||
|
".\tests\error_test.exe"
|
||||||
|
".\tests\pcm_test.exe"
|
||||||
|
".\tests\ulaw_test.exe"
|
||||||
|
".\tests\alaw_test.exe"
|
||||||
|
".\tests\dwvw_test.exe"
|
||||||
|
".\tests\command_test.exe" ver
|
||||||
|
".\tests\command_test.exe" norm
|
||||||
|
".\tests\command_test.exe" format
|
||||||
|
".\tests\floating_point_test.exe"
|
||||||
|
".\tests\headerless_test.exe"
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo passed common tests
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" wav
|
||||||
|
".\tests\lossy_comp_test" wav_ima
|
||||||
|
".\tests\lossy_comp_test" wav_msadpcm
|
||||||
|
".\tests\lossy_comp_test" wav_ulaw
|
||||||
|
".\tests\lossy_comp_test" wav_alaw
|
||||||
|
".\tests\lossy_comp_test" wav_gsm610
|
||||||
|
".\tests\peak_chunk_test" wav
|
||||||
|
".\tests\misc_test" wav
|
||||||
|
".\tests\string_test" wav
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo "passed tests on WAV files.
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" aiff
|
||||||
|
".\tests\lossy_comp_test" aiff_ulaw
|
||||||
|
".\tests\lossy_comp_test" aiff_alaw
|
||||||
|
".\tests\peak_chunk_test" aiff
|
||||||
|
".\tests\misc_test" aiff
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on AIFF files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" au
|
||||||
|
".\tests\lossy_comp_test" au_ulaw
|
||||||
|
".\tests\lossy_comp_test" au_alaw
|
||||||
|
".\tests\lossy_comp_test" au_g721
|
||||||
|
".\tests\lossy_comp_test" au_g723
|
||||||
|
".\tests\misc_test" au
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on AU files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" caf
|
||||||
|
".\tests\lossy_comp_test" caf_ulaw
|
||||||
|
".\tests\lossy_comp_test" caf_alaw
|
||||||
|
".\tests\misc_test" caf
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@echo `./sfversion` passed tests on CAF files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" raw
|
||||||
|
".\tests\lossy_comp_test" raw_ulaw
|
||||||
|
".\tests\lossy_comp_test" raw_alaw
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on RAW (header-less) files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" paf
|
||||||
|
".\tests\misc_test" paf
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on PAF files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" svx
|
||||||
|
".\tests\misc_test" svx
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on SVX files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" nist
|
||||||
|
".\tests\misc_test" nist
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on NIST files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" ircam
|
||||||
|
".\tests\lossy_comp_test" ircam_ulaw
|
||||||
|
".\tests\lossy_comp_test" ircam_alaw
|
||||||
|
".\tests\misc_test" ircam
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on IRCAM files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" voc
|
||||||
|
".\tests\lossy_comp_test" voc_ulaw
|
||||||
|
".\tests\lossy_comp_test" voc_alaw
|
||||||
|
".\tests\misc_test" voc
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on VOC files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" w64
|
||||||
|
".\tests\lossy_comp_test" w64_ima
|
||||||
|
".\tests\lossy_comp_test" w64_msadpcm
|
||||||
|
".\tests\lossy_comp_test" w64_ulaw
|
||||||
|
".\tests\lossy_comp_test" w64_alaw
|
||||||
|
".\tests\lossy_comp_test" w64_gsm610
|
||||||
|
".\tests\misc_test" w64
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on W64 files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" mat4
|
||||||
|
".\tests\misc_test" mat4
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on MAT4 files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" mat5
|
||||||
|
".\tests\misc_test" mat5
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on MAT5 files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" htk
|
||||||
|
".\tests\misc_test" htk
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on HTK files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
".\tests\write_read_test" avr
|
||||||
|
".\tests\misc_test" avr
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed tests on AVR files."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\stdio_test.exe"
|
||||||
|
-@".\tests\pipe_test.exe"
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
-@".\tests\sfversion.exe"
|
||||||
|
-@echo " passed all tests."
|
||||||
|
-@echo ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# C files in src\GSM610.
|
||||||
|
|
||||||
|
".\src\GSM610\add.obj" : ".\src\Gsm610\add.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\add.obj" /c ".\src\Gsm610\add.c"
|
||||||
|
|
||||||
|
".\src\GSM610\code.obj" : ".\src\Gsm610\code.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\code.obj" /c ".\src\Gsm610\code.c"
|
||||||
|
|
||||||
|
".\src\GSM610\decode.obj" : ".\src\Gsm610\decode.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\decode.obj" /c ".\src\Gsm610\decode.c"
|
||||||
|
|
||||||
|
".\src\GSM610\gsm_create.obj" : ".\src\Gsm610\gsm_create.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_create.obj" /c ".\src\Gsm610\gsm_create.c"
|
||||||
|
|
||||||
|
".\src\GSM610\gsm_decode.obj" : ".\src\Gsm610\gsm_decode.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_decode.obj" /c ".\src\Gsm610\gsm_decode.c"
|
||||||
|
|
||||||
|
".\src\GSM610\gsm_destroy.obj" : ".\src\Gsm610\gsm_destroy.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_destroy.obj" /c ".\src\Gsm610\gsm_destroy.c"
|
||||||
|
|
||||||
|
".\src\GSM610\gsm_encode.obj" : ".\src\Gsm610\gsm_encode.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_encode.obj" /c ".\src\Gsm610\gsm_encode.c"
|
||||||
|
|
||||||
|
".\src\GSM610\gsm_option.obj" : ".\src\Gsm610\gsm_option.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\gsm_option.obj" /c ".\src\Gsm610\gsm_option.c"
|
||||||
|
|
||||||
|
".\src\GSM610\long_term.obj" : ".\src\Gsm610\long_term.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\long_term.obj" /c ".\src\Gsm610\long_term.c"
|
||||||
|
|
||||||
|
".\src\GSM610\lpc.obj" : ".\src\Gsm610\lpc.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\lpc.obj" /c ".\src\Gsm610\lpc.c"
|
||||||
|
|
||||||
|
".\src\GSM610\preprocess.obj" : ".\src\Gsm610\preprocess.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\preprocess.obj" /c ".\src\Gsm610\preprocess.c"
|
||||||
|
|
||||||
|
".\src\GSM610\rpe.obj" : ".\src\Gsm610\rpe.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\rpe.obj" /c ".\src\Gsm610\rpe.c"
|
||||||
|
|
||||||
|
".\src\GSM610\short_term.obj" : ".\src\Gsm610\short_term.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\short_term.obj" /c ".\src\Gsm610\short_term.c"
|
||||||
|
|
||||||
|
".\src\GSM610\table.obj" : ".\src\Gsm610\table.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\Gsm610\table.obj" /c ".\src\Gsm610\table.c"
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# C files in src\G72x.
|
||||||
|
|
||||||
|
".\src\G72x\g721.obj" : ".\src\G72x\g721.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\G72x\g721.obj" /c ".\src\G72x\g721.c"
|
||||||
|
|
||||||
|
".\src\G72x\g723_16.obj" : ".\src\G72x\g723_16.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\G72x\g723_16.obj" /c ".\src\G72x\g723_16.c"
|
||||||
|
|
||||||
|
".\src\G72x\g723_24.obj" : ".\src\G72x\g723_24.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\G72x\g723_24.obj" /c ".\src\G72x\g723_24.c"
|
||||||
|
|
||||||
|
".\src\G72x\g723_40.obj" : ".\src\G72x\g723_40.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\G72x\g723_40.obj" /c ".\src\G72x\g723_40.c"
|
||||||
|
|
||||||
|
".\src\G72x\g72x.obj" : ".\src\G72x\g72x.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\G72x\g72x.obj" /c ".\src\G72x\g72x.c"
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# C files in src.
|
||||||
|
|
||||||
|
".\src\aiff.obj" : ".\src\aiff.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\aiff.obj" /c ".\src\aiff.c"
|
||||||
|
|
||||||
|
".\src\alaw.obj" : ".\src\alaw.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\alaw.obj" /c ".\src\alaw.c"
|
||||||
|
|
||||||
|
".\src\au.obj" : ".\src\au.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\au.obj" /c ".\src\au.c"
|
||||||
|
|
||||||
|
".\src\g72x.obj" : ".\src\g72x.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\g72x.obj" /c ".\src\g72x.c"
|
||||||
|
|
||||||
|
".\src\avr.obj" : ".\src\avr.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\avr.obj" /c ".\src\avr.c"
|
||||||
|
|
||||||
|
".\src\common.obj" : ".\src\common.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\common.obj" /c ".\src\common.c"
|
||||||
|
|
||||||
|
".\src\double64.obj" : ".\src\double64.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\double64.obj" /c ".\src\double64.c"
|
||||||
|
|
||||||
|
".\src\dwvw.obj" : ".\src\dwvw.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\dwvw.obj" /c ".\src\dwvw.c"
|
||||||
|
|
||||||
|
".\src\file_io.obj" : ".\src\file_io.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\file_io.obj" /c ".\src\file_io.c"
|
||||||
|
|
||||||
|
".\src\dither.obj" : ".\src\dither.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\dither.obj" /c ".\src\dither.c"
|
||||||
|
|
||||||
|
".\src\float32.obj" : ".\src\float32.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\float32.obj" /c ".\src\float32.c"
|
||||||
|
|
||||||
|
".\src\command.obj" : ".\src\command.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\command.obj" /c ".\src\command.c"
|
||||||
|
|
||||||
|
".\src\strings.obj" : ".\src\strings.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\strings.obj" /c ".\src\strings.c"
|
||||||
|
|
||||||
|
".\src\ima_adpcm.obj" : ".\src\ima_adpcm.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\ima_adpcm.obj" /c ".\src\ima_adpcm.c"
|
||||||
|
|
||||||
|
".\src\ircam.obj" : ".\src\ircam.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\ircam.obj" /c ".\src\ircam.c"
|
||||||
|
|
||||||
|
".\src\ms_adpcm.obj" : ".\src\ms_adpcm.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\ms_adpcm.obj" /c ".\src\ms_adpcm.c"
|
||||||
|
|
||||||
|
".\src\nist.obj" : ".\src\nist.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\nist.obj" /c ".\src\nist.c"
|
||||||
|
|
||||||
|
".\src\paf.obj" : ".\src\paf.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\paf.obj" /c ".\src\paf.c"
|
||||||
|
|
||||||
|
".\src\pcm.obj" : ".\src\pcm.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\pcm.obj" /c ".\src\pcm.c"
|
||||||
|
|
||||||
|
".\src\raw.obj" : ".\src\raw.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\raw.obj" /c ".\src\raw.c"
|
||||||
|
|
||||||
|
".\src\rx2.obj" : ".\src\rx2.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\rx2.obj" /c ".\src\rx2.c"
|
||||||
|
|
||||||
|
".\src\sd2.obj" : ".\src\sd2.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\sd2.obj" /c ".\src\sd2.c"
|
||||||
|
|
||||||
|
".\src\sndfile.obj" : ".\src\sndfile.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\sndfile.obj" /c ".\src\sndfile.c"
|
||||||
|
|
||||||
|
".\src\svx.obj" : ".\src\svx.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\svx.obj" /c ".\src\svx.c"
|
||||||
|
|
||||||
|
".\src\txw.obj" : ".\src\txw.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\txw.obj" /c ".\src\txw.c"
|
||||||
|
|
||||||
|
".\src\sds.obj" : ".\src\sds.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\sds.obj" /c ".\src\sds.c"
|
||||||
|
|
||||||
|
".\src\ulaw.obj" : ".\src\ulaw.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\ulaw.obj" /c ".\src\ulaw.c"
|
||||||
|
|
||||||
|
".\src\voc.obj" : ".\src\voc.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\voc.obj" /c ".\src\voc.c"
|
||||||
|
|
||||||
|
".\src\w64.obj" : ".\src\w64.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\w64.obj" /c ".\src\w64.c"
|
||||||
|
|
||||||
|
".\src\wav.obj" : ".\src\wav.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\wav.obj" /c ".\src\wav.c"
|
||||||
|
|
||||||
|
".\src\gsm610.obj" : ".\src\gsm610.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\gsm610.obj" /c ".\src\gsm610.c"
|
||||||
|
|
||||||
|
".\src\wav_w64.obj" : ".\src\wav_w64.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\wav_w64.obj" /c ".\src\wav_w64.c"
|
||||||
|
|
||||||
|
".\src\dwd.obj" : ".\src\dwd.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\dwd.obj" /c ".\src\dwd.c"
|
||||||
|
|
||||||
|
".\src\wve.obj" : ".\src\wve.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\wve.obj" /c ".\src\wve.c"
|
||||||
|
|
||||||
|
".\src\mat4.obj" : ".\src\mat4.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\mat4.obj" /c ".\src\mat4.c"
|
||||||
|
|
||||||
|
".\src\mat5.obj" : ".\src\mat5.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\mat5.obj" /c ".\src\mat5.c"
|
||||||
|
|
||||||
|
".\src\vox_adpcm.obj" : ".\src\vox_adpcm.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\vox_adpcm.obj" /c ".\src\vox_adpcm.c"
|
||||||
|
|
||||||
|
".\src\ogg.obj" : ".\src\ogg.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\ogg.obj" /c ".\src\ogg.c"
|
||||||
|
|
||||||
|
".\src\pvf.obj" : ".\src\pvf.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\pvf.obj" /c ".\src\pvf.c"
|
||||||
|
|
||||||
|
".\src\xi.obj" : ".\src\xi.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\xi.obj" /c ".\src\xi.c"
|
||||||
|
|
||||||
|
".\src\htk.obj" : ".\src\htk.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\htk.obj" /c ".\src\htk.c"
|
||||||
|
|
||||||
|
".\src\flac.obj" : ".\src\flac.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\flac.obj" /c ".\src\flac.c"
|
||||||
|
|
||||||
|
".\src\caf.obj" : ".\src\caf.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\caf.obj" /c ".\src\caf.c"
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# Object files for test programs.
|
||||||
|
|
||||||
|
".\tests\utils.obj" : ".\tests\utils.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\utils.obj" /c ".\tests\utils.c"
|
||||||
|
|
||||||
|
".\tests\dft_cmp.obj" : ".\tests\dft_cmp.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\dft_cmp.obj" /c ".\tests\dft_cmp.c"
|
||||||
|
|
||||||
|
#====================================================================
|
||||||
|
# Test programs.
|
||||||
|
|
||||||
|
".\src\test_file_io.exe" : ".\src\file_io.obj" ".\src\test_file_io.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\src\test_file_io.obj" /c ".\src\test_file_io.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\src\test_file_io.exe" ".\src\test_file_io.obj" ".\src\file_io.obj"
|
||||||
|
|
||||||
|
".\tests\sfversion.exe" : ".\tests\sfversion.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\sfversion.obj" /c ".\tests\sfversion.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\sfversion.exe" ".\tests\sfversion.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\error_test.exe" : ".\tests\error_test.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\error_test.obj" /c ".\tests\error_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\error_test.exe" ".\tests\error_test.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\pcm_test.exe" : ".\tests\pcm_test.c" ".\tests\utils.obj" "libsndfile.dll"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\pcm_test.obj" /c ".\tests\pcm_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\pcm_test.exe" ".\tests\pcm_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\ulaw_test.exe" : ".\tests\ulaw_test.c" ".\tests\utils.obj" "libsndfile.dll"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\ulaw_test.obj" /c ".\tests\ulaw_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\ulaw_test.exe" ".\tests\ulaw_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\alaw_test.exe" : ".\tests\alaw_test.c" ".\tests\utils.obj" "libsndfile.dll"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\alaw_test.obj" /c ".\tests\alaw_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\alaw_test.exe" ".\tests\alaw_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\dwvw_test.exe" : ".\tests\dwvw_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\dwvw_test.obj" /c ".\tests\dwvw_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\dwvw_test.exe" ".\tests\dwvw_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\command_test.exe" : ".\tests\command_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\command_test.obj" /c ".\tests\command_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\command_test.exe" ".\tests\command_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\floating_point_test.exe" : ".\tests\floating_point_test.c" ".\tests\utils.obj" ".\tests\dft_cmp.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\floating_point_test.obj" /c ".\tests\floating_point_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\floating_point_test.exe" ".\tests\floating_point_test.obj" ".\tests\utils.obj" ".\tests\dft_cmp.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\headerless_test.exe" : ".\tests\headerless_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\headerless_test.obj" /c ".\tests\headerless_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\headerless_test.exe" ".\tests\headerless_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\write_read_test.exe" : ".\tests\write_read_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\write_read_test.obj" /c ".\tests\write_read_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\write_read_test.exe" ".\tests\write_read_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\lossy_comp_test.exe" : ".\tests\lossy_comp_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\lossy_comp_test.obj" /c ".\tests\lossy_comp_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\lossy_comp_test.exe" ".\tests\lossy_comp_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\peak_chunk_test.exe" : ".\tests\peak_chunk_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\peak_chunk_test.obj" /c ".\tests\peak_chunk_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\peak_chunk_test.exe" ".\tests\peak_chunk_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\misc_test.exe" : ".\tests\misc_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\misc_test.obj" /c ".\tests\misc_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\misc_test.exe" ".\tests\misc_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\string_test.exe" : ".\tests\string_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\string_test.obj" /c ".\tests\string_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\string_test.exe" ".\tests\string_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\win32_test.exe" : ".\tests\win32_test.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\win32_test.obj" /c ".\tests\win32_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\win32_test.exe" ".\tests\win32_test.obj"
|
||||||
|
|
||||||
|
".\tests\stdio_test.exe" : ".\tests\stdio_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\stdio_test.obj" /c ".\tests\stdio_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\stdio_test.exe" ".\tests\stdio_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\pipe_test.exe" : ".\tests\pipe_test.c" ".\tests\utils.obj"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\pipe_test.obj" /c ".\tests\pipe_test.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\pipe_test.exe" ".\tests\pipe_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
# ".\tests\stdin_test.exe" : ".\tests\stdin_test.c" ".\tests\utils.obj"
|
||||||
|
# $(CPP) $(CFLAGS) /Fo".\tests\stdin_test.obj" /c ".\tests\stdin_test.c"
|
||||||
|
# $(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\stdin_test.exe" ".\tests\stdin_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
#
|
||||||
|
# ".\tests\stdout_test.exe" : ".\tests\stdout_test.c" ".\tests\utils.obj"
|
||||||
|
# $(CPP) $(CFLAGS) /Fo".\tests\stdout_test.obj" /c ".\tests\stdout_test.c"
|
||||||
|
# $(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\stdout_test.exe" ".\tests\stdout_test.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
".\tests\benchmark.exe" : ".\tests\benchmark.c"
|
||||||
|
$(CPP) $(CFLAGS) /Fo".\tests\benchmark.obj" /c ".\tests\benchmark.c"
|
||||||
|
$(LINK32) $(PROG_LINK_FLAGS) /out:".\tests\benchmark.exe" ".\tests\benchmark.obj" ".\tests\utils.obj" libsndfile.lib
|
||||||
|
|
||||||
|
# End of Makefile
|
||||||
|
#====================================================================
|
||||||
|
|
||||||
|
# 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: 9a46d08e-921f-49f7-961e-3f21ea67851e
|
||||||
|
|
96
Win32/README-Win32.txt
Normal file
96
Win32/README-Win32.txt
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
NOTE: This is not the way the author builds libsndfile on Win32
|
||||||
|
so this desciption may be out of date. For the authors method
|
||||||
|
of building libsndfile on Win32 have a look at the file named
|
||||||
|
win32.html in the doc\ directory of the source code distribution.
|
||||||
|
|
||||||
|
*****************************************************************
|
||||||
|
|
||||||
|
This is the readme-Win32.txt file associated with the LibSndFile
|
||||||
|
library. It describes how the included workspace and project
|
||||||
|
was created for Microsoft Visual C++ developer's studio (MSVC),
|
||||||
|
version 5.0. Skip to point 7 if you wish to create a new
|
||||||
|
project for building an executable.
|
||||||
|
|
||||||
|
1. Extracted libsndfile.zip to d:\files\msvc\
|
||||||
|
|
||||||
|
2. It created (replace X.Y.Z with the libsndfile version number)
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\Win32 *
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\src *
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\tests *
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\examples
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\doc
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\m4
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\MacOS
|
||||||
|
|
||||||
|
* are needed for this example
|
||||||
|
|
||||||
|
3. From MSVC:New->Workspace, I created LibSndFileWorkspace at:
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\Win32\
|
||||||
|
(workspace files have the extension .dsw)
|
||||||
|
|
||||||
|
3. In MSVC, rt-click on "Workspace LibSndFileWorkspace" and add project:
|
||||||
|
Project type: Win32 Static Library
|
||||||
|
Project Name: LibSndFile
|
||||||
|
Project Location: D:\files\msvc\libsndfile-X.Y.Z\Win32
|
||||||
|
Select button: 'Add to current workspace'
|
||||||
|
Platforms: Win32
|
||||||
|
|
||||||
|
4. Rt-click newly formed "LibSndFile files" and add files:
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\src\*.*
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\src\Gsm610\*.*
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\src\G72x\*.*
|
||||||
|
|
||||||
|
5. Rt-click 'LibSndFile files' and go to Settings
|
||||||
|
a. Select all configurations on the left hand side
|
||||||
|
b. Then select C/C++/Preprocessor and add
|
||||||
|
"..\" (no quotes) to 'Additional include directories'
|
||||||
|
(This allows ..Win32\config.h and unistd.h to be found.)
|
||||||
|
|
||||||
|
6. At this point you should be able to build the library. The output
|
||||||
|
will be found in ..\Win32\LibSndFile\Debug\LibSndFile.lib. You can
|
||||||
|
change the LibSndFile project to Release and a similar release
|
||||||
|
path will be created.
|
||||||
|
|
||||||
|
The following describes how to add an application project to the
|
||||||
|
workspace. You may add as many as you wish. In general, you will
|
||||||
|
need one project for each executable you want to create.
|
||||||
|
|
||||||
|
7. Rt-click LibSndFileWorkspace and select 'Add project'
|
||||||
|
Project type: Win32 Console Application
|
||||||
|
Project Name: sfversion
|
||||||
|
Location: d:\files\msvc\libsndfile-X.Y.Z\Win32\sfversion
|
||||||
|
Select button: 'Add to current workspace'
|
||||||
|
Platforms: Win32
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
- MSVC will create a directory ..\Win32\sfversion\
|
||||||
|
- MSVC will create the file sfversion.dsp in this directory
|
||||||
|
|
||||||
|
8. Rt-click 'sfversion files' and add file:
|
||||||
|
d:\files\msvc\libsndfile-X.Y.Z\tests\sfversion.c
|
||||||
|
|
||||||
|
9. Rt-click 'sfversion files' and go to Settings:
|
||||||
|
a. Select 'All configurations' on the left hand side
|
||||||
|
b. Then select C/C++/Preprocessor and add
|
||||||
|
"..\..\src,..\" (no quotes) to 'Additional include directories'
|
||||||
|
|
||||||
|
9. Rt-click 'sfversion files' and go to Settings:
|
||||||
|
a. Select 'Debug Configuration' on left hand side
|
||||||
|
b. Then select Link tab and add
|
||||||
|
"..\LibSndFile\Debug\LibSndFile.lib " (no quotes) to
|
||||||
|
the list of 'Object/library modules'. Leave a space between new
|
||||||
|
addition existing lib files.
|
||||||
|
|
||||||
|
10. Repeat above for Release build adding Release path info.
|
||||||
|
|
||||||
|
11. Build your application, it should link and create an .exe
|
||||||
|
|
||||||
|
Final notes:
|
||||||
|
|
||||||
|
Files created during build by msvc but are not needed for archive:
|
||||||
|
*ncb *.plg *.opt *.obj *.idb *.pch *.lib *.exe
|
||||||
|
|
||||||
|
Files associated with LibSndFile but not used by msvc:
|
||||||
|
Makefile.in
|
||||||
|
Makefile.am
|
||||||
|
- End -
|
40
Win32/README-precompiled-dll.txt
Normal file
40
Win32/README-precompiled-dll.txt
Normal 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.
|
290
Win32/config.h
Normal file
290
Win32/config.h
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
/*
|
||||||
|
** Copyright (C) 2002-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 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 is the Win32 version of the file config.h which is autogenerated
|
||||||
|
** on Unix systems.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma warning (disable : 4244)
|
||||||
|
#pragma warning (disable : 4761)
|
||||||
|
|
||||||
|
/* Set to 1 if the compile is GNU GCC. */
|
||||||
|
/* #undef COMPILER_IS_GCC */
|
||||||
|
|
||||||
|
/* Target processor clips on negative float to int conversion. */
|
||||||
|
#define CPU_CLIPS_NEGATIVE 1
|
||||||
|
|
||||||
|
/* Target processor clips on positive float to int conversion. */
|
||||||
|
#define CPU_CLIPS_POSITIVE 0
|
||||||
|
|
||||||
|
/* Target processor is big endian. */
|
||||||
|
#define CPU_IS_BIG_ENDIAN 0
|
||||||
|
|
||||||
|
/* Target processor is little endian. */
|
||||||
|
#define CPU_IS_LITTLE_ENDIAN 1
|
||||||
|
|
||||||
|
/* Set to 1 to enable experimental code. */
|
||||||
|
#define ENABLE_EXPERIMENTAL_CODE 0
|
||||||
|
|
||||||
|
/* Major version of GCC or 3 otherwise. */
|
||||||
|
/* #undef GCC_MAJOR_VERSION */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
|
||||||
|
/* #undef HAVE_ALSA_ASOUNDLIB_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <byteswap.h> header file. */
|
||||||
|
/* #undef HAVE_BYTESWAP_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `calloc' function. */
|
||||||
|
#define HAVE_CALLOC 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `ceil' function. */
|
||||||
|
#define HAVE_CEIL 1
|
||||||
|
|
||||||
|
/* Set to 1 if S_IRGRP is defined. */
|
||||||
|
#define HAVE_DECL_S_IRGRP 0
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
/* #undef HAVE_DLFCN_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <endian.h> header file. */
|
||||||
|
/* #undef HAVE_ENDIAN_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fdatasync' function. */
|
||||||
|
|
||||||
|
/* #undef HAVE_FDATASYNC */
|
||||||
|
|
||||||
|
/* Define to 1 if you have libflac 1.1.1 */
|
||||||
|
/* #undef HAVE_FLAC_1_1_1 1 */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <FLAC/all.h> header file. */
|
||||||
|
/* #undef HAVE_FLAC_ALL_H 1 */
|
||||||
|
|
||||||
|
/* Set to 1 if the compile supports the struct hack. */
|
||||||
|
#define HAVE_FLEXIBLE_ARRAY 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `floor' function. */
|
||||||
|
#define HAVE_FLOOR 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fmod' function. */
|
||||||
|
#define HAVE_FMOD 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `free' function. */
|
||||||
|
#define HAVE_FREE 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fstat' function. */
|
||||||
|
#define HAVE_FSTAT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fsync' function. */
|
||||||
|
/* #undef HAVE_FSYNC */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `ftruncate' function. */
|
||||||
|
/* #undef HAVE_FTRUNCATE */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpagesize' function. */
|
||||||
|
#define HAVE_GETPAGESIZE 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `gmtime' function. */
|
||||||
|
#define HAVE_GMTIME 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `gmtime_r' function. */
|
||||||
|
/* #undef HAVE_GMTIME_R */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
/* #undef HAVE_INTTYPES_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `m' library (-lm). */
|
||||||
|
#define HAVE_LIBM 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <locale.h> header file. */
|
||||||
|
/* #undef HAVE_LOCALE_H */
|
||||||
|
|
||||||
|
/* Define if you have C99's lrint function. */
|
||||||
|
/* #undef HAVE_LRINT */
|
||||||
|
|
||||||
|
/* Define if you have C99's lrintf function. */
|
||||||
|
/* #undef HAVE_LRINTF */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `lseek' function. */
|
||||||
|
#define HAVE_LSEEK 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `malloc' function. */
|
||||||
|
#define HAVE_MALLOC 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mmap' function. */
|
||||||
|
/* #undef HAVE_MMAP */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `open' function. */
|
||||||
|
#define HAVE_OPEN 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pread' function. */
|
||||||
|
/* #undef HAVE_PREAD */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pwrite' function. */
|
||||||
|
/* #undef HAVE_PWRITE */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `read' function. */
|
||||||
|
#define HAVE_READ 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `realloc' function. */
|
||||||
|
#define HAVE_REALLOC 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `setlocale' function. */
|
||||||
|
/* #undef HAVE_SETLOCALE */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `snprintf' function. */
|
||||||
|
#define HAVE_SNPRINTF 1
|
||||||
|
|
||||||
|
/* Set to 1 if you have libsqlite3. */
|
||||||
|
/* #undef HAVE_SQLITE3 */
|
||||||
|
|
||||||
|
/* Define to 1 if the system has the type `ssize_t'. */
|
||||||
|
/* #undef HAVE_SSIZE_T */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
/* #undef HAVE_STDINT_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||||
|
/* #undef HAVE_SYS_WAIT_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
/* #undef HAVE_UNISTD_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vsnprintf' function. */
|
||||||
|
#define HAVE_VSNPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `write' function. */
|
||||||
|
#define HAVE_WRITE 1
|
||||||
|
|
||||||
|
/* Set to 1 if compiling for MacOSX */
|
||||||
|
#define OS_IS_MACOSX 0
|
||||||
|
|
||||||
|
/* Set to 1 if compiling for Win32 */
|
||||||
|
#define OS_IS_WIN32 1
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#define PACKAGE "libsndfile"
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#define PACKAGE_BUGREPORT "erikd@mega-nerd.com"
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#define PACKAGE_NAME "libsndfile"
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#define PACKAGE_STRING "libsndfile 1.0.13"
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#define PACKAGE_TARNAME "libsndfile"
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#define PACKAGE_VERSION "1.0.13"
|
||||||
|
|
||||||
|
/* Set to maximum allowed value of sf_count_t type. */
|
||||||
|
#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFi64
|
||||||
|
|
||||||
|
/* The size of a `double', as computed by sizeof. */
|
||||||
|
#define SIZEOF_DOUBLE 8
|
||||||
|
|
||||||
|
/* The size of a `float', as computed by sizeof. */
|
||||||
|
#define SIZEOF_FLOAT 4
|
||||||
|
|
||||||
|
/* The size of a `int', as computed by sizeof. */
|
||||||
|
#define SIZEOF_INT 4
|
||||||
|
|
||||||
|
/* The size of a `int64_t', as computed by sizeof. */
|
||||||
|
#define SIZEOF_INT64_T 0
|
||||||
|
|
||||||
|
/* The size of a `loff_t', as computed by sizeof. */
|
||||||
|
#define SIZEOF_LOFF_T 0
|
||||||
|
|
||||||
|
/* The size of a `long', as computed by sizeof. */
|
||||||
|
#define SIZEOF_LONG 4
|
||||||
|
|
||||||
|
/* The size of a `long long', as computed by sizeof. */
|
||||||
|
#define SIZEOF_LONG_LONG 0
|
||||||
|
|
||||||
|
/* The size of a `off64_t', as computed by sizeof. */
|
||||||
|
/* #undef SIZEOF_OFF64_T */
|
||||||
|
|
||||||
|
/* The size of a `off_t', as computed by sizeof. */
|
||||||
|
#define SIZEOF_OFF_T 4
|
||||||
|
|
||||||
|
/* Set to sizeof (long) if unknown. */
|
||||||
|
#define SIZEOF_SF_COUNT_T 8
|
||||||
|
|
||||||
|
/* The size of a `short', as computed by sizeof. */
|
||||||
|
#define SIZEOF_SHORT 2
|
||||||
|
|
||||||
|
/* The size of a `size_t', as computed by sizeof. */
|
||||||
|
#define SIZEOF_SIZE_T 4
|
||||||
|
|
||||||
|
/* The size of a `ssize_t', as computed by sizeof. */
|
||||||
|
#define SIZEOF_SSIZE_T 4
|
||||||
|
|
||||||
|
/* The size of a `void*', as computed by sizeof. */
|
||||||
|
#define SIZEOF_VOIDP 4
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Set to long if unknown. */
|
||||||
|
#define TYPEOF_SF_COUNT_T loff_t
|
||||||
|
|
||||||
|
/* Set to 1 to use the native windows API */
|
||||||
|
#define USE_WINDOWS_API 1
|
||||||
|
|
||||||
|
/* Version number of package */
|
||||||
|
#define VERSION "1.0.13"
|
||||||
|
|
||||||
|
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||||
|
/* #undef _FILE_OFFSET_BITS */
|
||||||
|
|
||||||
|
/* Define to make fseeko etc. visible, on some hosts. */
|
||||||
|
/* #undef _LARGEFILE_SOURCE */
|
||||||
|
|
||||||
|
/* Define for large files, on AIX-style hosts. */
|
||||||
|
/* #undef _LARGE_FILES */
|
||||||
|
|
||||||
|
/*
|
||||||
|
** 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: 78a733c0-a430-46bd-81ab-4e479fbcffac
|
||||||
|
*/
|
||||||
|
|
7273
Win32/libtool.mingw
Normal file
7273
Win32/libtool.mingw
Normal file
File diff suppressed because it is too large
Load Diff
539
Win32/sndfile.h
Normal file
539
Win32/sndfile.h
Normal file
@ -0,0 +1,539 @@
|
|||||||
|
/*
|
||||||
|
** 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 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** sndfile.h -- system-wide definitions
|
||||||
|
**
|
||||||
|
** API documentation is in the doc/ directory of the source code tarball
|
||||||
|
** and at http://www.mega-nerd.com/libsndfile/api.html.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SNDFILE_H
|
||||||
|
#define SNDFILE_H
|
||||||
|
|
||||||
|
/* This is the version 1.0.X header file. */
|
||||||
|
#define SNDFILE_1
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */
|
||||||
|
|
||||||
|
#if (defined (__MWERKS__))
|
||||||
|
#include <unix.h>
|
||||||
|
#else
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/* The following file types can be read and written.
|
||||||
|
** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise
|
||||||
|
** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and
|
||||||
|
** SF_FORMAT_SUBMASK can be used to separate the major and minor file
|
||||||
|
** types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 / Dialogix ADPCM */
|
||||||
|
|
||||||
|
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
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** The following are the valid command numbers for the sf_command()
|
||||||
|
** interface. The use of these commands is documented in the file
|
||||||
|
** command.html in the doc directory of the source code distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum
|
||||||
|
{ SFC_GET_LIB_VERSION = 0x1000,
|
||||||
|
SFC_GET_LOG_INFO = 0x1001,
|
||||||
|
|
||||||
|
SFC_GET_NORM_DOUBLE = 0x1010,
|
||||||
|
SFC_GET_NORM_FLOAT = 0x1011,
|
||||||
|
SFC_SET_NORM_DOUBLE = 0x1012,
|
||||||
|
SFC_SET_NORM_FLOAT = 0x1013,
|
||||||
|
SFC_SET_SCALE_FLOAT_INT_READ = 0x1014,
|
||||||
|
|
||||||
|
SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020,
|
||||||
|
SFC_GET_SIMPLE_FORMAT = 0x1021,
|
||||||
|
|
||||||
|
SFC_GET_FORMAT_INFO = 0x1028,
|
||||||
|
|
||||||
|
SFC_GET_FORMAT_MAJOR_COUNT = 0x1030,
|
||||||
|
SFC_GET_FORMAT_MAJOR = 0x1031,
|
||||||
|
SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032,
|
||||||
|
SFC_GET_FORMAT_SUBTYPE = 0x1033,
|
||||||
|
|
||||||
|
SFC_CALC_SIGNAL_MAX = 0x1040,
|
||||||
|
SFC_CALC_NORM_SIGNAL_MAX = 0x1041,
|
||||||
|
SFC_CALC_MAX_ALL_CHANNELS = 0x1042,
|
||||||
|
SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,
|
||||||
|
|
||||||
|
SFC_SET_ADD_PEAK_CHUNK = 0x1050,
|
||||||
|
|
||||||
|
SFC_UPDATE_HEADER_NOW = 0x1060,
|
||||||
|
SFC_SET_UPDATE_HEADER_AUTO = 0x1061,
|
||||||
|
|
||||||
|
SFC_FILE_TRUNCATE = 0x1080,
|
||||||
|
|
||||||
|
SFC_SET_RAW_START_OFFSET = 0x1090,
|
||||||
|
|
||||||
|
SFC_SET_DITHER_ON_WRITE = 0x10A0,
|
||||||
|
SFC_SET_DITHER_ON_READ = 0x10A1,
|
||||||
|
|
||||||
|
SFC_GET_DITHER_INFO_COUNT = 0x10A2,
|
||||||
|
SFC_GET_DITHER_INFO = 0x10A3,
|
||||||
|
|
||||||
|
SFC_GET_EMBED_FILE_INFO = 0x10B0,
|
||||||
|
|
||||||
|
SFC_SET_CLIPPING = 0x10C0,
|
||||||
|
SFC_GET_CLIPPING = 0x10C1,
|
||||||
|
|
||||||
|
SFC_GET_INSTRUMENT = 0x10D0,
|
||||||
|
SFC_SET_INSTRUMENT = 0x10D1,
|
||||||
|
|
||||||
|
SFC_GET_LOOP_INFO = 0x10E0,
|
||||||
|
|
||||||
|
/* Following commands for testing only. */
|
||||||
|
SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001,
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SFC_SET_ADD_* values are deprecated and will disappear at some
|
||||||
|
** time in the future. They are guaranteed to be here up to and
|
||||||
|
** including version 1.0.8 to avoid breakage of existng software.
|
||||||
|
** They currently do nothing and will continue to do nothing.
|
||||||
|
*/
|
||||||
|
SFC_SET_ADD_DITHER_ON_WRITE = 0x1070,
|
||||||
|
SFC_SET_ADD_DITHER_ON_READ = 0x1071
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** String types that can be set and read from files. Not all file types
|
||||||
|
** support this and even the file types which support one, may not support
|
||||||
|
** all string types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum
|
||||||
|
{ SF_STR_TITLE = 0x01,
|
||||||
|
SF_STR_COPYRIGHT = 0x02,
|
||||||
|
SF_STR_SOFTWARE = 0x03,
|
||||||
|
SF_STR_ARTIST = 0x04,
|
||||||
|
SF_STR_COMMENT = 0x05,
|
||||||
|
SF_STR_DATE = 0x06
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Use the following as the start and end index when doing metadata
|
||||||
|
** transcoding.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SF_STR_FIRST SF_STR_TITLE
|
||||||
|
#define SF_STR_LAST SF_STR_DATE
|
||||||
|
|
||||||
|
enum
|
||||||
|
{ /* True and false */
|
||||||
|
SF_FALSE = 0,
|
||||||
|
SF_TRUE = 1,
|
||||||
|
|
||||||
|
/* Modes for opening files. */
|
||||||
|
SFM_READ = 0x10,
|
||||||
|
SFM_WRITE = 0x20,
|
||||||
|
SFM_RDWR = 0x30
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/* Public error values. These are guaranteed to remain unchanged for the duration
|
||||||
|
** of the library major version number.
|
||||||
|
** There are also a large number of private error numbers which are internal to
|
||||||
|
** the library which can change at any time.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
|
||||||
|
|
||||||
|
typedef struct SNDFILE_tag SNDFILE ;
|
||||||
|
|
||||||
|
/* The following typedef is system specific and is defined when libsndfile is.
|
||||||
|
** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD),
|
||||||
|
** off64_t (Solaris), __int64_t (Win32) etc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef __int64 sf_count_t ;
|
||||||
|
|
||||||
|
#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFi64
|
||||||
|
|
||||||
|
/* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in.
|
||||||
|
** On write, the SF_INFO structure is filled in by the user and passed into
|
||||||
|
** sf_open_write ().
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct SF_INFO
|
||||||
|
{ sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */
|
||||||
|
int samplerate ;
|
||||||
|
int channels ;
|
||||||
|
int format ;
|
||||||
|
int sections ;
|
||||||
|
int seekable ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
typedef struct SF_INFO SF_INFO ;
|
||||||
|
|
||||||
|
/* The SF_FORMAT_INFO struct is used to retrieve information about the sound
|
||||||
|
** file formats libsndfile supports using the sf_command () interface.
|
||||||
|
**
|
||||||
|
** Using this interface will allow applications to support new file formats
|
||||||
|
** and encoding types when libsndfile is upgraded, without requiring
|
||||||
|
** re-compilation of the application.
|
||||||
|
**
|
||||||
|
** Please consult the libsndfile documentation (particularly the information
|
||||||
|
** on the sf_command () interface) for examples of its use.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{ int format ;
|
||||||
|
const char *name ;
|
||||||
|
const char *extension ;
|
||||||
|
} SF_FORMAT_INFO ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Enums and typedefs for adding dither on read and write.
|
||||||
|
** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE
|
||||||
|
** and SFC_SET_DITHER_ON_READ.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum
|
||||||
|
{ SFD_DEFAULT_LEVEL = 0,
|
||||||
|
SFD_CUSTOM_LEVEL = 0x40000000,
|
||||||
|
|
||||||
|
SFD_NO_DITHER = 500,
|
||||||
|
SFD_WHITE = 501,
|
||||||
|
SFD_TRIANGULAR_PDF = 502
|
||||||
|
} ;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{ int type ;
|
||||||
|
double level ;
|
||||||
|
const char *name ;
|
||||||
|
} SF_DITHER_INFO ;
|
||||||
|
|
||||||
|
/* Struct used to retrieve information about a file embedded within a
|
||||||
|
** larger file. See SFC_GET_EMBED_FILE_INFO.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{ sf_count_t offset ;
|
||||||
|
sf_count_t length ;
|
||||||
|
} SF_EMBED_FILE_INFO ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Structs used to retrieve music sample information from a file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum
|
||||||
|
{ /*
|
||||||
|
** The loop mode field in SF_INSTRUMENT will be one of the following.
|
||||||
|
*/
|
||||||
|
SF_LOOP_NONE = 800,
|
||||||
|
SF_LOOP_FORWARD,
|
||||||
|
SF_LOOP_BACKWARD,
|
||||||
|
SF_LOOP_ALTERNATING
|
||||||
|
} ;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{ int gain ;
|
||||||
|
char basenote, detune ;
|
||||||
|
char velocity_lo, velocity_hi ;
|
||||||
|
char key_lo, key_hi ;
|
||||||
|
int loop_count ;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{ int mode ;
|
||||||
|
unsigned int start ;
|
||||||
|
unsigned int end ;
|
||||||
|
unsigned int count ;
|
||||||
|
} loops [16] ; /* make variable in a sensible way */
|
||||||
|
} SF_INSTRUMENT ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Struct used to retrieve loop information from a file.*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
short time_sig_num ; /* any positive integer > 0 */
|
||||||
|
short time_sig_den ; /* any positive power of 2 > 0 */
|
||||||
|
int loop_mode ; /* see SF_LOOP enum */
|
||||||
|
|
||||||
|
int num_beats ; /* this is NOT the amount of quarter notes !!!*/
|
||||||
|
/* a full bar of 4/4 is 4 beats */
|
||||||
|
/* a full bar of 7/8 is 7 beats */
|
||||||
|
|
||||||
|
float bpm ; /* suggestion, as it can be calculated using other fields:*/
|
||||||
|
/* file's lenght, file's sampleRate and our time_sig_den*/
|
||||||
|
/* -> bpms are always the amount of _quarter notes_ per minute */
|
||||||
|
|
||||||
|
int root_key ; /* MIDI note, or -1 for None */
|
||||||
|
int future [6] ;
|
||||||
|
} SF_LOOP_INFO ;
|
||||||
|
|
||||||
|
typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
|
||||||
|
typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
|
||||||
|
typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
|
||||||
|
typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
|
||||||
|
typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
|
||||||
|
|
||||||
|
struct SF_VIRTUAL_IO
|
||||||
|
{ sf_vio_get_filelen get_filelen ;
|
||||||
|
sf_vio_seek seek ;
|
||||||
|
sf_vio_read read ;
|
||||||
|
sf_vio_write write ;
|
||||||
|
sf_vio_tell tell ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ;
|
||||||
|
|
||||||
|
/* Open the specified file for read, write or both. On error, this will
|
||||||
|
** return a NULL pointer. To find the error number, pass a NULL SNDFILE
|
||||||
|
** to sf_perror () or sf_error_str ().
|
||||||
|
** All calls to sf_open() should be matched with a call to sf_close().
|
||||||
|
*/
|
||||||
|
|
||||||
|
SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ;
|
||||||
|
|
||||||
|
/* Use the existing file descriptor to create a SNDFILE object. If close_desc
|
||||||
|
** is TRUE, the file descriptor will be closed when sf_close() is called. If
|
||||||
|
** it is FALSE, the descritor will not be closed.
|
||||||
|
** When passed a descriptor like this, the library will assume that the start
|
||||||
|
** of file header is at the current file offset. This allows sound files within
|
||||||
|
** larger container files to be read and/or written.
|
||||||
|
** On error, this will return a NULL pointer. To find the error number, pass a
|
||||||
|
** NULL SNDFILE to sf_perror () or sf_error_str ().
|
||||||
|
** All calls to sf_open_fd() should be matched with a call to sf_close().
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
|
||||||
|
|
||||||
|
SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ;
|
||||||
|
|
||||||
|
/* sf_error () returns a error number which can be translated to a text
|
||||||
|
** string using sf_error_number().
|
||||||
|
*/
|
||||||
|
|
||||||
|
int sf_error (SNDFILE *sndfile) ;
|
||||||
|
|
||||||
|
/* sf_strerror () returns to the caller a pointer to the current error message for
|
||||||
|
** the given SNDFILE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const char* sf_strerror (SNDFILE *sndfile) ;
|
||||||
|
|
||||||
|
/* sf_error_number () allows the retrieval of the error string for each internal
|
||||||
|
** error number.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
const char* sf_error_number (int errnum) ;
|
||||||
|
|
||||||
|
/* The following three error functions are deprecated but they will remain in the
|
||||||
|
** library for the forseeable future. The function sf_strerror() should be used
|
||||||
|
** in their place.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int sf_perror (SNDFILE *sndfile) ;
|
||||||
|
int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ;
|
||||||
|
|
||||||
|
|
||||||
|
/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
|
||||||
|
|
||||||
|
int sf_command (SNDFILE *sndfile, int command, void *data, int datasize) ;
|
||||||
|
|
||||||
|
/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
|
||||||
|
|
||||||
|
int sf_format_check (const SF_INFO *info) ;
|
||||||
|
|
||||||
|
/* Seek within the waveform data chunk of the SNDFILE. sf_seek () uses
|
||||||
|
** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as
|
||||||
|
** stdio.h function fseek ().
|
||||||
|
** An offset of zero with whence set to SEEK_SET will position the
|
||||||
|
** read / write pointer to the first data sample.
|
||||||
|
** On success sf_seek returns the current position in (multi-channel)
|
||||||
|
** samples from the start of the file.
|
||||||
|
** Please see the libsndfile documentation for moving the read pointer
|
||||||
|
** separately from the write pointer on files open in mode SFM_RDWR.
|
||||||
|
** On error all of these functions return -1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ;
|
||||||
|
|
||||||
|
/* Functions for retrieving and setting string data within sound files.
|
||||||
|
** Not all file types support this features; AIFF and WAV do. For both
|
||||||
|
** functions, the str_type parameter must be one of the SF_STR_* values
|
||||||
|
** defined above.
|
||||||
|
** On error, sf_set_string() returns non-zero while sf_get_string()
|
||||||
|
** returns NULL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ;
|
||||||
|
|
||||||
|
const char* sf_get_string (SNDFILE *sndfile, int str_type) ;
|
||||||
|
|
||||||
|
/* Functions for reading/writing the waveform data of a sound file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
||||||
|
sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ;
|
||||||
|
|
||||||
|
/* Functions for reading and writing the data chunk in terms of frames.
|
||||||
|
** The number of items actually read/written = frames * number of channels.
|
||||||
|
** sf_xxxx_raw read/writes the raw data bytes from/to the file
|
||||||
|
** sf_xxxx_short passes data in the native short format
|
||||||
|
** sf_xxxx_int passes data in the native int format
|
||||||
|
** sf_xxxx_float passes data in the native float format
|
||||||
|
** sf_xxxx_double passes data in the native double format
|
||||||
|
** All of these read/write function return number of frames read/written.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
|
||||||
|
sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ;
|
||||||
|
|
||||||
|
sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
|
||||||
|
sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ;
|
||||||
|
|
||||||
|
sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
|
||||||
|
sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ;
|
||||||
|
|
||||||
|
sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
||||||
|
sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ;
|
||||||
|
|
||||||
|
/* Functions for reading and writing the data chunk in terms of items.
|
||||||
|
** Otherwise similar to above.
|
||||||
|
** All of these read/write function return number of items read/written.
|
||||||
|
*/
|
||||||
|
|
||||||
|
sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
|
||||||
|
sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ;
|
||||||
|
|
||||||
|
sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
|
||||||
|
sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ;
|
||||||
|
|
||||||
|
sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
|
||||||
|
sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ;
|
||||||
|
|
||||||
|
sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
||||||
|
sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ;
|
||||||
|
|
||||||
|
/* Close the SNDFILE and clean up all memory allocations associated with this
|
||||||
|
** file.
|
||||||
|
** Returns 0 on success, or an error number.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int sf_close (SNDFILE *sndfile) ;
|
||||||
|
|
||||||
|
/* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file
|
||||||
|
** to force the writing of data to disk. If the file is opened SFM_READ
|
||||||
|
** no action is taken.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void sf_write_sync (SNDFILE *sndfile) ;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* SNDFILE_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: 906bb197-18f2-4f66-a395-b4722bab5114
|
||||||
|
*/
|
||||||
|
|
24
Win32/testprog.c
Normal file
24
Win32/testprog.c
Normal 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
|
||||||
|
*/
|
569
acinclude.m4
Normal file
569
acinclude.m4
Normal 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
|
69
binheader_readf_check.py
Normal file
69
binheader_readf_check.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import re, string, sys
|
||||||
|
|
||||||
|
def trim_function_and_params (section):
|
||||||
|
k = string.find (section, "(") + 1
|
||||||
|
brackets = 1
|
||||||
|
section_len = len (section)
|
||||||
|
while k < section_len:
|
||||||
|
if section [k] == '(':
|
||||||
|
brackets += 1
|
||||||
|
elif section [k] == ')':
|
||||||
|
brackets -= 1
|
||||||
|
if brackets < 1:
|
||||||
|
return section [:k+1]
|
||||||
|
k += 1
|
||||||
|
print "Whoops!!!!"
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
def get_function_calls (filedata):
|
||||||
|
filedata = string.split (filedata, "psf_binheader_readf")
|
||||||
|
filedata = filedata [1:]
|
||||||
|
|
||||||
|
func_calls = []
|
||||||
|
for section in filedata:
|
||||||
|
section = "psf_binheader_readf" + section
|
||||||
|
func_calls.append (trim_function_and_params (section))
|
||||||
|
|
||||||
|
return func_calls
|
||||||
|
|
||||||
|
def search_for_problems (filename):
|
||||||
|
filedata = open (filename, "r").read ()
|
||||||
|
|
||||||
|
if len (filedata) < 1:
|
||||||
|
print "Error : file '%s' contains no data." % filename
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
calls = get_function_calls (filedata)
|
||||||
|
for call in calls:
|
||||||
|
if string.find (call, "sizeof") > 0:
|
||||||
|
print "Found : ", call
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
if count == 0:
|
||||||
|
print "%-20s : No problems found." % filename
|
||||||
|
else:
|
||||||
|
print "\n%-20s : Found %d errors." % (filename, count)
|
||||||
|
sys.exit (1)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if len (sys.argv) < 2:
|
||||||
|
print "Usage : %s <file>" % sys.argv [0]
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
for file in sys.argv [1:]:
|
||||||
|
search_for_problems (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: 64d2d700-a787-4843-a342-2bafd0761645
|
||||||
|
|
673
configure.ac
Normal file
673
configure.ac
Normal file
@ -0,0 +1,673 @@
|
|||||||
|
# Copyright (C) 1999-2006 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||||
|
|
||||||
|
dnl Require autoconf version
|
||||||
|
AC_PREREQ(2.57)
|
||||||
|
|
||||||
|
AC_INIT([libsndfile],[1.0.18pre9],[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:18: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]))
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(test-coverage,
|
||||||
|
AC_HELP_STRING([--enable-test-coverage], [enable test coverage]))
|
||||||
|
AM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "$enable_test_coverage" = yes])
|
||||||
|
|
||||||
|
#====================================================================================
|
||||||
|
# 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.])
|
||||||
|
AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
|
||||||
|
[Target processor is big 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.])
|
||||||
|
|
||||||
|
|
||||||
|
#====================================================================================
|
||||||
|
# FLAC defines.
|
||||||
|
|
||||||
|
AC_DEFINE(FLAC__HAS_OGG, 1, [This is always true.])
|
||||||
|
|
||||||
|
case "$host_cpu" in
|
||||||
|
i*86)
|
||||||
|
cpu_ia32=true
|
||||||
|
AC_DEFINE(FLAC__CPU_IA32)
|
||||||
|
AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
|
||||||
|
;;
|
||||||
|
powerpc)
|
||||||
|
cpu_ppc=true
|
||||||
|
AC_DEFINE(FLAC__CPU_PPC)
|
||||||
|
AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
|
||||||
|
;;
|
||||||
|
sparc)
|
||||||
|
cpu_sparc=true
|
||||||
|
AC_DEFINE(FLAC__CPU_SPARC)
|
||||||
|
AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
|
||||||
|
AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
|
||||||
|
AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
|
||||||
|
|
||||||
|
case "$host" in
|
||||||
|
*-pc-linux-gnu)
|
||||||
|
sys_linux=true
|
||||||
|
AC_DEFINE(FLAC__SYS_LINUX)
|
||||||
|
AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
|
||||||
|
;;
|
||||||
|
*-*-darwin*)
|
||||||
|
sys_darwin=true
|
||||||
|
AC_DEFINE(FLAC__SYS_DARWIN)
|
||||||
|
AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
|
||||||
|
AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
|
||||||
|
AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
|
||||||
|
|
||||||
|
if test "x$asm_opt" = xno ; then
|
||||||
|
AC_DEFINE(FLAC__NO_ASM)
|
||||||
|
AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_PROGS(NASM, nasm)
|
||||||
|
AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
|
||||||
|
|
||||||
|
if test -n "$NASM" ; then
|
||||||
|
AC_DEFINE(FLAC__HAS_NASM)
|
||||||
|
AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only matters for PowerPC
|
||||||
|
AC_CHECK_PROGS(AS, as, as)
|
||||||
|
AC_CHECK_PROGS(GAS, gas, gas)
|
||||||
|
|
||||||
|
AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
|
||||||
|
AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
|
||||||
|
|
||||||
|
if test "$AS" = "as" ; then
|
||||||
|
AC_DEFINE(FLAC__HAS_AS)
|
||||||
|
AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$AS" = "gas" ; then
|
||||||
|
# funniest. macro. ever.
|
||||||
|
AC_DEFINE(FLAC__HAS_GAS)
|
||||||
|
AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$host" in
|
||||||
|
i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
|
||||||
|
*-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
|
||||||
|
*) OBJ_FORMAT=elf ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
AC_SUBST(OBJ_FORMAT)
|
||||||
|
|
||||||
|
#====================================================================================
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#====================================================================================
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
win32_target_dll=0
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if test x$enable_test_coverage = "xyes" ; then
|
||||||
|
# AC_ADD_CFLAGS([-ftest-coverage])
|
||||||
|
AC_ADD_CFLAGS([-coverage])
|
||||||
|
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"
|
||||||
|
win32_target_dll=1
|
||||||
|
if test x"$enable_shared" = xno ; then
|
||||||
|
win32_target_dll=0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
cygwin*)
|
||||||
|
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/cygsndfile.def"
|
||||||
|
win32_target_dll=1
|
||||||
|
if test x"$enable_shared" = xno ; then
|
||||||
|
win32_target_dll=0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
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
|
||||||
|
|
||||||
|
AC_DEFINE_UNQUOTED(WIN32_TARGET_DLL, ${win32_target_dll}, [Set to 1 if windows DLL is being built.])
|
||||||
|
|
||||||
|
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(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 \
|
||||||
|
\
|
||||||
|
src/FLAC/Makefile src/FLAC/include/FLAC/Makefile src/FLAC/include/Makefile \
|
||||||
|
src/FLAC/include/share/grabbag/Makefile src/FLAC/include/share/Makefile \
|
||||||
|
src/FLAC/include/test_libs_common/Makefile src/FLAC/src/Makefile \
|
||||||
|
src/FLAC/src/libFLAC/ia32/Makefile src/FLAC/src/libFLAC/Makefile \
|
||||||
|
src/FLAC/src/libFLAC/include/private/Makefile \
|
||||||
|
src/FLAC/src/libFLAC/include/Makefile \
|
||||||
|
src/FLAC/src/libFLAC/include/protected/Makefile \
|
||||||
|
src/FLAC/src/libFLAC/ppc/as/Makefile src/FLAC/src/libFLAC/ppc/Makefile \
|
||||||
|
src/FLAC/src/libFLAC/ppc/gas/Makefile src/FLAC/src/share/Makefile \
|
||||||
|
src/FLAC/src/share/getopt/Makefile src/FLAC/src/share/grabbag/Makefile \
|
||||||
|
src/FLAC/src/share/replaygain_anal/Makefile \
|
||||||
|
src/FLAC/src/share/replaygain_syn/include/private/Makefile \
|
||||||
|
src/FLAC/src/share/replaygain_syn/include/Makefile \
|
||||||
|
src/FLAC/src/share/replaygain_syn/Makefile \
|
||||||
|
src/FLAC/src/share/utf8/Makefile src/FLAC/src/test_libFLAC/Makefile \
|
||||||
|
src/FLAC/src/test_libs_common/Makefile src/FLAC/src/test_seeking/Makefile \
|
||||||
|
src/FLAC/src/test_streams/Makefile src/FLAC/test/Makefile \
|
||||||
|
src/FLAC/src/monkeys_audio_utilities/Makefile \
|
||||||
|
src/FLAC/src/monkeys_audio_utilities/flac_mac/Makefile \
|
||||||
|
src/FLAC/src/monkeys_audio_utilities/flac_ren/Makefile \
|
||||||
|
src/FLAC/src/test_grabbag/Makefile src/FLAC/src/test_grabbag/cuesheet/Makefile \
|
||||||
|
src/FLAC/src/test_grabbag/picture/Makefile \
|
||||||
|
\
|
||||||
|
src/OGG/include/ogg/Makefile src/OGG/include/Makefile src/OGG/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
|
||||||
|
|
||||||
|
#==================================================================================
|
||||||
|
# Ugly hack to remove -Werror from some Makefiles.
|
||||||
|
|
||||||
|
TMPFILE=/tmp/strchange$$
|
||||||
|
|
||||||
|
for f in "src/FLAC/src/libFLAC/Makefile" ; do
|
||||||
|
tmp=`grep -l "\-Werror" "$f"`
|
||||||
|
if test -n "$tmp" ; then
|
||||||
|
if sed -e "s!\-Werror!!g" "$f" > $TMPFILE ; then
|
||||||
|
cp -f $TMPFILE "$f"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
720
doc/FAQ.html
Normal file
720
doc/FAQ.html
Normal file
@ -0,0 +1,720 @@
|
|||||||
|
<!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/MacOSX, 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>
|
||||||
|
<A HREF="#Q018">Q18 : Is it possible to build a Universal Binary on Mac OSX?
|
||||||
|
</A><BR>
|
||||||
|
<A HREF="#Q019">Q19 : I have project files for Visual Studio / XCode / Whatever. Why
|
||||||
|
don't you distribute them with libsndfile?
|
||||||
|
</A><BR>
|
||||||
|
<A HREF="#Q020">Q20 : Why doesn't libsndfile support MP3? Lots of other Open Source
|
||||||
|
projects support it!
|
||||||
|
</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 /bin/sh shell for a number
|
||||||
|
of tasks (ie configure script and libtool).
|
||||||
|
Older versions of OSX (10.2?) shipped a a really crappy Bourne shell as /bin/sh
|
||||||
|
which resulted in <b>really</b> slow compiles.
|
||||||
|
New version of OSX ship GNU BASh as /bin/sh and this answer doesn't apply in that
|
||||||
|
case.
|
||||||
|
</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>
|
||||||
|
See also <A HREF="#Q006">FAQ Q6</A>.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<!-- ========================================================================= -->
|
||||||
|
<A NAME="Q018"></A>
|
||||||
|
<H2><BR><B>Q18 : Is it possible to build a Universal Binary on Mac OSX?
|
||||||
|
</B></H2>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Yes, but you must do two separate configure/build/test runs; one on PowerPC
|
||||||
|
and one on Intel.
|
||||||
|
It is then possible to merge the binaries into a single universal binary using
|
||||||
|
one of the programs in the Apple tool chain.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
It is <b>not</b> possible to build a working universal binary via a single
|
||||||
|
compile/build run on a single CPU.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
The problem is that the libsndfile build process detects features of the CPU its
|
||||||
|
being built for during the configure process and when building a universal binary,
|
||||||
|
configure is only run once and that data is then used for both CPUs.
|
||||||
|
That configure data will be wrong for one of those CPUs.
|
||||||
|
You will still be able to compile libsndfile, and the test suite will pass on
|
||||||
|
the machine you compiled it on.
|
||||||
|
However, if you take the universal binary test suite programs compiled on one
|
||||||
|
CPU and run them on the other, the test suite will fail.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Part of the problem is the the CPU endian-ness is detected at configure time.
|
||||||
|
Yes, I know the Apple compiler defines one of the macros __LITTLE_ENDIAN__
|
||||||
|
and __BIG_ENDIAN__, but those macros are not part of the 1999 ISO C Standard
|
||||||
|
and they are not portable.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
In addition, endian issues are not the only reason why the cross compiled
|
||||||
|
binary will fail.
|
||||||
|
The configure script also detects other CPU specific idiosyncrasies to provide
|
||||||
|
more optimized code.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Now, if you have read this far you're probably thinking there must be a way
|
||||||
|
to fix this and there probably is.
|
||||||
|
The problem is that its a hell of a lot of work and would require significant
|
||||||
|
changes to the configure process, the internal code and the test suite.
|
||||||
|
In addition, these changes must not break compilation on any of the platforms
|
||||||
|
libsndfile is currently working on.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ========================================================================= -->
|
||||||
|
<A NAME="Q019"></A>
|
||||||
|
<H2><BR><B>Q19 : I have project files for Visual Studio / XCode / Whatever. Why
|
||||||
|
don't you distribute them with libsndfile?
|
||||||
|
</B></H2>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
There's a very good reason for this.
|
||||||
|
I will only distribute things that I actually have an ability to test and
|
||||||
|
maintain.
|
||||||
|
Project files for a bunch of different compilers and Integrated Development
|
||||||
|
Environments are simply too difficult to maintain.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
The problem is that every time I add a new file to libsndfile or rename an
|
||||||
|
existing file I would have to modify all the project files and then test that
|
||||||
|
libsndfile still built with all the different compilers.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
Maintaining these project files is also rather difficult if I don't have access
|
||||||
|
to the required compiler/IDE.
|
||||||
|
If I just edit the project files without testing them I will almost certainly
|
||||||
|
get it wrong.
|
||||||
|
If I release a version of libsndfile with broken project files, I'll get a bunch
|
||||||
|
of emails from people complaining about it not building and have no way of
|
||||||
|
fixing or even testing it.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
I currently release sources that I personally test on Win32, Linux and
|
||||||
|
MacOSX (PowerPC) using the compiler I trust (GNU GCC).
|
||||||
|
Supporting one compiler on three (actually much more because GCC is available
|
||||||
|
almost everywhere) platforms is doable without too much pain.
|
||||||
|
I also release binaries for Win32 with instructions on how to use those
|
||||||
|
binaries with Visual Studio.
|
||||||
|
As a guy who is mainly interested in Linux, I'm not to keen to jump through
|
||||||
|
a bunch of hoops to support compilers and operating systems I don't use.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
So, I hear you want to volunteer to maintain the project files for Some Crappy
|
||||||
|
Compiler 2007?
|
||||||
|
Well sorry, that won't work either.
|
||||||
|
I have had numerous people over the years offer to maintaining the project
|
||||||
|
files for Microsoft's Visual Studio.
|
||||||
|
Every single time that happened, they maintained it for a release or two and
|
||||||
|
then disappeared off the face of the earth.
|
||||||
|
Hence, I'm not willing to enter into an arrangement like that again.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<!-- ========================================================================= -->
|
||||||
|
<A NAME="Q020"></A>
|
||||||
|
<H2><BR><B>Q20 : Why doesn't libsndfile support MP3? Lots of other Open Source
|
||||||
|
projects support it!
|
||||||
|
</B></H2>
|
||||||
|
|
||||||
|
<P>
|
||||||
|
MP3 is not supported for one very good reason; doing so requires the payment
|
||||||
|
of licensing fees.
|
||||||
|
As can be seen from
|
||||||
|
<a href="http://www.mp3licensing.com/royalty/software.html">
|
||||||
|
mp3licensing.com</a>
|
||||||
|
the required royalty payments are not cheap.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Yes, I know other libraries ignore the licensing requirements, but their legal
|
||||||
|
status is extremely dubious.
|
||||||
|
At any time, the body selling the licenses could go after the authors of those
|
||||||
|
libraries.
|
||||||
|
Some of those authors may be students and hence wouldn't be worth pursuing.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
However, libsndfile is released under the name of a company, Mega Nerd Pty Ltd;
|
||||||
|
a company which has income from from libsamplerate licensing, libsndfile based
|
||||||
|
consulting income and other unrelated consulting income.
|
||||||
|
Adding MP3 support to libsndfile could place that income would be under legal
|
||||||
|
threat.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Fortunately, Ogg Vorbis exists as an alternative to MP3.
|
||||||
|
Support for Ogg Vorbis in libsndfile is currently been worked on.
|
||||||
|
</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.17
|
||||||
|
</P>
|
||||||
|
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
16
doc/Makefile.am
Normal file
16
doc/Makefile.am
Normal 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
|
||||||
|
|
703
doc/api.html
Normal file
703
doc/api.html
Normal 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="mailto:erikd@zip.com.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 <stdio.h>
|
||||||
|
#include <sndfile.h>
|
||||||
|
|
||||||
|
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
|
||||||
|
<sndfile.h> 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 < 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
|
||||||
|
-->
|
84
doc/bugs.html
Normal file
84
doc/bugs.html
Normal 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
|
||||||
|
-->
|
1245
doc/command.html
Normal file
1245
doc/command.html
Normal file
File diff suppressed because it is too large
Load Diff
83
doc/development.html
Normal file
83
doc/development.html
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
|
<HTML>
|
||||||
|
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>
|
||||||
|
libsndfile Development
|
||||||
|
</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 Development</H1>
|
||||||
|
<!-- pepper -->
|
||||||
|
<P>
|
||||||
|
libsndfile is being developed by a small but growing community of users
|
||||||
|
and hackers led by Erik de Castro Lopo.
|
||||||
|
People interested in helping should join the libsndfile-devel
|
||||||
|
<A HREF="lists.html">mailing list</A>
|
||||||
|
where most of the discussion about new features takes place.
|
||||||
|
</P>
|
||||||
|
<!-- pepper -->
|
||||||
|
<P>
|
||||||
|
libsndfile is being developed using the
|
||||||
|
<A HREF="http://bazaar-vcs.org/">Bzr</A>
|
||||||
|
revision control system which is especially well suited to distributed
|
||||||
|
development.
|
||||||
|
In most respects, Bzr is significantly better than most other revision
|
||||||
|
control systems.
|
||||||
|
It is even available for windows, but I (Erik) have not personally used
|
||||||
|
it on windows.
|
||||||
|
</P>
|
||||||
|
<!-- pepper -->
|
||||||
|
<P>
|
||||||
|
The main archive archive can be found at:
|
||||||
|
<A HREF="http://www.mega-nerd.com/Bzr/libsndfile-mdev/">
|
||||||
|
http://www.mega-nerd.com/Bzr/libsndfile-mdev/</A>
|
||||||
|
</P>
|
||||||
|
<!-- pepper -->
|
||||||
|
<P>
|
||||||
|
Assuming that you have Bzr installed (on Debian GNU/Linux "apt-get install bzr")
|
||||||
|
you can do:
|
||||||
|
</P>
|
||||||
|
<!-- pepper -->
|
||||||
|
<PRE>
|
||||||
|
bzr get http://www.mega-nerd.com/Bzr/libsndfile-mdev/
|
||||||
|
</PRE>
|
||||||
|
<!-- pepper -->
|
||||||
|
<P>
|
||||||
|
to retreive a copy of whats currently in the public archive.
|
||||||
|
To configure, build and verify the build you can do:
|
||||||
|
</P>
|
||||||
|
<!-- pepper -->
|
||||||
|
<PRE>
|
||||||
|
./reconfigure.mk
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
make check
|
||||||
|
</PRE>
|
||||||
|
<!-- pepper -->
|
||||||
|
|
||||||
|
<P>
|
||||||
|
During the configuration stage, some later versions of aclocal (I see this
|
||||||
|
with 1.9.X) may spew out a bunch of warning messages about underquoted
|
||||||
|
defintions in AC_WHATEVER, but these can safely be ignored.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
In order to build the sources from the Bzr archive, you will need the
|
||||||
|
Python interpreter and GNU Autogen which is available
|
||||||
|
<A HREF="http://autogen.sf.net">here</A>.
|
||||||
|
</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: 81e947c2-fb8c-4d8b-93b4-57682d2787b5
|
||||||
|
-->
|
1024
doc/dither.html
Normal file
1024
doc/dither.html
Normal file
File diff suppressed because it is too large
Load Diff
54
doc/embedded_files.html
Normal file
54
doc/embedded_files.html
Normal 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_test.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
|
||||||
|
-->
|
476
doc/index.html
Normal file
476
doc/index.html
Normal 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> </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> </TD><TD ALIGN="center">R/W</TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||||
|
<TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>Signed 8 bit PCM</TD>
|
||||||
|
<TD> </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> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||||
|
<TD> </TD><TD> </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> </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> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||||
|
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </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> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD> </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> </TD><TD> </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> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD>
|
||||||
|
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </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> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </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> </TD><TD> </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> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </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> </TD><TD> </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> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD ALIGN="center">R/W</TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>IMA ADPCM</TD>
|
||||||
|
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>MS ADPCM</TD>
|
||||||
|
<TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>GSM 6.10</TD>
|
||||||
|
<TD ALIGN="center">R/W</TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>G721 ADPCM 32kbps</TD>
|
||||||
|
<TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>G723 ADPCM 24kbps</TD>
|
||||||
|
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>G723 ADPCM 40kbps</TD>
|
||||||
|
<TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>12 bit DWVW</TD>
|
||||||
|
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>16 bit DWVW</TD>
|
||||||
|
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
|
||||||
|
<TR><TD>24 bit DWVW</TD>
|
||||||
|
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
<TR><TD>Ok Dialogic ADPCM</TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
<TR><TD>8 bit DPCM</TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </TD>
|
||||||
|
</TR>
|
||||||
|
<TR><TD>16 bit DPCM</TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD>
|
||||||
|
<TD> </TD><TD ALIGN="center">R/W</TD><TD> </TD><TD> </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="mailto:erikd@mega-nerd.com">
|
||||||
|
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
|
||||||
|
-->
|
81
doc/libsndfile.css.in
Normal file
81
doc/libsndfile.css.in
Normal 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 ; }
|
BIN
doc/libsndfile.jpg
Normal file
BIN
doc/libsndfile.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
440
doc/linux_games_programming.txt
Normal file
440
doc/linux_games_programming.txt
Normal file
@ -0,0 +1,440 @@
|
|||||||
|
# Here are some some emails I exchanged with a guy trying to use
|
||||||
|
# libsndfile version 1 with code from the book "Linux Games Programming"
|
||||||
|
# by John Hall. The email addresses have been changed to foil the spam
|
||||||
|
# bots.
|
||||||
|
|
||||||
|
Date: Tue, 20 Jul 2004 22:49:21 +0100
|
||||||
|
From: Paul <paul@fake-domain-name.co.uk>
|
||||||
|
To: erikd@fake-domain-name.com
|
||||||
|
Subject: Can you help with a problem?
|
||||||
|
Date: Tue, 20 Jul 2004 22:49:21 +0100
|
||||||
|
|
||||||
|
Hi,
|
||||||
|
|
||||||
|
I'm trying to get the source examples in the "Programming Linux Games"
|
||||||
|
(NoStarch, Loki Software + John R. Hall) which use sndfile.h/libsndfile.
|
||||||
|
|
||||||
|
While I can guess some of the newer versions of function calls and
|
||||||
|
enumerations, there are some which I cannot guess.
|
||||||
|
|
||||||
|
Would you be able to translate them to the current version of
|
||||||
|
enumeration and function calls so that I can update the source?
|
||||||
|
|
||||||
|
These are the three currently failing me:
|
||||||
|
|
||||||
|
sf_open_read(filename, SF_INFO *sfinfo) (guess: sf_open(filename,SFM_READ, &sfinfo))
|
||||||
|
SF_FORMAT_PCM (guess: either SF_FORMAT_PCM_U8 or _RAW)
|
||||||
|
SF_INFO.pcmbitwidth (guess: no idea!)
|
||||||
|
|
||||||
|
There are probably more. I'm happy to send you the source files for
|
||||||
|
sound calls, scan the pages or anything else. Failing that, is there
|
||||||
|
somewhere with the changes listed so I can try and fix the code for myself?
|
||||||
|
|
||||||
|
Thanks
|
||||||
|
|
||||||
|
TTFN
|
||||||
|
|
||||||
|
Paul
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
Date: Wed, 21 Jul 2004 17:38:08 +1000
|
||||||
|
From: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||||
|
To: Paul <paul@fake-domain-name.co.uk>
|
||||||
|
Subject: Re: Can you help with a problem?
|
||||||
|
|
||||||
|
On Tue, 20 Jul 2004 22:49:21 +0100
|
||||||
|
Paul <paul@fake-domain-name.co.uk> wrote:
|
||||||
|
|
||||||
|
> Hi,
|
||||||
|
>
|
||||||
|
> I'm trying to get the source examples in the "Programming Linux Games"
|
||||||
|
> (NoStarch, Loki Software + John R. Hall) which use sndfile.h/libsndfile.
|
||||||
|
>
|
||||||
|
> While I can guess some of the newer versions of function calls and
|
||||||
|
> enumerations, there are some which I cannot guess.
|
||||||
|
>
|
||||||
|
> Would you be able to translate them to the current version of
|
||||||
|
> enumeration and function calls so that I can update the source?
|
||||||
|
>
|
||||||
|
> These are the three currently failing me:
|
||||||
|
>
|
||||||
|
> sf_open_read(filename, SF_INFO *sfinfo) (guess: sf_open(filename,
|
||||||
|
> SFM_READ, &sfinfo))
|
||||||
|
|
||||||
|
yes.
|
||||||
|
|
||||||
|
> SF_FORMAT_PCM (guess: either SF_FORMAT_PCM_U8 or _RAW)
|
||||||
|
|
||||||
|
Actually this list:
|
||||||
|
|
||||||
|
SF_FORMAT_PCM_U8
|
||||||
|
SF_FORMAT_PCM_S8
|
||||||
|
SF_FORMAT_PCM_16
|
||||||
|
SF_FORMAT_PCM_24
|
||||||
|
SF_FORMAT_PCM_32
|
||||||
|
|
||||||
|
> SF_INFO.pcmbitwidth (guess: no idea!)
|
||||||
|
|
||||||
|
WIth the above change, pcmbitwidth becomes redundant.
|
||||||
|
|
||||||
|
> There are probably more. I'm happy to send you the source files for
|
||||||
|
> sound calls, scan the pages or anything else. Failing that, is there
|
||||||
|
> somewhere with the changes listed so I can try and fix the code for
|
||||||
|
> myself?
|
||||||
|
|
||||||
|
Version 1.0.0 came out some time ago, but I think this:
|
||||||
|
|
||||||
|
http://www.mega-nerd.com/libsndfile/version-1.html
|
||||||
|
|
||||||
|
lists most of the changes. You should also look at the API docs:
|
||||||
|
|
||||||
|
http://www.mega-nerd.com/libsndfile/api.html
|
||||||
|
|
||||||
|
HTH,
|
||||||
|
Erik
|
||||||
|
--
|
||||||
|
+-----------------------------------------------------------+
|
||||||
|
Erik de Castro Lopo nospam@fake-domain-name.com
|
||||||
|
+-----------------------------------------------------------+
|
||||||
|
"There is no reason why anyone would want a computer in their home"
|
||||||
|
Ken Olson, DEC, 1977
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
From: PFJ <paul@fake-domain-name.co.uk>
|
||||||
|
To: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||||
|
Subject: Re: Can you help with a problem?
|
||||||
|
Date: Wed, 21 Jul 2004 09:07:39 +0100
|
||||||
|
|
||||||
|
|
||||||
|
Hi Erik,
|
||||||
|
|
||||||
|
Thanks for getting back to me.
|
||||||
|
|
||||||
|
> > sf_open_read(filename, SF_INFO *sfinfo) (guess: sf_open(filename, SFM_READ, &sfinfo))
|
||||||
|
>
|
||||||
|
> yes.
|
||||||
|
|
||||||
|
Yay!
|
||||||
|
|
||||||
|
> > SF_FORMAT_PCM (guess: either SF_FORMAT_PCM_U8 or _RAW)
|
||||||
|
>
|
||||||
|
> Actually this list:
|
||||||
|
>
|
||||||
|
> SF_FORMAT_PCM_U8
|
||||||
|
> SF_FORMAT_PCM_S8
|
||||||
|
> SF_FORMAT_PCM_16
|
||||||
|
> SF_FORMAT_PCM_24
|
||||||
|
> SF_FORMAT_PCM_32
|
||||||
|
|
||||||
|
I know, but the source code explicitly has SF_FORMAT_PCM which given the
|
||||||
|
code afterwards would equate to one of the above, but given that PCM
|
||||||
|
files can have a varied bitwidth the author probably wanted to cover all
|
||||||
|
bases.
|
||||||
|
|
||||||
|
> Version 1.0.0 came out some time ago, but I think this:
|
||||||
|
>
|
||||||
|
> http://www.mega-nerd.com/libsndfile/version-1.html
|
||||||
|
>
|
||||||
|
> lists most of the changes. You should also look at the API docs:
|
||||||
|
>
|
||||||
|
> http://www.mega-nerd.com/libsndfile/api.html
|
||||||
|
|
||||||
|
I'll download them and see what I can gleen.
|
||||||
|
|
||||||
|
Thanks again for getting back to me
|
||||||
|
|
||||||
|
TTFN
|
||||||
|
|
||||||
|
Paul
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
Date: Wed, 21 Jul 2004 18:20:29 +1000
|
||||||
|
From: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||||
|
To: PFJ <paul@fake-domain-name.co.uk>
|
||||||
|
Subject: Re: Can you help with a problem?
|
||||||
|
|
||||||
|
On Wed, 21 Jul 2004 09:07:39 +0100
|
||||||
|
PFJ <paul@fake-domain-name.co.uk> wrote:
|
||||||
|
|
||||||
|
> I know, but the source code explicitly has SF_FORMAT_PCM which given the
|
||||||
|
> code afterwards would equate to one of the above, but given that PCM
|
||||||
|
> files can have a varied bitwidth the author probably wanted to cover all
|
||||||
|
> bases.
|
||||||
|
|
||||||
|
But surely the existing code does something like:
|
||||||
|
|
||||||
|
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM;
|
||||||
|
sfinfo.pcmbitwidth = 16;
|
||||||
|
|
||||||
|
which can be directly translated to:
|
||||||
|
|
||||||
|
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
|
||||||
|
|
||||||
|
and the same for pcmbitwitdhs of 24 and 32. For pcmbitwidth of 8
|
||||||
|
you need to know that WAV files use SF_FORMAT_PCM_U8 and AIFF
|
||||||
|
files use SF_FORMAT_PCM_S8. Thats all there is to it.
|
||||||
|
|
||||||
|
Erik
|
||||||
|
--
|
||||||
|
+-----------------------------------------------------------+
|
||||||
|
Erik de Castro Lopo nospam@fake-domain-name.com
|
||||||
|
+-----------------------------------------------------------+
|
||||||
|
"Python addresses true pseudocode's two major failings: that it
|
||||||
|
isn't standardized, and it isn't executable."
|
||||||
|
- Grant R. Griffin in comp.dsp
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
Subject: Re: Can you help with a problem?
|
||||||
|
From: PFJ <paul@fake-domain-name.co.uk>
|
||||||
|
To: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||||
|
Date: Wed, 21 Jul 2004 09:50:55 +0100
|
||||||
|
|
||||||
|
Hi Erik,
|
||||||
|
|
||||||
|
> > I know, but the source code explicitly has SF_FORMAT_PCM which given the
|
||||||
|
> > code afterwards would equate to one of the above, but given that PCM
|
||||||
|
> > files can have a varied bitwidth the author probably wanted to cover all
|
||||||
|
> > bases.
|
||||||
|
>
|
||||||
|
> But surely the existing code does something like:
|
||||||
|
>
|
||||||
|
> sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM;
|
||||||
|
> sfinfo.pcmbitwidth = 16;
|
||||||
|
|
||||||
|
If only!
|
||||||
|
|
||||||
|
The actual code is this
|
||||||
|
|
||||||
|
int LoadSoundFile(char *filename, sound_p sound)
|
||||||
|
{
|
||||||
|
SNDFILE *file;
|
||||||
|
SF_INFO file_info;
|
||||||
|
short *buffer_short = NULL;
|
||||||
|
u_int8_t *buffer_8 = NULL;
|
||||||
|
int16_t *buffer_16 = NULL;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
/* Open the file and retrieve sample information. */
|
||||||
|
file = sf_open_read(filename, &file_info);
|
||||||
|
// I've sorted this one already - PFJ
|
||||||
|
|
||||||
|
/* Make sure the format is acceptable. */
|
||||||
|
if ((file_info.format & 0x0F) != SF_FORMAT_PCM) {
|
||||||
|
printf("'%s' is not a PCM-based audio file.\n", filename);
|
||||||
|
sf_close(file);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((file_info.pcmbitwidth == 8) && (file_info.channels == 1)) {
|
||||||
|
sound->format = AL_FORMAT_MONO8;
|
||||||
|
} else if ((file_info.pcmbitwidth == 8) && (file_info.channels == 2)) {
|
||||||
|
sound->format = AL_FORMAT_STEREO8;
|
||||||
|
} else if ((file_info.pcmbitwidth == 16) && (file_info.channels == 1)) {
|
||||||
|
sound->format = AL_FORMAT_MONO16;
|
||||||
|
} else if ((file_info.pcmbitwidth == 16) && (file_info.channels == 2)) {
|
||||||
|
sound->format = AL_FORMAT_STEREO16;
|
||||||
|
} else {
|
||||||
|
printf("Unknown sample format in %s.\n", filename);
|
||||||
|
sf_close(file);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate buffers. */
|
||||||
|
buffer_short = (short *)malloc(file_info.samples * file_info.channels * sizeof (short));
|
||||||
|
|
||||||
|
buffer_8 = (u_int8_t *)malloc(file_info.samples * file_info.channels * file_info.pcmbitwidth / 8);
|
||||||
|
|
||||||
|
buffer_16 = (int16_t *)buffer_8;
|
||||||
|
|
||||||
|
if (buffer_short == NULL || buffer_8 == NULL) {
|
||||||
|
printf("Unable to allocate enough memory for '%s'.\n", filename);
|
||||||
|
goto error_cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the entire sound file. */
|
||||||
|
if (sf_readf_short(file,buffer_short,file_info.samples) == (size_t)-1) {
|
||||||
|
printf("Error while reading samples from '%s'.\n", filename);
|
||||||
|
goto error_cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
<minor snip>
|
||||||
|
|
||||||
|
/* Fill in the sound data structure. */
|
||||||
|
sound->freq = file_info.samplerate;
|
||||||
|
sound->size = file_info.samples * file_info.channels * file_info.pcmbitwidth / 8;
|
||||||
|
|
||||||
|
/* Give our sound data to OpenAL. */
|
||||||
|
alGenBuffers(1, &sound->name);
|
||||||
|
if (alGetError() != AL_NO_ERROR) {
|
||||||
|
printf("Error creating an AL buffer name for %s.\n", filename);
|
||||||
|
goto error_cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
alBufferData(sound->name, sound->format, buffer_8, sound->size,sound->freq);
|
||||||
|
if (alGetError() != AL_NO_ERROR) {
|
||||||
|
printf("Error sending buffer data to OpenAL for %s.\n", filename);
|
||||||
|
goto error_cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close the file and return success. */
|
||||||
|
sf_close(file);
|
||||||
|
free(buffer_short);
|
||||||
|
free(buffer_8);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error_cleanup:
|
||||||
|
if (file != NULL) fclose(file);
|
||||||
|
free(buffer_short);
|
||||||
|
free(buffer_8);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
As you can see, the PCM material in the listing will not currently
|
||||||
|
compile and for the other sndfile material, it probably won't either.
|
||||||
|
|
||||||
|
Any help would be appreciated.
|
||||||
|
|
||||||
|
TTFN
|
||||||
|
|
||||||
|
Paul
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
From: Erik de Castro Lopo <erikd@fake-domain-name.com>
|
||||||
|
To: PFJ <paul@fake-domain-name.co.uk>
|
||||||
|
Subject: Re: Can you help with a problem?
|
||||||
|
Date: Wed, 21 Jul 2004 19:36:46 +1000
|
||||||
|
|
||||||
|
On Wed, 21 Jul 2004 09:50:55 +0100
|
||||||
|
PFJ <paul@fake-domain-name.co.uk> wrote:
|
||||||
|
|
||||||
|
> Hi Erik,
|
||||||
|
>
|
||||||
|
> > > I know, but the source code explicitly has SF_FORMAT_PCM which given the
|
||||||
|
> > > code afterwards would equate to one of the above, but given that PCM
|
||||||
|
> > > files can have a varied bitwidth the author probably wanted to cover all
|
||||||
|
> > > bases.
|
||||||
|
> >
|
||||||
|
> > But surely the existing code does something like:
|
||||||
|
> >
|
||||||
|
> > sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM;
|
||||||
|
> > sfinfo.pcmbitwidth = 16;
|
||||||
|
>
|
||||||
|
> If only!
|
||||||
|
|
||||||
|
No, really.
|
||||||
|
|
||||||
|
Drop this completely:
|
||||||
|
|
||||||
|
> /* Make sure the format is acceptable. */
|
||||||
|
> if ((file_info.format & 0x0F) != SF_FORMAT_PCM) {
|
||||||
|
> printf("'%s' is not a PCM-based audio file.\n", filename);
|
||||||
|
> sf_close(file);
|
||||||
|
> return -1;
|
||||||
|
> }
|
||||||
|
|
||||||
|
Replace this block:
|
||||||
|
|
||||||
|
> if ((file_info.pcmbitwidth == 8) && (file_info.channels == 1)) {
|
||||||
|
> sound->format = AL_FORMAT_MONO8;
|
||||||
|
> } else if ((file_info.pcmbitwidth == 8) && (file_info.channels == 2)) {
|
||||||
|
> sound->format = AL_FORMAT_STEREO8;
|
||||||
|
> } else if ((file_info.pcmbitwidth == 16) && (file_info.channels == 1)) {
|
||||||
|
> sound->format = AL_FORMAT_MONO16;
|
||||||
|
> } else if ((file_info.pcmbitwidth == 16) && (file_info.channels == 2)) {
|
||||||
|
> sound->format = AL_FORMAT_STEREO16;
|
||||||
|
> } else {
|
||||||
|
> printf("Unknown sample format in %s.\n", filename);
|
||||||
|
> sf_close(file);
|
||||||
|
> return -1;
|
||||||
|
> }
|
||||||
|
|
||||||
|
with:
|
||||||
|
|
||||||
|
int pcmbitwidth = 0;
|
||||||
|
|
||||||
|
if (file_info.format & SF_FORMAT_SUBMASK != SF_FORMAT_PCM_16)
|
||||||
|
{ printf("'%s' is not a PCM-based audio file.\n", filename);
|
||||||
|
sf_close(file);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_info.channels < 1 || file_info.channels > 2)
|
||||||
|
{ printf("'%s' bad channel count.\n", filename);
|
||||||
|
sf_close(file);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (file_info.format & SF_FORMAT_SUBMASK + file_info.channels << 16)
|
||||||
|
{ case (SF_FORMAT_PCM_U8 + 1 << 16):
|
||||||
|
sound->format = AL_FORMAT_MONO8;
|
||||||
|
pcmbitwidth = 8;
|
||||||
|
break;
|
||||||
|
case (SF_FORMAT_PCM_U8 + 2 << 16):
|
||||||
|
sound->format = AL_FORMAT_STEREO8;
|
||||||
|
pcmbitwidth = 8;
|
||||||
|
break;
|
||||||
|
case (SF_FORMAT_PCM_16 + 1 << 16):
|
||||||
|
sound->format = AL_FORMAT_MONO16;
|
||||||
|
pcmbitwidth = 16;
|
||||||
|
break;
|
||||||
|
case (SF_FORMAT_PCM_16 + 2 << 16):
|
||||||
|
sound->format = AL_FORMAT_STEREO16;
|
||||||
|
pcmbitwidth = 16;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("Unknown sample format in %s.\n", filename);
|
||||||
|
sf_close(file);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
> /* Allocate buffers. */
|
||||||
|
> buffer_short = (short *)malloc(file_info.samples *
|
||||||
|
> file_info.channels *
|
||||||
|
> sizeof (short));
|
||||||
|
>
|
||||||
|
> buffer_8 = (u_int8_t *)malloc(file_info.samples *
|
||||||
|
> file_info.channels *
|
||||||
|
> file_info.pcmbitwidth / 8);
|
||||||
|
|
||||||
|
Use pcmbitwidth as calculated above.
|
||||||
|
|
||||||
|
> buffer_16 = (int16_t *)buffer_8;
|
||||||
|
>
|
||||||
|
> if (buffer_short == NULL || buffer_8 == NULL) {
|
||||||
|
> printf("Unable to allocate enough memory for '%s'.\n", filename);
|
||||||
|
> goto error_cleanup;
|
||||||
|
> }
|
||||||
|
>
|
||||||
|
> /* Read the entire sound file. */
|
||||||
|
> if (sf_readf_short(file,buffer_short,file_info.samples) == (size_t)- 1) {
|
||||||
|
|
||||||
|
Replace "(size_t) - 1" with " < 0".
|
||||||
|
|
||||||
|
> As you can see, the PCM material in the listing will not currently
|
||||||
|
> compile and for the other sndfile material, it probably won't either.
|
||||||
|
|
||||||
|
None of the changes above should have been very difficult to figure
|
||||||
|
out.
|
||||||
|
|
||||||
|
Erik
|
||||||
|
--
|
||||||
|
+-----------------------------------------------------------+
|
||||||
|
Erik de Castro Lopo nospam@fake-domain-name.com
|
||||||
|
+-----------------------------------------------------------+
|
||||||
|
Microsoft is finally bringing all of its Windows operating system families
|
||||||
|
under one roof. It will combine all of the features of CE, stability and
|
||||||
|
support of ME and the speed of NT.
|
||||||
|
It will be called Windows CEMENT...
|
||||||
|
|
||||||
|
|
||||||
|
# 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: 78d64eac-20f0-4d71-a4e2-3e1b8821596f
|
59
doc/lists.html
Normal file
59
doc/lists.html
Normal 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@mega-nerd.com</B> <!-- pepper -->
|
||||||
|
<A HREF="mailto:libsndfile-announce-request@mega-nerd.com?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@mega-nerd.com</B> <!-- pepper -->
|
||||||
|
<A HREF="mailto:libsndfile-devel-request@mega-nerd.com?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@mega-nerd.com</B> <!-- pepper -->
|
||||||
|
<A HREF="mailto:libsndfile-users-request@mega-nerd.com?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
|
||||||
|
-->
|
135
doc/new_file_type.HOWTO
Normal file
135
doc/new_file_type.HOWTO
Normal 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 function from psf_open_file ().
|
||||||
|
|
||||||
|
Edit src/sndfile.c and find the switch statement in psf_open_file (). It starts
|
||||||
|
like this:
|
||||||
|
|
||||||
|
switch (filetype)
|
||||||
|
{ case SF_FORMAT_WAV :
|
||||||
|
error = wav_open (psf) ;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case SF_FORMAT_AIFF :
|
||||||
|
error = aiff_open (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 (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() which
|
||||||
|
was prototyped in src/common.h. This function should return 0 on success and
|
||||||
|
a non-zero 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 ***
|
125
doc/octave.html
Normal file
125
doc/octave.html
Normal 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
|
||||||
|
-->
|
78
doc/pkgconfig.html
Normal file
78
doc/pkgconfig.html
Normal 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
|
||||||
|
-->
|
60
doc/sndfile_info.html
Normal file
60
doc/sndfile_info.html
Normal 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
|
||||||
|
-->
|
141
doc/win32.html
Normal file
141
doc/win32.html
Normal 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="mailto:erikd@mega-nerd.com">
|
||||||
|
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
|
||||||
|
-->
|
46
examples/Makefile.am
Normal file
46
examples/Makefile.am
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert
|
||||||
|
|
||||||
|
noinst_PROGRAMS = sndfile-data-trim make_sine sfprocess list_formats 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
|
||||||
|
|
||||||
|
sndfile_data_trim_SOURCES = sndfile-data-trim.c
|
||||||
|
sndfile_data_trim_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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
125
examples/generate.c
Normal file
125
examples/generate.c
Normal 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
|
||||||
|
*/
|
255
examples/generate.cs
Normal file
255
examples/generate.cs
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
/* (c) 2004 James Robson, http://www.arbingersys.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.
|
||||||
|
**
|
||||||
|
** ****************************
|
||||||
|
**
|
||||||
|
** How to use:
|
||||||
|
** - libsndfile.dll must have already been compiled and be in this
|
||||||
|
** application's search path
|
||||||
|
**
|
||||||
|
** - You must edit this file to point to the file you want to convert. Set
|
||||||
|
** the following line of code (found in the Main() function further below)
|
||||||
|
** to the name of a .WAV file that exists on your system.
|
||||||
|
** 186: string sfn = "input.wav";
|
||||||
|
**
|
||||||
|
** - From a command prompt type
|
||||||
|
** csc generate.cs
|
||||||
|
**
|
||||||
|
** - Run the resulting executable 'generate.exe'
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Note: You will obviously need the csc compiler and the .NET runtime. I think
|
||||||
|
** these are freely available for download from Microsoft's website
|
||||||
|
** (part of the .NET SDK?).
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using sf_count_t = System.Int64; //alias; see SF_INFO struct
|
||||||
|
|
||||||
|
#if PLATFORM_64
|
||||||
|
using size_t = System.UInt64;
|
||||||
|
#else
|
||||||
|
using size_t = System.UInt32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
class lsndf_example {
|
||||||
|
|
||||||
|
|
||||||
|
//sound file formats
|
||||||
|
public enum lsndf_frmts {
|
||||||
|
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 */
|
||||||
|
|
||||||
|
/* 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 / Dialogix ADPCM */
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//modes and other
|
||||||
|
public enum lsndf_tf
|
||||||
|
{ /* True and false */
|
||||||
|
SF_FALSE = 0,
|
||||||
|
SF_TRUE = 1,
|
||||||
|
|
||||||
|
/* Modes for opening files. */
|
||||||
|
SFM_READ = 0x10,
|
||||||
|
SFM_WRITE = 0x20,
|
||||||
|
SFM_RDWR = 0x30
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//important SF_INFO structure
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct SF_INFO
|
||||||
|
{
|
||||||
|
public sf_count_t frames ; // Used to be called samples. Changed to avoid confusion.
|
||||||
|
public int samplerate ;
|
||||||
|
public int channels ;
|
||||||
|
public int format ;
|
||||||
|
public int sections ;
|
||||||
|
public int seekable ;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//function declarations
|
||||||
|
//Note: Not all functions have been prototyped here. Only the ones necessary to
|
||||||
|
// make this application work. The below code should give some clues as to
|
||||||
|
// how to add the rest since they have a lot of parameter and return type
|
||||||
|
// similarities.
|
||||||
|
[DllImport("libsndfile.dll")]
|
||||||
|
public static extern IntPtr sf_open ([MarshalAs(UnmanagedType.LPStr)] string path, int mode, ref SF_INFO sfinfo);
|
||||||
|
|
||||||
|
[DllImport("libsndfile.dll")]
|
||||||
|
static extern int sf_error (IntPtr sndfile);
|
||||||
|
|
||||||
|
[DllImport("libsndfile.dll")]
|
||||||
|
static extern IntPtr sf_strerror (IntPtr sndfile);
|
||||||
|
|
||||||
|
[DllImport("libsndfile.dll")]
|
||||||
|
static extern int sf_format_check (ref SF_INFO info);
|
||||||
|
|
||||||
|
[DllImport("libsndfile.dll")]
|
||||||
|
static extern sf_count_t sf_read_float (IntPtr sndfile, float[] ptr, sf_count_t items);
|
||||||
|
|
||||||
|
[DllImport("libsndfile.dll")]
|
||||||
|
static extern sf_count_t sf_write_float (IntPtr sndfile, float[] ptr, sf_count_t items);
|
||||||
|
|
||||||
|
[DllImport("libsndfile.dll")]
|
||||||
|
static extern int sf_close (IntPtr sndfile);
|
||||||
|
|
||||||
|
|
||||||
|
public const sf_count_t BUFFER_LEN = 4096;
|
||||||
|
|
||||||
|
|
||||||
|
//program entry
|
||||||
|
static void Main( ) {
|
||||||
|
|
||||||
|
|
||||||
|
//declarations
|
||||||
|
SF_INFO sfinfo = new SF_INFO();
|
||||||
|
float[] buffer = new float[BUFFER_LEN];
|
||||||
|
sf_count_t rcnt;
|
||||||
|
|
||||||
|
//set the input file
|
||||||
|
string sfn = "input.wav"; //set to a file on YOUR system
|
||||||
|
//string sfn = "noexist.wav"; //test with non-existent file
|
||||||
|
|
||||||
|
//set the output file
|
||||||
|
string ofn = "output.wav";
|
||||||
|
|
||||||
|
//read in sound file to convert
|
||||||
|
IntPtr infile = sf_open (sfn, (int)lsndf_tf.SFM_READ, ref sfinfo);
|
||||||
|
|
||||||
|
//exit if error was thrown
|
||||||
|
if ( (int)infile == 0 ) {
|
||||||
|
Console.WriteLine("Error opening " + sfn);
|
||||||
|
Console.WriteLine("Error #" + sf_error(infile));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//set the file type for the output file
|
||||||
|
//uncomment one and only one of the statements below to change the output
|
||||||
|
//file encoding.
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_PCM_U8);
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_PCM_16);
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_MS_ADPCM);
|
||||||
|
sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_IMA_ADPCM);
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_WAV | lsndf_frmts.SF_FORMAT_GSM610);
|
||||||
|
/* Soundforge W64. */
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_PCM_U8);
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_PCM_16);
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_MS_ADPCM);
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_IMA_ADPCM);
|
||||||
|
//sfinfo.format = (int)(lsndf_frmts.SF_FORMAT_W64 | lsndf_frmts.SF_FORMAT_GSM610);
|
||||||
|
|
||||||
|
|
||||||
|
//check that SF_INFO is valid
|
||||||
|
if ( sf_format_check(ref sfinfo) == 0 ) {
|
||||||
|
Console.WriteLine("sf_format_check failed. Invalid encoding");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//open output file
|
||||||
|
IntPtr outfile = sf_open (ofn, (int)lsndf_tf.SFM_WRITE, ref sfinfo);
|
||||||
|
|
||||||
|
//exit if error was thrown
|
||||||
|
if ( (int)outfile == 0 ) {
|
||||||
|
Console.WriteLine("Error opening " + ofn);
|
||||||
|
Console.WriteLine("Error #" + sf_error(outfile));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//infile -> outfile
|
||||||
|
Console.Write(sfn + " -> " + ofn);
|
||||||
|
while ( (rcnt = sf_read_float (infile, buffer, BUFFER_LEN)) > 0) {
|
||||||
|
Console.Write(".");
|
||||||
|
sf_write_float (outfile, buffer, BUFFER_LEN);
|
||||||
|
}
|
||||||
|
Console.WriteLine("done.");
|
||||||
|
|
||||||
|
//close up shop
|
||||||
|
sf_close(infile);
|
||||||
|
sf_close(outfile);
|
||||||
|
|
||||||
|
|
||||||
|
} //main()
|
||||||
|
|
||||||
|
|
||||||
|
} //class lsndf_example {}
|
||||||
|
|
||||||
|
// 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: 61a46c48-431c-4a16-97a3-b5485ca0e157
|
76
examples/list_formats.c
Normal file
76
examples/list_formats.c
Normal 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
|
||||||
|
*/
|
89
examples/make_sine.c
Normal file
89
examples/make_sine.c
Normal 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
|
||||||
|
*/
|
88
examples/paf_write.c
Normal file
88
examples/paf_write.c
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
** 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 <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <sndfile.h>
|
||||||
|
|
||||||
|
#define SAMPLE_RATE 8000
|
||||||
|
#define SAMPLE_COUNT 100
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{ SNDFILE *file ;
|
||||||
|
SF_INFO sfinfo ;
|
||||||
|
char *filename ;
|
||||||
|
int k, buffer [SAMPLE_COUNT] ;
|
||||||
|
|
||||||
|
for (k = 0 ; k < SAMPLE_COUNT ; k++)
|
||||||
|
buffer [k] = ((3 * k + 2) << 24) + ((3 * k + 1) << 16) + ((3 * k) << 8) ;
|
||||||
|
|
||||||
|
/* Big endian first. */
|
||||||
|
sfinfo.samplerate = SAMPLE_RATE ;
|
||||||
|
sfinfo.frames = SAMPLE_COUNT ;
|
||||||
|
sfinfo.channels = 1 ;
|
||||||
|
sfinfo.format = (SF_ENDIAN_BIG | SF_FORMAT_PAF | SF_FORMAT_PCM_24) ;
|
||||||
|
|
||||||
|
filename = "be-pcm24.paf" ;
|
||||||
|
|
||||||
|
if (! (file = sf_open (filename, SFM_WRITE, &sfinfo)))
|
||||||
|
{ printf ("Error : Not able to open output file.\n") ;
|
||||||
|
return 1 ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
printf ("Writing data to '%s'\n", filename) ;
|
||||||
|
|
||||||
|
if (sf_write_int (file, buffer, SAMPLE_COUNT) != SAMPLE_COUNT)
|
||||||
|
puts (sf_strerror (file)) ;
|
||||||
|
|
||||||
|
sf_close (file) ;
|
||||||
|
|
||||||
|
/* Little endian first. */
|
||||||
|
sfinfo.samplerate = SAMPLE_RATE ;
|
||||||
|
sfinfo.frames = SAMPLE_COUNT ;
|
||||||
|
sfinfo.channels = 1 ;
|
||||||
|
sfinfo.format = (SF_ENDIAN_LITTLE | SF_FORMAT_PAF | SF_FORMAT_PCM_24) ;
|
||||||
|
|
||||||
|
filename = "le-pcm24.paf" ;
|
||||||
|
|
||||||
|
if (! (file = sf_open (filename, SFM_WRITE, &sfinfo)))
|
||||||
|
{ printf ("Error : Not able to open output file.\n") ;
|
||||||
|
return 1 ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
printf ("Writing data to '%s'\n", filename) ;
|
||||||
|
|
||||||
|
if (sf_write_int (file, buffer, SAMPLE_COUNT) != 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: 62025b88-1f3f-46fb-994a-8220bf915772
|
||||||
|
*/
|
131
examples/sfprocess.c
Normal file
131
examples/sfprocess.c
Normal 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
|
||||||
|
*/
|
395
examples/sndfile-convert.c
Normal file
395
examples/sndfile-convert.c
Normal file
@ -0,0 +1,395 @@
|
|||||||
|
/*
|
||||||
|
** 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 },
|
||||||
|
{ "wve", 0, SF_FORMAT_WVE }
|
||||||
|
} ; /* 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 [options] [encoding] <input file> <output file>\n", progname) ;
|
||||||
|
puts ("\n"
|
||||||
|
" where [option] may be:\n\n"
|
||||||
|
" -override-sample-rate=X : force sample rate of input to X\n\n"
|
||||||
|
) ;
|
||||||
|
|
||||||
|
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 ;
|
||||||
|
int override_sample_rate = 0 ; /* assume no sample rate override. */
|
||||||
|
|
||||||
|
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 ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
if (! strcmp (argv [k], "-override-sample-rate="))
|
||||||
|
{ char *ptr ;
|
||||||
|
|
||||||
|
ptr = argv [k] + strlen ("-override-sample-rate=") ;
|
||||||
|
override_sample_rate = atoi (ptr) ;
|
||||||
|
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 ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/* Update sample rate if forced to something else. */
|
||||||
|
if (override_sample_rate)
|
||||||
|
sfinfo.samplerate=override_sample_rate ;
|
||||||
|
|
||||||
|
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
|
||||||
|
*/
|
65
examples/sndfile-data-trim.c
Normal file
65
examples/sndfile-data-trim.c
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
** Copyright (C) 2007 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>
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_exit (const char * progname)
|
||||||
|
{
|
||||||
|
printf ("\nUsage : %s <infile> <outfile>\n\n", progname) ;
|
||||||
|
exit (0) ;
|
||||||
|
} /* usage_exit */
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char * argv [])
|
||||||
|
{ char *progname, *infilename, *outfilename ;
|
||||||
|
SNDFILE *infile = NULL ;
|
||||||
|
SF_INFO sfinfo ;
|
||||||
|
|
||||||
|
progname = strrchr (argv [0], '/') ;
|
||||||
|
progname = progname ? progname + 1 : argv [0] ;
|
||||||
|
|
||||||
|
if (argc != 3)
|
||||||
|
usage_exit (progname) ;
|
||||||
|
|
||||||
|
infilename = argv [argc-2] ;
|
||||||
|
outfilename = argv [argc-1] ;
|
||||||
|
|
||||||
|
if (strcmp (infilename, outfilename) == 0)
|
||||||
|
{ printf ("Error : Input and output filenames are the same.\n\n") ;
|
||||||
|
usage_exit (progname) ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
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 ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
sf_close (infile) ;
|
||||||
|
|
||||||
|
return 0 ;
|
||||||
|
} /* main */
|
||||||
|
|
354
examples/sndfile-info.c
Normal file
354
examples/sndfile-info.c
Normal 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
|
||||||
|
*/
|
153
examples/sndfile-play-beos.cpp
Normal file
153
examples/sndfile-play-beos.cpp
Normal 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
|
||||||
|
*/
|
||||||
|
|
960
examples/sndfile-play.c
Normal file
960
examples/sndfile-play.c
Normal 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 = "default" ;
|
||||||
|
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
|
||||||
|
*/
|
69
libsndfile.spec.in
Normal file
69
libsndfile.spec.in
Normal 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
|
||||||
|
|
499
make_lite.py
Normal file
499
make_lite.py
Normal file
@ -0,0 +1,499 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import commands, os, re, string, sys, time
|
||||||
|
|
||||||
|
def count_enclosed_functions (source):
|
||||||
|
func_count = 0
|
||||||
|
open_brace = 0
|
||||||
|
close_brace = 0
|
||||||
|
for ch in source:
|
||||||
|
if ch == '{':
|
||||||
|
open_brace += 1
|
||||||
|
elif ch == '}':
|
||||||
|
close_brace += 1
|
||||||
|
if open_brace == close_brace:
|
||||||
|
func_count += 1
|
||||||
|
if open_brace < close_brace:
|
||||||
|
print "count_enclosed_functions : open_brace < close_brace"
|
||||||
|
return -1
|
||||||
|
return func_count
|
||||||
|
|
||||||
|
def find_function_prototype (source, proto_name):
|
||||||
|
proto_re = "(^[a-zA-Z_ \t]+\s+%s[^a-zA-Z0-9_]\s*\([^\)]+\)\s+;\n)" % (proto_name)
|
||||||
|
proto_result = re.search (proto_re, source, re.MULTILINE | re.DOTALL)
|
||||||
|
if not proto_result:
|
||||||
|
return None
|
||||||
|
proto_text = proto_result.groups ()[0]
|
||||||
|
return proto_text
|
||||||
|
|
||||||
|
def find_function_definition (source, func_name):
|
||||||
|
func_re = "(\n[a-zA-Z_ \t]+\n%s[^a-zA-Z0-9_].* /\* %s \*/\n)" % (func_name, func_name)
|
||||||
|
func_result = re.search (func_re, source, re.MULTILINE | re.DOTALL)
|
||||||
|
if not func_result:
|
||||||
|
sys.exit (1)
|
||||||
|
return None
|
||||||
|
func_text = func_result.groups ()[0]
|
||||||
|
|
||||||
|
# Now to check that we only have one enclosing function.
|
||||||
|
func_count = count_enclosed_functions (func_text)
|
||||||
|
if func_count != 1:
|
||||||
|
return None
|
||||||
|
return func_text
|
||||||
|
|
||||||
|
def find_include (source, inc_name):
|
||||||
|
inc_re = "(^#include\s+[\<\"]%s[\"\>]\s*)" % inc_name
|
||||||
|
inc_result = re.search (inc_re, source, re.MULTILINE | re.DOTALL)
|
||||||
|
if not inc_result:
|
||||||
|
return None
|
||||||
|
inc_text = inc_result.groups ()[0]
|
||||||
|
return inc_text
|
||||||
|
|
||||||
|
def find_assign_statement (source, var_name):
|
||||||
|
var_re = "(^\s+%s\s*=[^;]+;)" % var_name
|
||||||
|
var_result = re.search (var_re, source, re.MULTILINE | re.DOTALL)
|
||||||
|
if not var_result:
|
||||||
|
return None
|
||||||
|
assign_text = var_result.groups ()[0]
|
||||||
|
return assign_text
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def remove_include (source, inc_name):
|
||||||
|
inc_text = find_include (source, inc_name)
|
||||||
|
if not inc_text:
|
||||||
|
print "remove_include : include '%s' not found. Exiting." % inc_name
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
source = string.replace (source, inc_text, "")
|
||||||
|
return source
|
||||||
|
|
||||||
|
def remove_assign (source, assign_name):
|
||||||
|
assign_text = find_assign (source, inc_name)
|
||||||
|
if not inc_text:
|
||||||
|
print "remove_include : include '%s' not found. Exiting." % inc_name
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
source = string.replace (source, inc_text, "")
|
||||||
|
return source
|
||||||
|
|
||||||
|
def remove_prototype (source, proto_name):
|
||||||
|
proto_text = find_function_prototype (source, proto_name)
|
||||||
|
if not proto_text:
|
||||||
|
print "remove_prototype : prototype '%s' not found. Exiting." % proto_name
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
source = string.replace (source, proto_text, "")
|
||||||
|
return source
|
||||||
|
|
||||||
|
def remove_function (source, func_name):
|
||||||
|
func_text = find_function_definition (source, func_name)
|
||||||
|
if not func_text:
|
||||||
|
print "remove_function : function '%s' not found. Exiting." % func_name
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
source = string.replace (source, func_text, "/* Function %s() removed here. */\n" % func_name)
|
||||||
|
return source
|
||||||
|
|
||||||
|
def remove_all_assignments (source, var):
|
||||||
|
count = 0
|
||||||
|
while 1:
|
||||||
|
assign_text = find_assign_statement (source, var)
|
||||||
|
if not assign_text:
|
||||||
|
if count != 0:
|
||||||
|
break
|
||||||
|
print "remove_all_assignments : variable '%s' not found. Exiting." % var
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
source = string.replace (source, assign_text, "")
|
||||||
|
count += 1
|
||||||
|
return source
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------
|
||||||
|
|
||||||
|
def remove_funcs_and_protos_from_file (filename, func_list):
|
||||||
|
source_code = open (filename, 'r').read ()
|
||||||
|
|
||||||
|
for func in func_list:
|
||||||
|
source_code = remove_prototype (source_code, func) ;
|
||||||
|
source_code = remove_function (source_code, func) ;
|
||||||
|
open (filename, 'w').write (source_code)
|
||||||
|
|
||||||
|
def remove_funcs_from_file (filename, func_list):
|
||||||
|
source_code = open (filename, 'r').read ()
|
||||||
|
|
||||||
|
for func in func_list:
|
||||||
|
source_code = remove_function (source_code, func) ;
|
||||||
|
open (filename, 'w').write (source_code)
|
||||||
|
|
||||||
|
def remove_protos_from_file (filename, func_list):
|
||||||
|
source_code = open (filename, 'r').read ()
|
||||||
|
|
||||||
|
for func in func_list:
|
||||||
|
source_code = remove_prototype (source_code, func) ;
|
||||||
|
open (filename, 'w').write (source_code)
|
||||||
|
|
||||||
|
def remove_includes_from_file (filename, inc_list):
|
||||||
|
source_code = open (filename, 'r').read ()
|
||||||
|
|
||||||
|
for inc in inc_list:
|
||||||
|
source_code = remove_include (source_code, inc) ;
|
||||||
|
open (filename, 'w').write (source_code)
|
||||||
|
|
||||||
|
def remove_all_assignments_from_file (filename, var_list):
|
||||||
|
source_code = open (filename, 'r').read ()
|
||||||
|
|
||||||
|
for var in var_list:
|
||||||
|
source_code = remove_all_assignments (source_code, var) ;
|
||||||
|
open (filename, 'w').write (source_code)
|
||||||
|
|
||||||
|
def remove_comment_start_end (filename, start_comment, end_comment):
|
||||||
|
source_code = open (filename, 'r').read ()
|
||||||
|
|
||||||
|
while 1:
|
||||||
|
start_index = string.find (source_code, start_comment)
|
||||||
|
end_index = string.find (source_code, end_comment)
|
||||||
|
if start_index < 0 or end_index < start_index:
|
||||||
|
break
|
||||||
|
end_index += len (end_comment)
|
||||||
|
source_code = source_code [:start_index-1] + source_code [end_index:] ;
|
||||||
|
|
||||||
|
open (filename, 'w').write (source_code)
|
||||||
|
|
||||||
|
def remove_strings_from_file (filename, str_list):
|
||||||
|
file_text = open (filename, 'r').read ()
|
||||||
|
for current_str in str_list:
|
||||||
|
file_text = string.replace (file_text, current_str, '')
|
||||||
|
open (filename, 'w').write (file_text)
|
||||||
|
|
||||||
|
def string_replace_in_file (filename, from_str, to_str):
|
||||||
|
file_text = open (filename, 'r').read ()
|
||||||
|
file_text = string.replace (file_text, from_str, to_str)
|
||||||
|
open (filename, 'w').write (file_text)
|
||||||
|
|
||||||
|
def remove_regex_from_file (filename, regex_list):
|
||||||
|
file_text = open (filename, 'r').read ()
|
||||||
|
for regex in regex_list:
|
||||||
|
file_text = re.sub (regex, '', file_text, re.MULTILINE | re.DOTALL)
|
||||||
|
open (filename, 'w').write (file_text)
|
||||||
|
|
||||||
|
#==========================================================================
|
||||||
|
|
||||||
|
def find_configure_version (filename):
|
||||||
|
# AM_INIT_AUTOMAKE(libsndfile,0.0.21pre6)
|
||||||
|
file = open (filename)
|
||||||
|
while 1:
|
||||||
|
line = file.readline ()
|
||||||
|
if re.search ("AC_INIT", line):
|
||||||
|
x = re.sub ("[^\(]+\(", "", line)
|
||||||
|
x = re.sub ("\).*\n", "", x)
|
||||||
|
x = string.split (x, ",")
|
||||||
|
package = x [0]
|
||||||
|
version = x [1]
|
||||||
|
break
|
||||||
|
file.close ()
|
||||||
|
# version = re.escape (version)
|
||||||
|
return package, version
|
||||||
|
|
||||||
|
def fix_configure_ac_file (filename):
|
||||||
|
data = open (filename, 'r').read ()
|
||||||
|
data = string.replace (data, "AM_INIT_AUTOMAKE(libsndfile,", "AM_INIT_AUTOMAKE(libsndfile_lite,", 1)
|
||||||
|
|
||||||
|
file = open (filename, 'w')
|
||||||
|
file.write (data)
|
||||||
|
file.close ()
|
||||||
|
|
||||||
|
|
||||||
|
def make_dist_file (package, version):
|
||||||
|
print "Making dist file."
|
||||||
|
tar_gz_file = "%s-%s.tar.gz" % (package, version)
|
||||||
|
if os.path.exists (tar_gz_file):
|
||||||
|
return
|
||||||
|
if os.system ("make dist"):
|
||||||
|
sys.exit (1)
|
||||||
|
return
|
||||||
|
|
||||||
|
def delete_files (file_list):
|
||||||
|
for file_name in file_list:
|
||||||
|
os.remove (file_name)
|
||||||
|
|
||||||
|
#=======================================================================
|
||||||
|
|
||||||
|
source_dir = os.getcwd ()
|
||||||
|
|
||||||
|
conf_package, conf_version = find_configure_version ('configure.ac')
|
||||||
|
|
||||||
|
package_version = "%s-%s" % (conf_package, conf_version)
|
||||||
|
lite_version = "%s_lite-%s" % (conf_package, conf_version)
|
||||||
|
|
||||||
|
os.system ("rm -rf %s%s.tar.gz" % (source_dir, package_version))
|
||||||
|
|
||||||
|
os.system ("make dist")
|
||||||
|
|
||||||
|
make_dist_file (conf_package, conf_version)
|
||||||
|
|
||||||
|
os.chdir ("/tmp")
|
||||||
|
|
||||||
|
print "Uncompressing .tar.gz file."
|
||||||
|
os.system ("rm -rf %s" % package_version)
|
||||||
|
if os.system ("tar zxf %s/%s.tar.gz" % (source_dir, package_version)):
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
|
||||||
|
print "Renaming to libsndfile_lite."
|
||||||
|
os.system ("rm -rf %s" % lite_version)
|
||||||
|
os.rename (package_version, lite_version)
|
||||||
|
|
||||||
|
print "Changing into libsndfile_lite directory."
|
||||||
|
os.chdir (lite_version)
|
||||||
|
|
||||||
|
print "Removing un-neeed directories."
|
||||||
|
delete_dirs = [ 'src/G72x' ]
|
||||||
|
|
||||||
|
for dir_name in delete_dirs:
|
||||||
|
os.system ("rm -rf %s" % dir_name)
|
||||||
|
|
||||||
|
print "Removing un-needed files."
|
||||||
|
delete_files ([ 'src/ircam.c', 'src/nist.c',
|
||||||
|
'src/ima_adpcm.c', 'src/ms_adpcm.c', 'src/au_g72x.c',
|
||||||
|
'src/mat4.c', 'src/mat5.c', 'src/dwvw.c', 'src/paf.c',
|
||||||
|
'src/ogg.c', 'src/pvf.c', 'src/xi.c', 'src/htk.c',
|
||||||
|
'src/sd2.c', 'src/rx2.c', 'src/txw.c', 'src/wve.c',
|
||||||
|
'src/dwd.c', 'src/svx.c', 'src/voc.c', 'src/vox_adpcm.c',
|
||||||
|
'src/sds.c'
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
print "Hacking 'configure.ac' and 'src/Makefile.am'."
|
||||||
|
remove_strings_from_file ('configure.ac', [ 'src/G72x/Makefile' ])
|
||||||
|
remove_strings_from_file ('src/Makefile.am', [ 'G72x/libg72x.la', 'G72x',
|
||||||
|
'ircam.c', 'nist.c', 'ima_adpcm.c', 'ms_adpcm.c', 'au_g72x.c', 'mat4.c',
|
||||||
|
'mat5.c', 'dwvw.c', 'paf.c', 'ogg.c', 'pvf.c', 'xi.c', 'htk.c',
|
||||||
|
'sd2.c', 'rx2.c', 'txw.c', 'wve.c', 'dwd.c', 'svx.c', 'voc.c',
|
||||||
|
'vox_adpcm.c', 'sds.c'
|
||||||
|
])
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Hacking header files."
|
||||||
|
|
||||||
|
remove_protos_from_file ('src/common.h', [ 'xi_open', 'sd2_open', 'ogg_open',
|
||||||
|
'dwvw_init', 'paf_open', 'svx_open', 'nist_open', 'rx2_open', 'mat4_open',
|
||||||
|
'voc_open', 'txw_open', 'dwd_open', 'htk_open', 'wve_open', 'mat5_open',
|
||||||
|
'pvf_open', 'ircam_open', 'sds_open',
|
||||||
|
'float32_init', 'double64_init', 'aiff_ima_init', 'vox_adpcm_init',
|
||||||
|
'wav_w64_ima_init', 'wav_w64_msadpcm_init'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_protos_from_file ('src/au.h',
|
||||||
|
[ 'au_g72x_reader_init', 'au_g72x_writer_init' ])
|
||||||
|
|
||||||
|
remove_protos_from_file ('src/wav_w64.h', [ 'msadpcm_write_adapt_coeffs' ])
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Hacking case statements."
|
||||||
|
|
||||||
|
remove_comment_start_end ('src/sndfile.c', '/* Lite remove start */' , '/* Lite remove end */')
|
||||||
|
remove_comment_start_end ('src/aiff.c', '/* Lite remove start */' , '/* Lite remove end */')
|
||||||
|
remove_comment_start_end ('src/au.c', '/* Lite remove start */' , '/* Lite remove end */')
|
||||||
|
remove_comment_start_end ('src/raw.c', '/* Lite remove start */' , '/* Lite remove end */')
|
||||||
|
remove_comment_start_end ('src/w64.c', '/* Lite remove start */' , '/* Lite remove end */')
|
||||||
|
remove_comment_start_end ('src/wav.c', '/* Lite remove start */' , '/* Lite remove end */')
|
||||||
|
remove_comment_start_end ('src/double64.c', '/* Lite remove start */' , '/* Lite remove end */')
|
||||||
|
remove_comment_start_end ('src/float32.c', '/* Lite remove start */' , '/* Lite remove end */')
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Hacking src/pcm.c."
|
||||||
|
remove_funcs_from_file ('src/pcm.c', [
|
||||||
|
'f2sc_array', 'f2sc_clip_array', 'f2uc_array', 'f2uc_clip_array',
|
||||||
|
'f2bes_array', 'f2bes_clip_array', 'f2les_array', 'f2les_clip_array',
|
||||||
|
'f2let_array', 'f2let_clip_array', 'f2bet_array', 'f2bet_clip_array',
|
||||||
|
'f2bei_array', 'f2bei_clip_array', 'f2lei_array', 'f2lei_clip_array',
|
||||||
|
'd2sc_array', 'd2sc_clip_array', 'd2uc_array', 'd2uc_clip_array',
|
||||||
|
'd2bes_array', 'd2bes_clip_array', 'd2les_array', 'd2les_clip_array',
|
||||||
|
'd2let_array', 'd2let_clip_array', 'd2bet_array', 'd2bet_clip_array',
|
||||||
|
'd2bei_array', 'd2bei_clip_array', 'd2lei_array', 'd2lei_clip_array',
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_funcs_and_protos_from_file ('src/pcm.c', [
|
||||||
|
'pcm_read_sc2f', 'pcm_read_uc2f', 'pcm_read_les2f', 'pcm_read_bes2f',
|
||||||
|
'pcm_read_let2f', 'pcm_read_bet2f', 'pcm_read_lei2f', 'pcm_read_bei2f',
|
||||||
|
'pcm_read_sc2d', 'pcm_read_uc2d', 'pcm_read_les2d', 'pcm_read_bes2d',
|
||||||
|
'pcm_read_let2d', 'pcm_read_bet2d', 'pcm_read_lei2d', 'pcm_read_bei2d',
|
||||||
|
'pcm_write_f2sc', 'pcm_write_f2uc', 'pcm_write_f2bes', 'pcm_write_f2les',
|
||||||
|
'pcm_write_f2bet', 'pcm_write_f2let', 'pcm_write_f2bei', 'pcm_write_f2lei',
|
||||||
|
'pcm_write_d2sc', 'pcm_write_d2uc', 'pcm_write_d2bes', 'pcm_write_d2les',
|
||||||
|
'pcm_write_d2bet', 'pcm_write_d2let', 'pcm_write_d2bei', 'pcm_write_d2lei',
|
||||||
|
|
||||||
|
'sc2f_array', 'uc2f_array', 'bes2f_array', 'les2f_array',
|
||||||
|
'bet2f_array', 'let2f_array', 'bei2f_array', 'lei2f_array',
|
||||||
|
'sc2d_array', 'uc2d_array', 'bes2d_array', 'les2d_array',
|
||||||
|
'bet2d_array', 'let2d_array', 'bei2d_array', 'lei2d_array'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_includes_from_file ('src/pcm.c', [ 'float_cast.h' ])
|
||||||
|
remove_all_assignments_from_file ('src/pcm.c', [
|
||||||
|
'psf-\>write_float', 'psf\-\>write_double',
|
||||||
|
'psf-\>read_float', 'psf\-\>read_double' ])
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
print "Hacking src/ulaw.c."
|
||||||
|
remove_funcs_and_protos_from_file ('src/ulaw.c', [
|
||||||
|
'ulaw_read_ulaw2f', 'ulaw_read_ulaw2d',
|
||||||
|
'ulaw_write_f2ulaw', 'ulaw_write_d2ulaw',
|
||||||
|
'ulaw2f_array', 'ulaw2d_array', 'f2ulaw_array', 'd2ulaw_array'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_includes_from_file ('src/ulaw.c', [ 'float_cast.h' ])
|
||||||
|
remove_all_assignments_from_file ('src/ulaw.c', [
|
||||||
|
'psf-\>write_float', 'psf\-\>write_double',
|
||||||
|
'psf-\>read_float', 'psf\-\>read_double' ])
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Hacking src/alaw.c."
|
||||||
|
remove_funcs_and_protos_from_file ('src/alaw.c', [
|
||||||
|
'alaw_read_alaw2f', 'alaw_read_alaw2d',
|
||||||
|
'alaw_write_f2alaw', 'alaw_write_d2alaw',
|
||||||
|
'alaw2f_array', 'alaw2d_array', 'f2alaw_array', 'd2alaw_array'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_includes_from_file ('src/alaw.c', [ 'float_cast.h' ])
|
||||||
|
remove_all_assignments_from_file ('src/alaw.c', [
|
||||||
|
'psf-\>write_float', 'psf\-\>write_double',
|
||||||
|
'psf-\>read_float', 'psf\-\>read_double' ])
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Hacking src/gsm610.c."
|
||||||
|
remove_funcs_and_protos_from_file ('src/gsm610.c', [
|
||||||
|
'gsm610_read_f', 'gsm610_read_d', 'gsm610_write_f', 'gsm610_write_d'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_includes_from_file ('src/gsm610.c', [ 'float_cast.h' ])
|
||||||
|
remove_all_assignments_from_file ('src/gsm610.c', [
|
||||||
|
'psf-\>write_float', 'psf\-\>write_double',
|
||||||
|
'psf-\>read_float', 'psf\-\>read_double' ])
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Hacking src/float32.c."
|
||||||
|
|
||||||
|
# string_replace_in_file ('src/float32.c', '"float_cast.h"', '<math.h>')
|
||||||
|
remove_funcs_from_file ('src/float32.c', [ 'float32_init' ])
|
||||||
|
|
||||||
|
remove_funcs_and_protos_from_file ('src/float32.c', [
|
||||||
|
'host_read_f2s', 'host_read_f2i', 'host_read_f', 'host_read_f2d',
|
||||||
|
'host_write_s2f', 'host_write_i2f', 'host_write_f', 'host_write_d2f',
|
||||||
|
'f2s_array', 'f2i_array', 'f2d_array', 's2f_array', 'i2f_array', 'd2f_array',
|
||||||
|
'float32_peak_update',
|
||||||
|
'replace_read_f2s', 'replace_read_f2i', 'replace_read_f', 'replace_read_f2d',
|
||||||
|
'replace_write_s2f', 'replace_write_i2f', 'replace_write_f', 'replace_write_d2f',
|
||||||
|
'bf2f_array', 'f2bf_array',
|
||||||
|
'float32_get_capability',
|
||||||
|
])
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Hacking src/double64.c."
|
||||||
|
remove_funcs_from_file ('src/double64.c', [ 'double64_init' ])
|
||||||
|
|
||||||
|
remove_funcs_and_protos_from_file ('src/double64.c', [
|
||||||
|
'host_read_d2s', 'host_read_d2i', 'host_read_d2f', 'host_read_d',
|
||||||
|
'host_write_s2d', 'host_write_i2d', 'host_write_f2d', 'host_write_d',
|
||||||
|
'd2s_array', 'd2i_array', 'd2f_array',
|
||||||
|
's2d_array', 'i2d_array', 'f2d_array',
|
||||||
|
'double64_peak_update', 'double64_get_capability',
|
||||||
|
'replace_read_d2s', 'replace_read_d2i', 'replace_read_d2f', 'replace_read_d',
|
||||||
|
'replace_write_s2d', 'replace_write_i2d', 'replace_write_f2d', 'replace_write_d',
|
||||||
|
'd2bd_read', 'bd2d_write'
|
||||||
|
])
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Hacking test programs."
|
||||||
|
delete_files ([ 'tests/dwvw_test.c', 'tests/floating_point_test.c',
|
||||||
|
'tests/dft_cmp.c', 'tests/peak_chunk_test.c',
|
||||||
|
'tests/scale_clip_test.tpl', 'tests/scale_clip_test.def'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_comment_start_end ('tests/write_read_test.def', '/* Lite remove start */', '/* Lite remove end */')
|
||||||
|
remove_comment_start_end ('tests/write_read_test.tpl', '/* Lite remove start */', '/* Lite remove end */')
|
||||||
|
|
||||||
|
remove_comment_start_end ('tests/Makefile.am', '# Lite remove start', '# Lite remove end')
|
||||||
|
|
||||||
|
remove_strings_from_file ('tests/Makefile.am', [
|
||||||
|
'scale_clip_test.tpl', 'scale_clip_test.def',
|
||||||
|
'\n\t./dwvw_test',
|
||||||
|
'\n\t./floating_point_test', '\n\t./scale_clip_test',
|
||||||
|
'\n\t./peak_chunk_test aiff', '\n\t./peak_chunk_test wav',
|
||||||
|
'\n\t./command_test norm', '\n\t./command_test peak',
|
||||||
|
'\n\t./lossy_comp_test wav_ima', '\n\t./lossy_comp_test wav_msadpcm',
|
||||||
|
'\n\t./lossy_comp_test au_g721', '\n\t./lossy_comp_test au_g723',
|
||||||
|
'\n\t./lossy_comp_test vox_adpcm',
|
||||||
|
'\n\t./lossy_comp_test w64_ima', '\n\t./lossy_comp_test w64_msadpcm',
|
||||||
|
'peak_chunk_test', 'dwvw_test', 'floating_point_test', 'scale_clip_test',
|
||||||
|
|
||||||
|
'paf-tests', 'svx-tests', 'nist-tests', 'ircam-tests', 'voc-tests',
|
||||||
|
'mat4-tests', 'mat5-tests', 'pvf-tests', 'xi-tests', 'htk-tests',
|
||||||
|
'sds-tests'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_comment_start_end ('tests/pcm_test.c', '/* Lite remove start */', '/* Lite remove end */')
|
||||||
|
remove_funcs_and_protos_from_file ('tests/pcm_test.c', [
|
||||||
|
'pcm_test_float', 'pcm_test_double'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_comment_start_end ('tests/lossy_comp_test.c', '/* Lite remove start */', '/* Lite remove end */')
|
||||||
|
remove_funcs_and_protos_from_file ('tests/lossy_comp_test.c', [
|
||||||
|
'lcomp_test_float', 'lcomp_test_double', 'sdlcomp_test_float', 'sdlcomp_test_double',
|
||||||
|
'smoothed_diff_float', 'smoothed_diff_double'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_comment_start_end ('tests/multi_file_test.c', '/* Lite remove start */', '/* Lite remove end */')
|
||||||
|
|
||||||
|
remove_strings_from_file ('tests/stdio_test.c', [
|
||||||
|
'"paf",', '"svx",', '"nist",', '"ircam",', '"voc",', '"mat4",', '"mat5",', '"pvf",'
|
||||||
|
])
|
||||||
|
|
||||||
|
remove_comment_start_end ('tests/pipe_test.c', '/* Lite remove start */', '/* Lite remove end */')
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print "Fixing configure.ac file."
|
||||||
|
fix_configure_ac_file ('configure.ac')
|
||||||
|
|
||||||
|
print "Building and testing source."
|
||||||
|
# Try --disable-shared --disable-gcc-opt
|
||||||
|
if os.system ("./reconfigure.mk && ./configure --disable-shared --disable-gcc-opt && make check"):
|
||||||
|
os.system ('PS1="FIX > " bash --norc')
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
print "Making distcheck"
|
||||||
|
if os.system ("make distcheck"):
|
||||||
|
os.system ('PS1="FIX > " bash --norc')
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
print "Copying tarball"
|
||||||
|
if os.system ("cp %s.tar.gz %s" % (lite_version, source_dir)):
|
||||||
|
print "??? %s.tar.gz ???" % lite_version
|
||||||
|
os.system ('PS1="FIX > " bash --norc')
|
||||||
|
sys.exit (1)
|
||||||
|
|
||||||
|
os.chdir (source_dir)
|
||||||
|
|
||||||
|
os.system ("rm -rf /tmp/%s" % lite_version)
|
||||||
|
|
||||||
|
print "Done."
|
||||||
|
|
||||||
|
|
||||||
|
# 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: 4aa63c4d-930b-4ef8-a0f2-d1c63992b60b
|
||||||
|
|
12
man/Makefile.am
Normal file
12
man/Makefile.am
Normal 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
|
||||||
|
|
28
man/sndfile-convert.1
Normal file
28
man/sndfile-convert.1
Normal 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
|
||||||
|
|
22
man/sndfile-info.1
Normal file
22
man/sndfile-info.1
Normal 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
|
||||||
|
|
41
man/sndfile-play.1
Normal file
41
man/sndfile-play.1
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
.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
|
||||||
|
ALSA on Linux
|
||||||
|
/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
|
58
reconfigure.mk
Executable file
58
reconfigure.mk
Executable file
@ -0,0 +1,58 @@
|
|||||||
|
#!/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 (and DarwinPorts/MacPorts) sucks as well, but this seems necessary.
|
||||||
|
ACLOCAL_INC = -I /opt/local/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 {} \;
|
||||||
|
|
||||||
|
|
18
regtest/Makefile.am
Normal file
18
regtest/Makefile.am
Normal 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
|
114
regtest/Readme.txt
Normal file
114
regtest/Readme.txt
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
sndfile-regtest
|
||||||
|
===============
|
||||||
|
|
||||||
|
The 'sndfile-regtest' program is a regression test-suite for libsndile.
|
||||||
|
|
||||||
|
This program is intended to allow anyone who has an interest in the
|
||||||
|
reliability and correctness of libsndfile to do their own regression
|
||||||
|
testing. From the point of view of the libsndfile developers, this
|
||||||
|
program now allows for distributed regression testing of libsndfile
|
||||||
|
which will make libsndfile better.
|
||||||
|
|
||||||
|
|
||||||
|
How Does it Work
|
||||||
|
----------------
|
||||||
|
Anyone who wishes to take part in the distributed regression testing of
|
||||||
|
libsndfile can download the regression test program and install it.
|
||||||
|
|
||||||
|
Once installed the user can start collecting files and adding them to
|
||||||
|
their own personal database. Then, as new versions of libsndfile come
|
||||||
|
out, the user should test the new library version against their database
|
||||||
|
of files (instructions below).
|
||||||
|
|
||||||
|
Any files which were successfully added to the database in the past but
|
||||||
|
now fail the check with the new library version represent a regression.
|
||||||
|
The user should then contact the libsndfile developers so that a copy
|
||||||
|
of the test file can be made available to the developers.
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
The regression test program uses sqlite3 as the database engine. On
|
||||||
|
Debian, the required packages are :
|
||||||
|
|
||||||
|
sqlite3
|
||||||
|
libsqlite3-0
|
||||||
|
libsqlite3-dev
|
||||||
|
|
||||||
|
but similar packages should be available on any other Linux style
|
||||||
|
system.
|
||||||
|
|
||||||
|
The regression test currently only compiles under Unix-like systems.
|
||||||
|
At some time in the future the regression test will distributed along
|
||||||
|
with the libsndfile source code distribution.
|
||||||
|
|
||||||
|
|
||||||
|
Organization of Files
|
||||||
|
---------------------
|
||||||
|
The regession test program keeps its database file in the directory it
|
||||||
|
is run from. In addition, the database only contains information about
|
||||||
|
the files, not the files themselves.
|
||||||
|
|
||||||
|
This means that database file should probably be kept in the same
|
||||||
|
directory (or a directory above) the test files.
|
||||||
|
|
||||||
|
|
||||||
|
Setting it Up for the First Time
|
||||||
|
--------------------------------
|
||||||
|
The sndfile-regtest program should be on your PATH. You can then cd into
|
||||||
|
the directory where you intend to keep you test files and
|
||||||
|
run the command:
|
||||||
|
|
||||||
|
sndfile-regtest --create-db
|
||||||
|
|
||||||
|
which creates a file named '.sndfile-regtest.db' in the current directory.
|
||||||
|
|
||||||
|
Files can then be added to the database using the command:
|
||||||
|
|
||||||
|
sndfile-regtest --add-file file1.wav
|
||||||
|
|
||||||
|
The --add-file option allows more than one file to be added at a time
|
||||||
|
using:
|
||||||
|
|
||||||
|
sndfile-regtest --add-file file1.wav file2.aif .....
|
||||||
|
|
||||||
|
|
||||||
|
Checking Files
|
||||||
|
--------------
|
||||||
|
One or more files that have already been added to the database can be
|
||||||
|
checked using:
|
||||||
|
|
||||||
|
sndfile-regtest --check-file file1.wav file2.aif .....
|
||||||
|
|
||||||
|
It is also possible to check all files in the database using:
|
||||||
|
|
||||||
|
sndfile-regtest --check-all
|
||||||
|
|
||||||
|
|
||||||
|
Running a Regression Test
|
||||||
|
-------------------------
|
||||||
|
Once you have a collection of files and a database it is possible to test
|
||||||
|
new versions of libsndfile before you install them. If for instance you
|
||||||
|
have just compiled a new version of libsndfile in the directory
|
||||||
|
/usr/src/libsndfile-X.Y.Z, then you can use an existing sndfile-regtest
|
||||||
|
binary with the new libsndfile using something like:
|
||||||
|
|
||||||
|
LD_PRELOAD=/usr/src/libsndfile-X.Y.Z/src/.libs/libsndfile.so.X.Y.Z \
|
||||||
|
sndfile-regtest --check-all
|
||||||
|
|
||||||
|
|
||||||
|
Reporting Regressions
|
||||||
|
---------------------
|
||||||
|
Any user who finds a file which was added to the regression database with
|
||||||
|
an earlier version of libsndfile and then fails the check with a later
|
||||||
|
version of the library should contact the author (erikd at mega dash nerd
|
||||||
|
dot com). If possible place the file on a web server and email the author
|
||||||
|
a link to it.
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
# 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: 174661f1-9874-424e-8d8b-301d0322dfdb
|
125
regtest/checksum.c
Normal file
125
regtest/checksum.c
Normal 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
|
||||||
|
*/
|
502
regtest/database.c
Normal file
502
regtest/database.c
Normal 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,'%ld', %d, '0x%08x', '0x%08x', '%s');",
|
||||||
|
db->filename, db->pathname, info.samplerate, (long) 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 == %ld\n", result [k + cols], (long) 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
|
||||||
|
*/
|
45
regtest/regtest.h
Normal file
45
regtest/regtest.h
Normal 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
|
||||||
|
*/
|
128
regtest/sndfile-regtest.c
Normal file
128
regtest/sndfile-regtest.c
Normal 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
|
||||||
|
*/
|
11
sndfile.pc.in
Normal file
11
sndfile.pc.in
Normal 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}
|
41
src/FLAC/AUTHORS
Normal file
41
src/FLAC/AUTHORS
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/* FLAC - Free Lossless Audio Codec
|
||||||
|
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This file is part the FLAC project. FLAC is comprised of several
|
||||||
|
* components distributed under difference licenses. The codec libraries
|
||||||
|
* are distributed under Xiph.Org's BSD-like license (see the file
|
||||||
|
* COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||||
|
* plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||||
|
* is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||||
|
* FLAC distribution contains at the top the terms under which it may be
|
||||||
|
* distributed.
|
||||||
|
*
|
||||||
|
* Since this particular file is relevant to all components of FLAC,
|
||||||
|
* it may be distributed under the Xiph.Org license, which is the least
|
||||||
|
* restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||||
|
* distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
FLAC (http://flac.sourceforge.net/) is an Open Source lossless audio
|
||||||
|
codec developed by Josh Coalson <jcoalson@users.sourceforge.net>.
|
||||||
|
|
||||||
|
Other major contributors and their contributions:
|
||||||
|
"Andrey Astafiev" <andrei@tvcell.ru>
|
||||||
|
* Russian translation of the HTML documentation
|
||||||
|
|
||||||
|
"Miroslav Lichvar" <lichvarm@phoenix.inf.upol.cz>
|
||||||
|
* IA-32 assembly versions of several libFLAC routines
|
||||||
|
|
||||||
|
"Brady Patterson" <bpat@users.sourceforge.net>
|
||||||
|
* AIFF file support, PPC assembly versions of libFLAC routines
|
||||||
|
|
||||||
|
"Daisuke Shimamura" <Daisuke_Shimamura@nifty.com>
|
||||||
|
* i18n support in the XMMS plugin
|
||||||
|
|
||||||
|
"X-Fixer" <x-fixer@narod.ru>
|
||||||
|
* Configuration system, tag editing, and file info in the Winamp2 plugin
|
||||||
|
|
||||||
|
"Matt Zimmerman" <mdz@debian.org>
|
||||||
|
* Libtool/autoconf/automake make system, flac man page
|
||||||
|
|
397
src/FLAC/COPYING.FDL
Normal file
397
src/FLAC/COPYING.FDL
Normal file
@ -0,0 +1,397 @@
|
|||||||
|
GNU Free Documentation License
|
||||||
|
Version 1.2, November 2002
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
||||||
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
0. PREAMBLE
|
||||||
|
|
||||||
|
The purpose of this License is to make a manual, textbook, or other
|
||||||
|
functional and useful document "free" in the sense of freedom: to
|
||||||
|
assure everyone the effective freedom to copy and redistribute it,
|
||||||
|
with or without modifying it, either commercially or noncommercially.
|
||||||
|
Secondarily, this License preserves for the author and publisher a way
|
||||||
|
to get credit for their work, while not being considered responsible
|
||||||
|
for modifications made by others.
|
||||||
|
|
||||||
|
This License is a kind of "copyleft", which means that derivative
|
||||||
|
works of the document must themselves be free in the same sense. It
|
||||||
|
complements the GNU General Public License, which is a copyleft
|
||||||
|
license designed for free software.
|
||||||
|
|
||||||
|
We have designed this License in order to use it for manuals for free
|
||||||
|
software, because free software needs free documentation: a free
|
||||||
|
program should come with manuals providing the same freedoms that the
|
||||||
|
software does. But this License is not limited to software manuals;
|
||||||
|
it can be used for any textual work, regardless of subject matter or
|
||||||
|
whether it is published as a printed book. We recommend this License
|
||||||
|
principally for works whose purpose is instruction or reference.
|
||||||
|
|
||||||
|
|
||||||
|
1. APPLICABILITY AND DEFINITIONS
|
||||||
|
|
||||||
|
This License applies to any manual or other work, in any medium, that
|
||||||
|
contains a notice placed by the copyright holder saying it can be
|
||||||
|
distributed under the terms of this License. Such a notice grants a
|
||||||
|
world-wide, royalty-free license, unlimited in duration, to use that
|
||||||
|
work under the conditions stated herein. The "Document", below,
|
||||||
|
refers to any such manual or work. Any member of the public is a
|
||||||
|
licensee, and is addressed as "you". You accept the license if you
|
||||||
|
copy, modify or distribute the work in a way requiring permission
|
||||||
|
under copyright law.
|
||||||
|
|
||||||
|
A "Modified Version" of the Document means any work containing the
|
||||||
|
Document or a portion of it, either copied verbatim, or with
|
||||||
|
modifications and/or translated into another language.
|
||||||
|
|
||||||
|
A "Secondary Section" is a named appendix or a front-matter section of
|
||||||
|
the Document that deals exclusively with the relationship of the
|
||||||
|
publishers or authors of the Document to the Document's overall subject
|
||||||
|
(or to related matters) and contains nothing that could fall directly
|
||||||
|
within that overall subject. (Thus, if the Document is in part a
|
||||||
|
textbook of mathematics, a Secondary Section may not explain any
|
||||||
|
mathematics.) The relationship could be a matter of historical
|
||||||
|
connection with the subject or with related matters, or of legal,
|
||||||
|
commercial, philosophical, ethical or political position regarding
|
||||||
|
them.
|
||||||
|
|
||||||
|
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||||
|
are designated, as being those of Invariant Sections, in the notice
|
||||||
|
that says that the Document is released under this License. If a
|
||||||
|
section does not fit the above definition of Secondary then it is not
|
||||||
|
allowed to be designated as Invariant. The Document may contain zero
|
||||||
|
Invariant Sections. If the Document does not identify any Invariant
|
||||||
|
Sections then there are none.
|
||||||
|
|
||||||
|
The "Cover Texts" are certain short passages of text that are listed,
|
||||||
|
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||||
|
the Document is released under this License. A Front-Cover Text may
|
||||||
|
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||||
|
|
||||||
|
A "Transparent" copy of the Document means a machine-readable copy,
|
||||||
|
represented in a format whose specification is available to the
|
||||||
|
general public, that is suitable for revising the document
|
||||||
|
straightforwardly with generic text editors or (for images composed of
|
||||||
|
pixels) generic paint programs or (for drawings) some widely available
|
||||||
|
drawing editor, and that is suitable for input to text formatters or
|
||||||
|
for automatic translation to a variety of formats suitable for input
|
||||||
|
to text formatters. A copy made in an otherwise Transparent file
|
||||||
|
format whose markup, or absence of markup, has been arranged to thwart
|
||||||
|
or discourage subsequent modification by readers is not Transparent.
|
||||||
|
An image format is not Transparent if used for any substantial amount
|
||||||
|
of text. A copy that is not "Transparent" is called "Opaque".
|
||||||
|
|
||||||
|
Examples of suitable formats for Transparent copies include plain
|
||||||
|
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||||
|
or XML using a publicly available DTD, and standard-conforming simple
|
||||||
|
HTML, PostScript or PDF designed for human modification. Examples of
|
||||||
|
transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||||
|
include proprietary formats that can be read and edited only by
|
||||||
|
proprietary word processors, SGML or XML for which the DTD and/or
|
||||||
|
processing tools are not generally available, and the
|
||||||
|
machine-generated HTML, PostScript or PDF produced by some word
|
||||||
|
processors for output purposes only.
|
||||||
|
|
||||||
|
The "Title Page" means, for a printed book, the title page itself,
|
||||||
|
plus such following pages as are needed to hold, legibly, the material
|
||||||
|
this License requires to appear in the title page. For works in
|
||||||
|
formats which do not have any title page as such, "Title Page" means
|
||||||
|
the text near the most prominent appearance of the work's title,
|
||||||
|
preceding the beginning of the body of the text.
|
||||||
|
|
||||||
|
A section "Entitled XYZ" means a named subunit of the Document whose
|
||||||
|
title either is precisely XYZ or contains XYZ in parentheses following
|
||||||
|
text that translates XYZ in another language. (Here XYZ stands for a
|
||||||
|
specific section name mentioned below, such as "Acknowledgements",
|
||||||
|
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
|
||||||
|
of such a section when you modify the Document means that it remains a
|
||||||
|
section "Entitled XYZ" according to this definition.
|
||||||
|
|
||||||
|
The Document may include Warranty Disclaimers next to the notice which
|
||||||
|
states that this License applies to the Document. These Warranty
|
||||||
|
Disclaimers are considered to be included by reference in this
|
||||||
|
License, but only as regards disclaiming warranties: any other
|
||||||
|
implication that these Warranty Disclaimers may have is void and has
|
||||||
|
no effect on the meaning of this License.
|
||||||
|
|
||||||
|
|
||||||
|
2. VERBATIM COPYING
|
||||||
|
|
||||||
|
You may copy and distribute the Document in any medium, either
|
||||||
|
commercially or noncommercially, provided that this License, the
|
||||||
|
copyright notices, and the license notice saying this License applies
|
||||||
|
to the Document are reproduced in all copies, and that you add no other
|
||||||
|
conditions whatsoever to those of this License. You may not use
|
||||||
|
technical measures to obstruct or control the reading or further
|
||||||
|
copying of the copies you make or distribute. However, you may accept
|
||||||
|
compensation in exchange for copies. If you distribute a large enough
|
||||||
|
number of copies you must also follow the conditions in section 3.
|
||||||
|
|
||||||
|
You may also lend copies, under the same conditions stated above, and
|
||||||
|
you may publicly display copies.
|
||||||
|
|
||||||
|
|
||||||
|
3. COPYING IN QUANTITY
|
||||||
|
|
||||||
|
If you publish printed copies (or copies in media that commonly have
|
||||||
|
printed covers) of the Document, numbering more than 100, and the
|
||||||
|
Document's license notice requires Cover Texts, you must enclose the
|
||||||
|
copies in covers that carry, clearly and legibly, all these Cover
|
||||||
|
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||||
|
the back cover. Both covers must also clearly and legibly identify
|
||||||
|
you as the publisher of these copies. The front cover must present
|
||||||
|
the full title with all words of the title equally prominent and
|
||||||
|
visible. You may add other material on the covers in addition.
|
||||||
|
Copying with changes limited to the covers, as long as they preserve
|
||||||
|
the title of the Document and satisfy these conditions, can be treated
|
||||||
|
as verbatim copying in other respects.
|
||||||
|
|
||||||
|
If the required texts for either cover are too voluminous to fit
|
||||||
|
legibly, you should put the first ones listed (as many as fit
|
||||||
|
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||||
|
pages.
|
||||||
|
|
||||||
|
If you publish or distribute Opaque copies of the Document numbering
|
||||||
|
more than 100, you must either include a machine-readable Transparent
|
||||||
|
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||||
|
a computer-network location from which the general network-using
|
||||||
|
public has access to download using public-standard network protocols
|
||||||
|
a complete Transparent copy of the Document, free of added material.
|
||||||
|
If you use the latter option, you must take reasonably prudent steps,
|
||||||
|
when you begin distribution of Opaque copies in quantity, to ensure
|
||||||
|
that this Transparent copy will remain thus accessible at the stated
|
||||||
|
location until at least one year after the last time you distribute an
|
||||||
|
Opaque copy (directly or through your agents or retailers) of that
|
||||||
|
edition to the public.
|
||||||
|
|
||||||
|
It is requested, but not required, that you contact the authors of the
|
||||||
|
Document well before redistributing any large number of copies, to give
|
||||||
|
them a chance to provide you with an updated version of the Document.
|
||||||
|
|
||||||
|
|
||||||
|
4. MODIFICATIONS
|
||||||
|
|
||||||
|
You may copy and distribute a Modified Version of the Document under
|
||||||
|
the conditions of sections 2 and 3 above, provided that you release
|
||||||
|
the Modified Version under precisely this License, with the Modified
|
||||||
|
Version filling the role of the Document, thus licensing distribution
|
||||||
|
and modification of the Modified Version to whoever possesses a copy
|
||||||
|
of it. In addition, you must do these things in the Modified Version:
|
||||||
|
|
||||||
|
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||||
|
from that of the Document, and from those of previous versions
|
||||||
|
(which should, if there were any, be listed in the History section
|
||||||
|
of the Document). You may use the same title as a previous version
|
||||||
|
if the original publisher of that version gives permission.
|
||||||
|
B. List on the Title Page, as authors, one or more persons or entities
|
||||||
|
responsible for authorship of the modifications in the Modified
|
||||||
|
Version, together with at least five of the principal authors of the
|
||||||
|
Document (all of its principal authors, if it has fewer than five),
|
||||||
|
unless they release you from this requirement.
|
||||||
|
C. State on the Title page the name of the publisher of the
|
||||||
|
Modified Version, as the publisher.
|
||||||
|
D. Preserve all the copyright notices of the Document.
|
||||||
|
E. Add an appropriate copyright notice for your modifications
|
||||||
|
adjacent to the other copyright notices.
|
||||||
|
F. Include, immediately after the copyright notices, a license notice
|
||||||
|
giving the public permission to use the Modified Version under the
|
||||||
|
terms of this License, in the form shown in the Addendum below.
|
||||||
|
G. Preserve in that license notice the full lists of Invariant Sections
|
||||||
|
and required Cover Texts given in the Document's license notice.
|
||||||
|
H. Include an unaltered copy of this License.
|
||||||
|
I. Preserve the section Entitled "History", Preserve its Title, and add
|
||||||
|
to it an item stating at least the title, year, new authors, and
|
||||||
|
publisher of the Modified Version as given on the Title Page. If
|
||||||
|
there is no section Entitled "History" in the Document, create one
|
||||||
|
stating the title, year, authors, and publisher of the Document as
|
||||||
|
given on its Title Page, then add an item describing the Modified
|
||||||
|
Version as stated in the previous sentence.
|
||||||
|
J. Preserve the network location, if any, given in the Document for
|
||||||
|
public access to a Transparent copy of the Document, and likewise
|
||||||
|
the network locations given in the Document for previous versions
|
||||||
|
it was based on. These may be placed in the "History" section.
|
||||||
|
You may omit a network location for a work that was published at
|
||||||
|
least four years before the Document itself, or if the original
|
||||||
|
publisher of the version it refers to gives permission.
|
||||||
|
K. For any section Entitled "Acknowledgements" or "Dedications",
|
||||||
|
Preserve the Title of the section, and preserve in the section all
|
||||||
|
the substance and tone of each of the contributor acknowledgements
|
||||||
|
and/or dedications given therein.
|
||||||
|
L. Preserve all the Invariant Sections of the Document,
|
||||||
|
unaltered in their text and in their titles. Section numbers
|
||||||
|
or the equivalent are not considered part of the section titles.
|
||||||
|
M. Delete any section Entitled "Endorsements". Such a section
|
||||||
|
may not be included in the Modified Version.
|
||||||
|
N. Do not retitle any existing section to be Entitled "Endorsements"
|
||||||
|
or to conflict in title with any Invariant Section.
|
||||||
|
O. Preserve any Warranty Disclaimers.
|
||||||
|
|
||||||
|
If the Modified Version includes new front-matter sections or
|
||||||
|
appendices that qualify as Secondary Sections and contain no material
|
||||||
|
copied from the Document, you may at your option designate some or all
|
||||||
|
of these sections as invariant. To do this, add their titles to the
|
||||||
|
list of Invariant Sections in the Modified Version's license notice.
|
||||||
|
These titles must be distinct from any other section titles.
|
||||||
|
|
||||||
|
You may add a section Entitled "Endorsements", provided it contains
|
||||||
|
nothing but endorsements of your Modified Version by various
|
||||||
|
parties--for example, statements of peer review or that the text has
|
||||||
|
been approved by an organization as the authoritative definition of a
|
||||||
|
standard.
|
||||||
|
|
||||||
|
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||||
|
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||||
|
of Cover Texts in the Modified Version. Only one passage of
|
||||||
|
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||||
|
through arrangements made by) any one entity. If the Document already
|
||||||
|
includes a cover text for the same cover, previously added by you or
|
||||||
|
by arrangement made by the same entity you are acting on behalf of,
|
||||||
|
you may not add another; but you may replace the old one, on explicit
|
||||||
|
permission from the previous publisher that added the old one.
|
||||||
|
|
||||||
|
The author(s) and publisher(s) of the Document do not by this License
|
||||||
|
give permission to use their names for publicity for or to assert or
|
||||||
|
imply endorsement of any Modified Version.
|
||||||
|
|
||||||
|
|
||||||
|
5. COMBINING DOCUMENTS
|
||||||
|
|
||||||
|
You may combine the Document with other documents released under this
|
||||||
|
License, under the terms defined in section 4 above for modified
|
||||||
|
versions, provided that you include in the combination all of the
|
||||||
|
Invariant Sections of all of the original documents, unmodified, and
|
||||||
|
list them all as Invariant Sections of your combined work in its
|
||||||
|
license notice, and that you preserve all their Warranty Disclaimers.
|
||||||
|
|
||||||
|
The combined work need only contain one copy of this License, and
|
||||||
|
multiple identical Invariant Sections may be replaced with a single
|
||||||
|
copy. If there are multiple Invariant Sections with the same name but
|
||||||
|
different contents, make the title of each such section unique by
|
||||||
|
adding at the end of it, in parentheses, the name of the original
|
||||||
|
author or publisher of that section if known, or else a unique number.
|
||||||
|
Make the same adjustment to the section titles in the list of
|
||||||
|
Invariant Sections in the license notice of the combined work.
|
||||||
|
|
||||||
|
In the combination, you must combine any sections Entitled "History"
|
||||||
|
in the various original documents, forming one section Entitled
|
||||||
|
"History"; likewise combine any sections Entitled "Acknowledgements",
|
||||||
|
and any sections Entitled "Dedications". You must delete all sections
|
||||||
|
Entitled "Endorsements".
|
||||||
|
|
||||||
|
|
||||||
|
6. COLLECTIONS OF DOCUMENTS
|
||||||
|
|
||||||
|
You may make a collection consisting of the Document and other documents
|
||||||
|
released under this License, and replace the individual copies of this
|
||||||
|
License in the various documents with a single copy that is included in
|
||||||
|
the collection, provided that you follow the rules of this License for
|
||||||
|
verbatim copying of each of the documents in all other respects.
|
||||||
|
|
||||||
|
You may extract a single document from such a collection, and distribute
|
||||||
|
it individually under this License, provided you insert a copy of this
|
||||||
|
License into the extracted document, and follow this License in all
|
||||||
|
other respects regarding verbatim copying of that document.
|
||||||
|
|
||||||
|
|
||||||
|
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||||
|
|
||||||
|
A compilation of the Document or its derivatives with other separate
|
||||||
|
and independent documents or works, in or on a volume of a storage or
|
||||||
|
distribution medium, is called an "aggregate" if the copyright
|
||||||
|
resulting from the compilation is not used to limit the legal rights
|
||||||
|
of the compilation's users beyond what the individual works permit.
|
||||||
|
When the Document is included in an aggregate, this License does not
|
||||||
|
apply to the other works in the aggregate which are not themselves
|
||||||
|
derivative works of the Document.
|
||||||
|
|
||||||
|
If the Cover Text requirement of section 3 is applicable to these
|
||||||
|
copies of the Document, then if the Document is less than one half of
|
||||||
|
the entire aggregate, the Document's Cover Texts may be placed on
|
||||||
|
covers that bracket the Document within the aggregate, or the
|
||||||
|
electronic equivalent of covers if the Document is in electronic form.
|
||||||
|
Otherwise they must appear on printed covers that bracket the whole
|
||||||
|
aggregate.
|
||||||
|
|
||||||
|
|
||||||
|
8. TRANSLATION
|
||||||
|
|
||||||
|
Translation is considered a kind of modification, so you may
|
||||||
|
distribute translations of the Document under the terms of section 4.
|
||||||
|
Replacing Invariant Sections with translations requires special
|
||||||
|
permission from their copyright holders, but you may include
|
||||||
|
translations of some or all Invariant Sections in addition to the
|
||||||
|
original versions of these Invariant Sections. You may include a
|
||||||
|
translation of this License, and all the license notices in the
|
||||||
|
Document, and any Warranty Disclaimers, provided that you also include
|
||||||
|
the original English version of this License and the original versions
|
||||||
|
of those notices and disclaimers. In case of a disagreement between
|
||||||
|
the translation and the original version of this License or a notice
|
||||||
|
or disclaimer, the original version will prevail.
|
||||||
|
|
||||||
|
If a section in the Document is Entitled "Acknowledgements",
|
||||||
|
"Dedications", or "History", the requirement (section 4) to Preserve
|
||||||
|
its Title (section 1) will typically require changing the actual
|
||||||
|
title.
|
||||||
|
|
||||||
|
|
||||||
|
9. TERMINATION
|
||||||
|
|
||||||
|
You may not copy, modify, sublicense, or distribute the Document except
|
||||||
|
as expressly provided for under this License. Any other attempt to
|
||||||
|
copy, modify, sublicense or distribute the Document 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.
|
||||||
|
|
||||||
|
|
||||||
|
10. FUTURE REVISIONS OF THIS LICENSE
|
||||||
|
|
||||||
|
The Free Software Foundation may publish new, revised versions
|
||||||
|
of the GNU Free Documentation 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. See
|
||||||
|
http://www.gnu.org/copyleft/.
|
||||||
|
|
||||||
|
Each version of the License is given a distinguishing version number.
|
||||||
|
If the Document specifies that a particular numbered version of this
|
||||||
|
License "or any later version" applies to it, you have the option of
|
||||||
|
following the terms and conditions either of that specified version or
|
||||||
|
of any later version that has been published (not as a draft) by the
|
||||||
|
Free Software Foundation. If the Document does not specify a version
|
||||||
|
number of this License, you may choose any version ever published (not
|
||||||
|
as a draft) by the Free Software Foundation.
|
||||||
|
|
||||||
|
|
||||||
|
ADDENDUM: How to use this License for your documents
|
||||||
|
|
||||||
|
To use this License in a document you have written, include a copy of
|
||||||
|
the License in the document and put the following copyright and
|
||||||
|
license notices just after the title page:
|
||||||
|
|
||||||
|
Copyright (c) YEAR YOUR NAME.
|
||||||
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
under the terms of the GNU Free Documentation License, Version 1.2
|
||||||
|
or any later version published by the Free Software Foundation;
|
||||||
|
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||||
|
A copy of the license is included in the section entitled "GNU
|
||||||
|
Free Documentation License".
|
||||||
|
|
||||||
|
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||||
|
replace the "with...Texts." line with this:
|
||||||
|
|
||||||
|
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||||
|
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||||
|
|
||||||
|
If you have Invariant Sections without Cover Texts, or some other
|
||||||
|
combination of the three, merge those two alternatives to suit the
|
||||||
|
situation.
|
||||||
|
|
||||||
|
If your document contains nontrivial examples of program code, we
|
||||||
|
recommend releasing these examples in parallel under your choice of
|
||||||
|
free software license, such as the GNU General Public License,
|
||||||
|
to permit their use in free software.
|
340
src/FLAC/COPYING.GPL
Normal file
340
src/FLAC/COPYING.GPL
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) 19yy <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
504
src/FLAC/COPYING.LGPL
Normal file
504
src/FLAC/COPYING.LGPL
Normal file
@ -0,0 +1,504 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
not price. Our General Public Licenses are designed to make sure that
|
||||||
|
you have the freedom to distribute copies of free software (and charge
|
||||||
|
for this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
|
|
||||||
|
|
28
src/FLAC/COPYING.Xiph
Normal file
28
src/FLAC/COPYING.Xiph
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
|
||||||
|
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 name of the Xiph.org Foundation nor the names of its
|
||||||
|
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 FOUNDATION 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.
|
39
src/FLAC/Makefile.am
Normal file
39
src/FLAC/Makefile.am
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# FLAC - Free Lossless Audio Codec
|
||||||
|
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# This file is part the FLAC project. FLAC is comprised of several
|
||||||
|
# components distributed under difference licenses. The codec libraries
|
||||||
|
# are distributed under Xiph.Org's BSD-like license (see the file
|
||||||
|
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||||
|
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||||
|
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||||
|
# FLAC distribution contains at the top the terms under which it may be
|
||||||
|
# distributed.
|
||||||
|
#
|
||||||
|
# Since this particular file is relevant to all components of FLAC,
|
||||||
|
# it may be distributed under the Xiph.Org license, which is the least
|
||||||
|
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||||
|
# distribution.
|
||||||
|
|
||||||
|
#
|
||||||
|
# automake provides the following useful targets:
|
||||||
|
#
|
||||||
|
# all: build all programs and libraries using the current
|
||||||
|
# configuration (set by configure)
|
||||||
|
#
|
||||||
|
# check: build and run all self-tests
|
||||||
|
#
|
||||||
|
# clean: remove everything except what's required to build everything
|
||||||
|
#
|
||||||
|
# distclean: remove everything except what goes in the distribution
|
||||||
|
#
|
||||||
|
|
||||||
|
SUBDIRS = include src test
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
COPYING.FDL \
|
||||||
|
COPYING.GPL \
|
||||||
|
COPYING.LGPL \
|
||||||
|
COPYING.Xiph \
|
||||||
|
README \
|
||||||
|
strip_non_asm_libtool_args.sh
|
269
src/FLAC/README
Normal file
269
src/FLAC/README
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
/* FLAC - Free Lossless Audio Codec
|
||||||
|
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This file is part the FLAC project. FLAC is comprised of several
|
||||||
|
* components distributed under difference licenses. The codec libraries
|
||||||
|
* are distributed under Xiph.Org's BSD-like license (see the file
|
||||||
|
* COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||||
|
* plugins are distributed under the LGPL or GPL (see COPYING.LGPL and
|
||||||
|
* COPYING.GPL). The documentation is distributed under the Gnu FDL (see
|
||||||
|
* COPYING.FDL). Each file in the FLAC distribution contains at the top the
|
||||||
|
* terms under which it may be distributed.
|
||||||
|
*
|
||||||
|
* Since this particular file is relevant to all components of FLAC,
|
||||||
|
* it may be distributed under the Xiph.Org license, which is the least
|
||||||
|
* restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||||
|
* distribution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
FLAC (http://flac.sourceforge.net/) is an Open Source lossless audio
|
||||||
|
codec developed by Josh Coalson.
|
||||||
|
|
||||||
|
FLAC is comprised of
|
||||||
|
* `libFLAC', a library which implements reference encoders and
|
||||||
|
decoders for native FLAC and Ogg FLAC, and a metadata interface
|
||||||
|
* `libFLAC++', a C++ object wrapper library around libFLAC
|
||||||
|
* `flac', a command-line program for encoding and decoding files
|
||||||
|
* `metaflac', a command-line program for viewing and editing FLAC
|
||||||
|
metadata
|
||||||
|
* player plugins for XMMS and Winamp
|
||||||
|
* user and API documentation
|
||||||
|
|
||||||
|
The libraries (libFLAC, libFLAC++) are
|
||||||
|
licensed under Xiph.org's BSD-like license (see COPYING.Xiph). All other
|
||||||
|
programs and plugins are licensed under the GNU General Public License
|
||||||
|
(see COPYING.GPL). The documentation is licensed under the GNU Free
|
||||||
|
Documentation License (see COPYING.FDL).
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
FLAC - 1.1.4 - Contents
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
- Introduction
|
||||||
|
- Prerequisites
|
||||||
|
- Building in a GNU environment
|
||||||
|
- Building with Makefile.lite
|
||||||
|
- Building with MSVC
|
||||||
|
- Building on Mac OS X
|
||||||
|
- Note to embedded developers
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
Introduction
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
This is the source release for the FLAC project. See
|
||||||
|
|
||||||
|
doc/html/index.html
|
||||||
|
|
||||||
|
for full documentation.
|
||||||
|
|
||||||
|
A brief description of the directory tree:
|
||||||
|
|
||||||
|
doc/ the HTML documentation
|
||||||
|
flac.pbproj/ the Mac OS X Project Builder project
|
||||||
|
include/ public include files for libFLAC and libFLAC++
|
||||||
|
man/ the man page for `flac'
|
||||||
|
src/ the source code and private headers
|
||||||
|
test/ the test scripts
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
Prerequisites
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
To build FLAC with support for Ogg FLAC you must have built and installed
|
||||||
|
libogg according to the specific instructions below. You must have
|
||||||
|
libogg 1.1.2 or greater, or there will be seeking problems with Ogg FLAC.
|
||||||
|
|
||||||
|
If you are building on x86 and want the assembly optimizations, you will
|
||||||
|
need to have NASM >= 0.98.30 installed according to the specific instructions
|
||||||
|
below.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
Building in a GNU environment
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
FLAC uses autoconf and libtool for configuring and building.
|
||||||
|
Better documentation for these will be forthcoming, but in
|
||||||
|
general, this should work:
|
||||||
|
|
||||||
|
./configure && make && make check && make install
|
||||||
|
|
||||||
|
The 'make check' step is optional; omit it to skip all the tests,
|
||||||
|
which can take several hours and use around 70-80 megs of disk space.
|
||||||
|
Even though it will stop with an explicit message on any failure, it
|
||||||
|
does print out a lot of stuff so you might want to capture the output
|
||||||
|
to a file if you're having a problem. Also, don't run 'make check'
|
||||||
|
as root because it confuses some of the tests.
|
||||||
|
|
||||||
|
NOTE: Despite our best efforts it's entirely possible to have
|
||||||
|
problems when using older versions of autoconf, automake, or
|
||||||
|
libtool. If you have the latest versions and still can't get it
|
||||||
|
to work, see the next section on Makefile.lite.
|
||||||
|
|
||||||
|
There are a few FLAC-specific arguments you can give to
|
||||||
|
`configure':
|
||||||
|
|
||||||
|
--enable-debug : Builds everything with debug symbols and some
|
||||||
|
extra (and more verbose) error checking.
|
||||||
|
|
||||||
|
--disable-asm-optimizations : Disables the compilation of the
|
||||||
|
assembly routines. Many routines have assembly versions for
|
||||||
|
speed and `configure' is pretty good about knowing what is
|
||||||
|
supported, but you can use this option to build only from the
|
||||||
|
C sources.
|
||||||
|
|
||||||
|
--enable-sse : If you are building for an x86 CPU that supports
|
||||||
|
SSE instructions, you can enable some of the faster routines
|
||||||
|
if your operating system also supports SSE instructions. flac
|
||||||
|
can tell if the CPU supports the instructions but currently has
|
||||||
|
no way to test if the OS does, so if it does, you must pass
|
||||||
|
this argument to configure to use the SSE routines. If flac
|
||||||
|
crashes when built with this option you will have to go back and
|
||||||
|
configure without --enable-sse. Note that
|
||||||
|
--disable-asm-optimizations implies --disable-sse.
|
||||||
|
|
||||||
|
--enable-local-xmms-plugin : Installs the FLAC XMMS plugin in
|
||||||
|
$HOME/.xmms/Plugins, instead of the global XMMS plugin area
|
||||||
|
(usually /usr/lib/xmms/Input).
|
||||||
|
|
||||||
|
--with-ogg=
|
||||||
|
--with-xmms-prefix=
|
||||||
|
--with-libiconv-prefix=
|
||||||
|
Use these if you have these packages but configure can't find them.
|
||||||
|
|
||||||
|
If you want to build completely from scratch (i.e. starting with just
|
||||||
|
configure.in and Makefile.am) you should be able to just run 'autogen.sh'
|
||||||
|
but make sure and read the comments in that file first.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
Building with Makefile.lite
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
There is a more lightweight build system for do-it-yourself-ers.
|
||||||
|
It is also useful if configure isn't working, which may be the
|
||||||
|
case since lately we've had some problems with different versions
|
||||||
|
of automake and libtool. The Makefile.lite system should work
|
||||||
|
on GNU systems with few or no adjustments.
|
||||||
|
|
||||||
|
From the top level just 'make -f Makefile.lite'. You can
|
||||||
|
specify zero or one optional target from 'release', 'debug',
|
||||||
|
'test', or 'clean'. The default is 'release'. There is no
|
||||||
|
'install' target but everything you need will end up in the
|
||||||
|
obj/ directory.
|
||||||
|
|
||||||
|
If you are not on an x86 system or you don't have nasm, you
|
||||||
|
may have to change the DEFINES in src/libFLAC/Makefile.lite. If
|
||||||
|
you don't have nasm, remove -DFLAC__HAS_NASM. If your target is
|
||||||
|
not an x86, change -DFLAC__CPU_IA32 to -DFLAC__CPU_UNKNOWN.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
Building with MSVC
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
There are .dsp projects and a master FLAC.dsw workspace to build all
|
||||||
|
the libraries and executables with MSVC6. There are also .vcproj
|
||||||
|
projects and a master FLAC.sln solution to build all the libraries and
|
||||||
|
executables with VC++ 2005.
|
||||||
|
|
||||||
|
Prerequisite: you must have the Ogg libraries installed as described
|
||||||
|
later.
|
||||||
|
|
||||||
|
Prerequisite: you must have nasm installed, and nasmw.exe must be in
|
||||||
|
your PATH, or the path to nasmw.exe must be added to the list of
|
||||||
|
directories for executable files in the MSVC global options.
|
||||||
|
|
||||||
|
MSVC6:
|
||||||
|
To build everything, run Developer Studio, do File|Open Workspace,
|
||||||
|
and open FLAC.dsw. Select "Build | Set active configuration..."
|
||||||
|
from the menu, then in the dialog, select "All - Win32 Release" (or
|
||||||
|
Debug if you prefer). Click "Ok" then hit F7 to build.
|
||||||
|
|
||||||
|
VC++ 2005:
|
||||||
|
To build everything, run Visual Studio, do File|Open and open FLAC.sln.
|
||||||
|
From the dropdown in the toolbar, select "Release" instead of "Debug",
|
||||||
|
then hit F7 to build.
|
||||||
|
|
||||||
|
Either way, this will build all libraries both statically (e.g.
|
||||||
|
obj\release\lib\libFLAC_static.lib) and as DLLs (e.g.
|
||||||
|
obj\release\lib\libFLAC.dll), and it will build all binaries, statically
|
||||||
|
linked (e.g. obj\release\bin\flac.exe).
|
||||||
|
|
||||||
|
Everything will end up in the "obj" directory. DLLs and .exe files
|
||||||
|
are all that are needed and can be copied to an installation area and
|
||||||
|
added to the PATH. The plugins have to be copied to their appropriate
|
||||||
|
place in the player area. For Winamp2 this is <winamp2-dir>\Plugins.
|
||||||
|
|
||||||
|
By default the code is configured with Ogg support. Before building FLAC
|
||||||
|
you will need to get the Ogg source distribution
|
||||||
|
(see http://xiph.org/ogg/vorbis/download/), build ogg_static.lib (load and
|
||||||
|
build win32\ogg_static.dsp), copy ogg_static.lib into FLAC's
|
||||||
|
'obj\release\lib' directory, and copy the entire include\ogg tree into
|
||||||
|
FLAC's 'include' directory (so that there is an 'ogg' directory in FLAC's
|
||||||
|
'include' directory with the files ogg.h, os_types.h and config_types.h).
|
||||||
|
|
||||||
|
If you want to build without Ogg support, instead edit all .dsp or
|
||||||
|
.vcproj files and remove any occurrences of "/D FLAC__HAS_OGG".
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
Building on Mac OS X
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
If you have Fink, the GNU flow above should work. Otherwise,
|
||||||
|
there is a Project Builder project in the top-level source
|
||||||
|
directory to build libFLAC and the command-line utilities on
|
||||||
|
Mac OS X. In a terminal, cd to the top-level directory (the
|
||||||
|
one that contains this README file) and type:
|
||||||
|
|
||||||
|
pbxbuild -alltargets
|
||||||
|
|
||||||
|
This will create everything and leave it in the build/ directory.
|
||||||
|
Don't worry about the rest of the stuff that is in build/ or
|
||||||
|
the stuff that was already there before building.
|
||||||
|
|
||||||
|
The Project Builder project requires that you have libiconv and
|
||||||
|
libogg in /sw, ala fink. If you don't, you'll need to install
|
||||||
|
them somewhere and change the path to them in the Library Paths
|
||||||
|
section of several targets.
|
||||||
|
|
||||||
|
It also assumes the CPU supports Altivec instructions. If it does
|
||||||
|
not, you will also have to add -DFLAC__NO_ASM to the CFLAGS in the
|
||||||
|
libFLAC target.
|
||||||
|
|
||||||
|
There currently is no install procedure; you will have to
|
||||||
|
manually copy the tools to wherever you need them.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
Note to embedded developers
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
libFLAC has grown larger over time as more functionality has been
|
||||||
|
included, but much of it may be unnecessary for a particular embedded
|
||||||
|
implementation. Unused parts may be pruned by some simple editing of
|
||||||
|
configure.in and src/libFLAC/Makefile.am; the following dependency
|
||||||
|
graph shows which modules may be pruned without breaking things
|
||||||
|
further down:
|
||||||
|
|
||||||
|
stream_encoder.h
|
||||||
|
stream_decoder.h
|
||||||
|
format.h
|
||||||
|
|
||||||
|
stream_decoder.h
|
||||||
|
format.h
|
||||||
|
|
||||||
|
metadata.h
|
||||||
|
format.h
|
||||||
|
|
||||||
|
In other words, for pure decoding applications, both the stream encoder
|
||||||
|
and metadata editing interfaces can be safely removed.
|
||||||
|
|
||||||
|
There is a section dedicated to embedded use in the libFLAC API
|
||||||
|
HTML documentation (see doc/html/api/index.html).
|
42
src/FLAC/include/FLAC/Makefile.am
Normal file
42
src/FLAC/include/FLAC/Makefile.am
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# libFLAC - Free Lossless Audio Codec library
|
||||||
|
# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# 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 name of the Xiph.org Foundation nor the names of its
|
||||||
|
# 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 FOUNDATION 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.
|
||||||
|
|
||||||
|
flaccincludedir = $(includedir)/FLAC
|
||||||
|
|
||||||
|
flaccinclude_HEADERS = \
|
||||||
|
all.h \
|
||||||
|
assert.h \
|
||||||
|
callback.h \
|
||||||
|
export.h \
|
||||||
|
format.h \
|
||||||
|
metadata.h \
|
||||||
|
ordinals.h \
|
||||||
|
stream_decoder.h \
|
||||||
|
stream_encoder.h
|
344
src/FLAC/include/FLAC/all.h
Normal file
344
src/FLAC/include/FLAC/all.h
Normal file
@ -0,0 +1,344 @@
|
|||||||
|
/* libFLAC - Free Lossless Audio Codec library
|
||||||
|
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* 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 name of the Xiph.org Foundation nor the names of its
|
||||||
|
* 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 FOUNDATION 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLAC__ALL_H
|
||||||
|
#define FLAC__ALL_H
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
|
#include "assert.h"
|
||||||
|
#include "callback.h"
|
||||||
|
#include "format.h"
|
||||||
|
#include "metadata.h"
|
||||||
|
#include "ordinals.h"
|
||||||
|
#include "stream_decoder.h"
|
||||||
|
#include "stream_encoder.h"
|
||||||
|
|
||||||
|
/** \mainpage
|
||||||
|
*
|
||||||
|
* \section intro Introduction
|
||||||
|
*
|
||||||
|
* This is the documentation for the FLAC C and C++ APIs. It is
|
||||||
|
* highly interconnected; this introduction should give you a top
|
||||||
|
* level idea of the structure and how to find the information you
|
||||||
|
* need. As a prerequisite you should have at least a basic
|
||||||
|
* knowledge of the FLAC format, documented
|
||||||
|
* <A HREF="../format.html">here</A>.
|
||||||
|
*
|
||||||
|
* \section c_api FLAC C API
|
||||||
|
*
|
||||||
|
* The FLAC C API is the interface to libFLAC, a set of structures
|
||||||
|
* describing the components of FLAC streams, and functions for
|
||||||
|
* encoding and decoding streams, as well as manipulating FLAC
|
||||||
|
* metadata in files. The public include files will be installed
|
||||||
|
* in your include area (for example /usr/include/FLAC/...).
|
||||||
|
*
|
||||||
|
* By writing a little code and linking against libFLAC, it is
|
||||||
|
* relatively easy to add FLAC support to another program. The
|
||||||
|
* library is licensed under <A HREF="../license.html">Xiph's BSD license</A>.
|
||||||
|
* Complete source code of libFLAC as well as the command-line
|
||||||
|
* encoder and plugins is available and is a useful source of
|
||||||
|
* examples.
|
||||||
|
*
|
||||||
|
* Aside from encoders and decoders, libFLAC provides a powerful
|
||||||
|
* metadata interface for manipulating metadata in FLAC files. It
|
||||||
|
* allows the user to add, delete, and modify FLAC metadata blocks
|
||||||
|
* and it can automatically take advantage of PADDING blocks to avoid
|
||||||
|
* rewriting the entire FLAC file when changing the size of the
|
||||||
|
* metadata.
|
||||||
|
*
|
||||||
|
* libFLAC usually only requires the standard C library and C math
|
||||||
|
* library. In particular, threading is not used so there is no
|
||||||
|
* dependency on a thread library. However, libFLAC does not use
|
||||||
|
* global variables and should be thread-safe.
|
||||||
|
*
|
||||||
|
* libFLAC also supports encoding to and decoding from Ogg FLAC.
|
||||||
|
* However the metadata editing interfaces currently have limited
|
||||||
|
* read-only support for Ogg FLAC files.
|
||||||
|
*
|
||||||
|
* \section cpp_api FLAC C++ API
|
||||||
|
*
|
||||||
|
* The FLAC C++ API is a set of classes that encapsulate the
|
||||||
|
* structures and functions in libFLAC. They provide slightly more
|
||||||
|
* functionality with respect to metadata but are otherwise
|
||||||
|
* equivalent. For the most part, they share the same usage as
|
||||||
|
* their counterparts in libFLAC, and the FLAC C API documentation
|
||||||
|
* can be used as a supplement. The public include files
|
||||||
|
* for the C++ API will be installed in your include area (for
|
||||||
|
* example /usr/include/FLAC++/...).
|
||||||
|
*
|
||||||
|
* libFLAC++ is also licensed under
|
||||||
|
* <A HREF="../license.html">Xiph's BSD license</A>.
|
||||||
|
*
|
||||||
|
* \section getting_started Getting Started
|
||||||
|
*
|
||||||
|
* A good starting point for learning the API is to browse through
|
||||||
|
* the <A HREF="modules.html">modules</A>. Modules are logical
|
||||||
|
* groupings of related functions or classes, which correspond roughly
|
||||||
|
* to header files or sections of header files. Each module includes a
|
||||||
|
* detailed description of the general usage of its functions or
|
||||||
|
* classes.
|
||||||
|
*
|
||||||
|
* From there you can go on to look at the documentation of
|
||||||
|
* individual functions. You can see different views of the individual
|
||||||
|
* functions through the links in top bar across this page.
|
||||||
|
*
|
||||||
|
* \section porting_guide Porting Guide
|
||||||
|
*
|
||||||
|
* Starting with FLAC 1.1.3 a \link porting Porting Guide \endlink
|
||||||
|
* has been introduced which gives detailed instructions on how to
|
||||||
|
* port your code to newer versions of FLAC.
|
||||||
|
*
|
||||||
|
* \section embedded_developers Embedded Developers
|
||||||
|
*
|
||||||
|
* libFLAC has grown larger over time as more functionality has been
|
||||||
|
* included, but much of it may be unnecessary for a particular embedded
|
||||||
|
* implementation. Unused parts may be pruned by some simple editing of
|
||||||
|
* src/libFLAC/Makefile.am. In general, the decoders, encoders, and
|
||||||
|
* metadata interface are all independent from each other.
|
||||||
|
*
|
||||||
|
* It is easiest to just describe the dependencies:
|
||||||
|
*
|
||||||
|
* - All modules depend on the \link flac_format Format \endlink module.
|
||||||
|
* - The decoders and encoders depend on the bitbuffer.
|
||||||
|
* - The decoder is independent of the encoder. The encoder uses the
|
||||||
|
* decoder because of the verify feature, but this can be removed if
|
||||||
|
* not needed.
|
||||||
|
* - Parts of the metadata interface require the stream decoder (but not
|
||||||
|
* the encoder).
|
||||||
|
* - Ogg support is selectable through the compile time macro
|
||||||
|
* \c FLAC__HAS_OGG.
|
||||||
|
*
|
||||||
|
* For example, if your application only requires the stream decoder, no
|
||||||
|
* encoder, and no metadata interface, you can remove the stream encoder
|
||||||
|
* and the metadata interface, which will greatly reduce the size of the
|
||||||
|
* library.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \defgroup porting Porting Guide for New Versions
|
||||||
|
*
|
||||||
|
* This module describes differences in the library interfaces from
|
||||||
|
* version to version. It assists in the porting of code that uses
|
||||||
|
* the libraries to newer versions of FLAC.
|
||||||
|
*
|
||||||
|
* One simple facility for making porting easier that has been added
|
||||||
|
* in FLAC 1.1.3 is a set of \c #defines in \c export.h of each
|
||||||
|
* library's includes (e.g. \c include/FLAC/export.h). The
|
||||||
|
* \c #defines mirror the libraries'
|
||||||
|
* <A HREF="http://www.gnu.org/software/libtool/manual.html#Libtool-versioning">libtool version numbers</A>,
|
||||||
|
* e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT,
|
||||||
|
* \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE.
|
||||||
|
* These can be used to support multiple versions of an API during the
|
||||||
|
* transition phase, e.g.
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
|
||||||
|
* legacy code
|
||||||
|
* #else
|
||||||
|
* new code
|
||||||
|
* #endif
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* The the source will work for multiple versions and the legacy code can
|
||||||
|
* easily be removed when the transition is complete.
|
||||||
|
*
|
||||||
|
* Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in
|
||||||
|
* include/FLAC/export.h), which can be used to determine whether or not
|
||||||
|
* the library has been compiled with support for Ogg FLAC. This is
|
||||||
|
* simpler than trying to call an Ogg init function and catching the
|
||||||
|
* error.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \defgroup porting_1_1_2_to_1_1_3 Porting from FLAC 1.1.2 to 1.1.3
|
||||||
|
* \ingroup porting
|
||||||
|
*
|
||||||
|
* \brief
|
||||||
|
* This module describes porting from FLAC 1.1.2 to FLAC 1.1.3.
|
||||||
|
*
|
||||||
|
* The main change between the APIs in 1.1.2 and 1.1.3 is that they have
|
||||||
|
* been simplified. First, libOggFLAC has been merged into libFLAC and
|
||||||
|
* libOggFLAC++ has been merged into libFLAC++. Second, both the three
|
||||||
|
* decoding layers and three encoding layers have been merged into a
|
||||||
|
* single stream decoder and stream encoder. That is, the functionality
|
||||||
|
* of FLAC__SeekableStreamDecoder and FLAC__FileDecoder has been merged
|
||||||
|
* into FLAC__StreamDecoder, and FLAC__SeekableStreamEncoder and
|
||||||
|
* FLAC__FileEncoder into FLAC__StreamEncoder. Only the
|
||||||
|
* FLAC__StreamDecoder and FLAC__StreamEncoder remain. What this means
|
||||||
|
* is there is now a single API that can be used to encode or decode
|
||||||
|
* streams to/from native FLAC or Ogg FLAC and the single API can work
|
||||||
|
* on both seekable and non-seekable streams.
|
||||||
|
*
|
||||||
|
* Instead of creating an encoder or decoder of a certain layer, now the
|
||||||
|
* client will always create a FLAC__StreamEncoder or
|
||||||
|
* FLAC__StreamDecoder. The old layers are now differentiated by the
|
||||||
|
* initialization function. For example, for the decoder,
|
||||||
|
* FLAC__stream_decoder_init() has been replaced by
|
||||||
|
* FLAC__stream_decoder_init_stream(). This init function takes
|
||||||
|
* callbacks for the I/O, and the seeking callbacks are optional. This
|
||||||
|
* allows the client to use the same object for seekable and
|
||||||
|
* non-seekable streams. For decoding a FLAC file directly, the client
|
||||||
|
* can use FLAC__stream_decoder_init_file() and pass just a filename
|
||||||
|
* and fewer callbacks; most of the other callbacks are supplied
|
||||||
|
* internally. For situations where fopen()ing by filename is not
|
||||||
|
* possible (e.g. Unicode filenames on Windows) the client can instead
|
||||||
|
* open the file itself and supply the FILE* to
|
||||||
|
* FLAC__stream_decoder_init_FILE(). The init functions now returns a
|
||||||
|
* FLAC__StreamDecoderInitStatus instead of FLAC__StreamDecoderState.
|
||||||
|
* Since the callbacks and client data are now passed to the init
|
||||||
|
* function, the FLAC__stream_decoder_set_*_callback() functions and
|
||||||
|
* FLAC__stream_decoder_set_client_data() are no longer needed. The
|
||||||
|
* rest of the calls to the decoder are the same as before.
|
||||||
|
*
|
||||||
|
* There are counterpart init functions for Ogg FLAC, e.g.
|
||||||
|
* FLAC__stream_decoder_init_ogg_stream(). All the rest of the calls
|
||||||
|
* and callbacks are the same as for native FLAC.
|
||||||
|
*
|
||||||
|
* As an example, in FLAC 1.1.2 a seekable stream decoder would have
|
||||||
|
* been set up like so:
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* FLAC__SeekableStreamDecoder *decoder = FLAC__seekable_stream_decoder_new();
|
||||||
|
* if(decoder == NULL) do_something;
|
||||||
|
* FLAC__seekable_stream_decoder_set_md5_checking(decoder, true);
|
||||||
|
* [... other settings ...]
|
||||||
|
* FLAC__seekable_stream_decoder_set_read_callback(decoder, my_read_callback);
|
||||||
|
* FLAC__seekable_stream_decoder_set_seek_callback(decoder, my_seek_callback);
|
||||||
|
* FLAC__seekable_stream_decoder_set_tell_callback(decoder, my_tell_callback);
|
||||||
|
* FLAC__seekable_stream_decoder_set_length_callback(decoder, my_length_callback);
|
||||||
|
* FLAC__seekable_stream_decoder_set_eof_callback(decoder, my_eof_callback);
|
||||||
|
* FLAC__seekable_stream_decoder_set_write_callback(decoder, my_write_callback);
|
||||||
|
* FLAC__seekable_stream_decoder_set_metadata_callback(decoder, my_metadata_callback);
|
||||||
|
* FLAC__seekable_stream_decoder_set_error_callback(decoder, my_error_callback);
|
||||||
|
* FLAC__seekable_stream_decoder_set_client_data(decoder, my_client_data);
|
||||||
|
* if(FLAC__seekable_stream_decoder_init(decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) do_something;
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* In FLAC 1.1.3 it is like this:
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new();
|
||||||
|
* if(decoder == NULL) do_something;
|
||||||
|
* FLAC__stream_decoder_set_md5_checking(decoder, true);
|
||||||
|
* [... other settings ...]
|
||||||
|
* if(FLAC__stream_decoder_init_stream(
|
||||||
|
* decoder,
|
||||||
|
* my_read_callback,
|
||||||
|
* my_seek_callback, // or NULL
|
||||||
|
* my_tell_callback, // or NULL
|
||||||
|
* my_length_callback, // or NULL
|
||||||
|
* my_eof_callback, // or NULL
|
||||||
|
* my_write_callback,
|
||||||
|
* my_metadata_callback, // or NULL
|
||||||
|
* my_error_callback,
|
||||||
|
* my_client_data
|
||||||
|
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* or you could do;
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* [...]
|
||||||
|
* FILE *file = fopen("somefile.flac","rb");
|
||||||
|
* if(file == NULL) do_somthing;
|
||||||
|
* if(FLAC__stream_decoder_init_FILE(
|
||||||
|
* decoder,
|
||||||
|
* file,
|
||||||
|
* my_write_callback,
|
||||||
|
* my_metadata_callback, // or NULL
|
||||||
|
* my_error_callback,
|
||||||
|
* my_client_data
|
||||||
|
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* or just:
|
||||||
|
*
|
||||||
|
* \code
|
||||||
|
* [...]
|
||||||
|
* if(FLAC__stream_decoder_init_file(
|
||||||
|
* decoder,
|
||||||
|
* "somefile.flac",
|
||||||
|
* my_write_callback,
|
||||||
|
* my_metadata_callback, // or NULL
|
||||||
|
* my_error_callback,
|
||||||
|
* my_client_data
|
||||||
|
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
|
||||||
|
* \endcode
|
||||||
|
*
|
||||||
|
* Another small change to the decoder is in how it handles unparseable
|
||||||
|
* streams. Before, when the decoder found an unparseable stream
|
||||||
|
* (reserved for when the decoder encounters a stream from a future
|
||||||
|
* encoder that it can't parse), it changed the state to
|
||||||
|
* \c FLAC__STREAM_DECODER_UNPARSEABLE_STREAM. Now the decoder instead
|
||||||
|
* drops sync and calls the error callback with a new error code
|
||||||
|
* \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM. This is
|
||||||
|
* more robust. If your error callback does not discriminate on the the
|
||||||
|
* error state, your code does not need to be changed.
|
||||||
|
*
|
||||||
|
* The encoder now has a new setting:
|
||||||
|
* FLAC__stream_encoder_set_apodization(). This is for setting the
|
||||||
|
* method used to window the data before LPC analysis. You only need to
|
||||||
|
* add a call to this function if the default is not suitable. There
|
||||||
|
* are also two new convenience functions that may be useful:
|
||||||
|
* FLAC__metadata_object_cuesheet_calculate_cddb_id() and
|
||||||
|
* FLAC__metadata_get_cuesheet().
|
||||||
|
*
|
||||||
|
* The \a bytes parameter to FLAC__StreamDecoderReadCallback,
|
||||||
|
* FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback
|
||||||
|
* is now \c size_t instead of \c unsigned.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4
|
||||||
|
* \ingroup porting
|
||||||
|
*
|
||||||
|
* \brief
|
||||||
|
* This module describes porting from FLAC 1.1.3 to FLAC 1.1.4.
|
||||||
|
*
|
||||||
|
* There were no changes to any of the interfaces from 1.1.3 to 1.1.4.
|
||||||
|
* There was a slight change in the implementation of
|
||||||
|
* FLAC__stream_encoder_set_metadata(); the function now makes a copy
|
||||||
|
* of the \a metadata array of pointers so the client no longer needs
|
||||||
|
* to maintain it after the call. The objects themselves that are
|
||||||
|
* pointed to by the array are still not copied though and must be
|
||||||
|
* maintained until the call to FLAC__stream_encoder_finish().
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \defgroup flac FLAC C API
|
||||||
|
*
|
||||||
|
* The FLAC C API is the interface to libFLAC, a set of structures
|
||||||
|
* describing the components of FLAC streams, and functions for
|
||||||
|
* encoding and decoding streams, as well as manipulating FLAC
|
||||||
|
* metadata in files.
|
||||||
|
*
|
||||||
|
* You should start with the format components as all other modules
|
||||||
|
* are dependent on it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif
|
45
src/FLAC/include/FLAC/assert.h
Normal file
45
src/FLAC/include/FLAC/assert.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/* libFLAC - Free Lossless Audio Codec library
|
||||||
|
* Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* 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 name of the Xiph.org Foundation nor the names of its
|
||||||
|
* 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 FOUNDATION 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLAC__ASSERT_H
|
||||||
|
#define FLAC__ASSERT_H
|
||||||
|
|
||||||
|
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */
|
||||||
|
#ifdef DEBUG
|
||||||
|
#include <assert.h>
|
||||||
|
#define FLAC__ASSERT(x) assert(x)
|
||||||
|
#define FLAC__ASSERT_DECLARATION(x) x
|
||||||
|
#else
|
||||||
|
#define FLAC__ASSERT(x)
|
||||||
|
#define FLAC__ASSERT_DECLARATION(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
184
src/FLAC/include/FLAC/callback.h
Normal file
184
src/FLAC/include/FLAC/callback.h
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
/* libFLAC - Free Lossless Audio Codec library
|
||||||
|
* Copyright (C) 2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* 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 name of the Xiph.org Foundation nor the names of its
|
||||||
|
* 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 FOUNDATION 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLAC__CALLBACK_H
|
||||||
|
#define FLAC__CALLBACK_H
|
||||||
|
|
||||||
|
#include "ordinals.h"
|
||||||
|
#include <stdlib.h> /* for size_t */
|
||||||
|
|
||||||
|
/** \file include/FLAC/callback.h
|
||||||
|
*
|
||||||
|
* \brief
|
||||||
|
* This module defines the structures for describing I/O callbacks
|
||||||
|
* to the other FLAC interfaces.
|
||||||
|
*
|
||||||
|
* See the detailed documentation for callbacks in the
|
||||||
|
* \link flac_callbacks callbacks \endlink module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \defgroup flac_callbacks FLAC/callback.h: I/O callback structures
|
||||||
|
* \ingroup flac
|
||||||
|
*
|
||||||
|
* \brief
|
||||||
|
* This module defines the structures for describing I/O callbacks
|
||||||
|
* to the other FLAC interfaces.
|
||||||
|
*
|
||||||
|
* The purpose of the I/O callback functions is to create a common way
|
||||||
|
* for the metadata interfaces to handle I/O.
|
||||||
|
*
|
||||||
|
* Originally the metadata interfaces required filenames as the way of
|
||||||
|
* specifying FLAC files to operate on. This is problematic in some
|
||||||
|
* environments so there is an additional option to specify a set of
|
||||||
|
* callbacks for doing I/O on the FLAC file, instead of the filename.
|
||||||
|
*
|
||||||
|
* In addition to the callbacks, a FLAC__IOHandle type is defined as an
|
||||||
|
* opaque structure for a data source.
|
||||||
|
*
|
||||||
|
* The callback function prototypes are similar (but not identical) to the
|
||||||
|
* stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use
|
||||||
|
* stdio streams to implement the callbacks, you can pass fread, fwrite, and
|
||||||
|
* fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or
|
||||||
|
* FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle
|
||||||
|
* is required. \warning You generally CANNOT directly use fseek or ftell
|
||||||
|
* for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems
|
||||||
|
* these use 32-bit offsets and FLAC requires 64-bit offsets to deal with
|
||||||
|
* large files. You will have to find an equivalent function (e.g. ftello),
|
||||||
|
* or write a wrapper. The same is true for feof() since this is usually
|
||||||
|
* implemented as a macro, not as a function whose address can be taken.
|
||||||
|
*
|
||||||
|
* \{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** This is the opaque handle type used by the callbacks. Typically
|
||||||
|
* this is a \c FILE* or address of a file descriptor.
|
||||||
|
*/
|
||||||
|
typedef void* FLAC__IOHandle;
|
||||||
|
|
||||||
|
/** Signature for the read callback.
|
||||||
|
* The signature and semantics match POSIX fread() implementations
|
||||||
|
* and can generally be used interchangeably.
|
||||||
|
*
|
||||||
|
* \param ptr The address of the read buffer.
|
||||||
|
* \param size The size of the records to be read.
|
||||||
|
* \param nmemb The number of records to be read.
|
||||||
|
* \param handle The handle to the data source.
|
||||||
|
* \retval size_t
|
||||||
|
* The number of records read.
|
||||||
|
*/
|
||||||
|
typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
|
||||||
|
|
||||||
|
/** Signature for the write callback.
|
||||||
|
* The signature and semantics match POSIX fwrite() implementations
|
||||||
|
* and can generally be used interchangeably.
|
||||||
|
*
|
||||||
|
* \param ptr The address of the write buffer.
|
||||||
|
* \param size The size of the records to be written.
|
||||||
|
* \param nmemb The number of records to be written.
|
||||||
|
* \param handle The handle to the data source.
|
||||||
|
* \retval size_t
|
||||||
|
* The number of records written.
|
||||||
|
*/
|
||||||
|
typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
|
||||||
|
|
||||||
|
/** Signature for the seek callback.
|
||||||
|
* The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
|
||||||
|
* EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
|
||||||
|
* and 32-bits wide.
|
||||||
|
*
|
||||||
|
* \param handle The handle to the data source.
|
||||||
|
* \param offset The new position, relative to \a whence
|
||||||
|
* \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
|
||||||
|
* \retval int
|
||||||
|
* \c 0 on success, \c -1 on error.
|
||||||
|
*/
|
||||||
|
typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence);
|
||||||
|
|
||||||
|
/** Signature for the tell callback.
|
||||||
|
* The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
|
||||||
|
* EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
|
||||||
|
* and 32-bits wide.
|
||||||
|
*
|
||||||
|
* \param handle The handle to the data source.
|
||||||
|
* \retval FLAC__int64
|
||||||
|
* The current position on success, \c -1 on error.
|
||||||
|
*/
|
||||||
|
typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle);
|
||||||
|
|
||||||
|
/** Signature for the EOF callback.
|
||||||
|
* The signature and semantics mostly match POSIX feof() but WATCHOUT:
|
||||||
|
* on many systems, feof() is a macro, so in this case a wrapper function
|
||||||
|
* must be provided instead.
|
||||||
|
*
|
||||||
|
* \param handle The handle to the data source.
|
||||||
|
* \retval int
|
||||||
|
* \c 0 if not at end of file, nonzero if at end of file.
|
||||||
|
*/
|
||||||
|
typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle);
|
||||||
|
|
||||||
|
/** Signature for the close callback.
|
||||||
|
* The signature and semantics match POSIX fclose() implementations
|
||||||
|
* and can generally be used interchangeably.
|
||||||
|
*
|
||||||
|
* \param handle The handle to the data source.
|
||||||
|
* \retval int
|
||||||
|
* \c 0 on success, \c EOF on error.
|
||||||
|
*/
|
||||||
|
typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
|
||||||
|
|
||||||
|
/** A structure for holding a set of callbacks.
|
||||||
|
* Each FLAC interface that requires a FLAC__IOCallbacks structure will
|
||||||
|
* describe which of the callbacks are required. The ones that are not
|
||||||
|
* required may be set to NULL.
|
||||||
|
*
|
||||||
|
* If the seek requirement for an interface is optional, you can signify that
|
||||||
|
* a data sorce is not seekable by setting the \a seek field to \c NULL.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__IOCallback_Read read;
|
||||||
|
FLAC__IOCallback_Write write;
|
||||||
|
FLAC__IOCallback_Seek seek;
|
||||||
|
FLAC__IOCallback_Tell tell;
|
||||||
|
FLAC__IOCallback_Eof eof;
|
||||||
|
FLAC__IOCallback_Close close;
|
||||||
|
} FLAC__IOCallbacks;
|
||||||
|
|
||||||
|
/* \} */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
87
src/FLAC/include/FLAC/export.h
Normal file
87
src/FLAC/include/FLAC/export.h
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/* libFLAC - Free Lossless Audio Codec library
|
||||||
|
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* 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 name of the Xiph.org Foundation nor the names of its
|
||||||
|
* 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 FOUNDATION 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLAC__EXPORT_H
|
||||||
|
#define FLAC__EXPORT_H
|
||||||
|
|
||||||
|
/** \file include/FLAC/export.h
|
||||||
|
*
|
||||||
|
* \brief
|
||||||
|
* This module contains #defines and symbols for exporting function
|
||||||
|
* calls, and providing version information and compiled-in features.
|
||||||
|
*
|
||||||
|
* See the \link flac_export export \endlink module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \defgroup flac_export FLAC/export.h: export symbols
|
||||||
|
* \ingroup flac
|
||||||
|
*
|
||||||
|
* \brief
|
||||||
|
* This module contains #defines and symbols for exporting function
|
||||||
|
* calls, and providing version information and compiled-in features.
|
||||||
|
*
|
||||||
|
* \{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(FLAC__NO_DLL) || !defined(_MSC_VER)
|
||||||
|
#define FLAC_API
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifdef FLAC_API_EXPORTS
|
||||||
|
#define FLAC_API _declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define FLAC_API _declspec(dllimport)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** These #defines will mirror the libtool-based library version number, see
|
||||||
|
* http://www.gnu.org/software/libtool/manual.html#Libtool-versioning
|
||||||
|
*/
|
||||||
|
#define FLAC_API_VERSION_CURRENT 8
|
||||||
|
#define FLAC_API_VERSION_REVISION 1 /**< see above */
|
||||||
|
#define FLAC_API_VERSION_AGE 0 /**< see above */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
|
||||||
|
extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* \} */
|
||||||
|
|
||||||
|
#endif
|
995
src/FLAC/include/FLAC/format.h
Normal file
995
src/FLAC/include/FLAC/format.h
Normal file
@ -0,0 +1,995 @@
|
|||||||
|
/* libFLAC - Free Lossless Audio Codec library
|
||||||
|
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* 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 name of the Xiph.org Foundation nor the names of its
|
||||||
|
* 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 FOUNDATION 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLAC__FORMAT_H
|
||||||
|
#define FLAC__FORMAT_H
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
#include "ordinals.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** \file include/FLAC/format.h
|
||||||
|
*
|
||||||
|
* \brief
|
||||||
|
* This module contains structure definitions for the representation
|
||||||
|
* of FLAC format components in memory. These are the basic
|
||||||
|
* structures used by the rest of the interfaces.
|
||||||
|
*
|
||||||
|
* See the detailed documentation in the
|
||||||
|
* \link flac_format format \endlink module.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \defgroup flac_format FLAC/format.h: format components
|
||||||
|
* \ingroup flac
|
||||||
|
*
|
||||||
|
* \brief
|
||||||
|
* This module contains structure definitions for the representation
|
||||||
|
* of FLAC format components in memory. These are the basic
|
||||||
|
* structures used by the rest of the interfaces.
|
||||||
|
*
|
||||||
|
* First, you should be familiar with the
|
||||||
|
* <A HREF="../format.html">FLAC format</A>. Many of the values here
|
||||||
|
* follow directly from the specification. As a user of libFLAC, the
|
||||||
|
* interesting parts really are the structures that describe the frame
|
||||||
|
* header and metadata blocks.
|
||||||
|
*
|
||||||
|
* The format structures here are very primitive, designed to store
|
||||||
|
* information in an efficient way. Reading information from the
|
||||||
|
* structures is easy but creating or modifying them directly is
|
||||||
|
* more complex. For the most part, as a user of a library, editing
|
||||||
|
* is not necessary; however, for metadata blocks it is, so there are
|
||||||
|
* convenience functions provided in the \link flac_metadata metadata
|
||||||
|
* module \endlink to simplify the manipulation of metadata blocks.
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* It's not the best convention, but symbols ending in _LEN are in bits
|
||||||
|
* and _LENGTH are in bytes. _LENGTH symbols are \#defines instead of
|
||||||
|
* global variables because they are usually used when declaring byte
|
||||||
|
* arrays and some compilers require compile-time knowledge of array
|
||||||
|
* sizes when declared on the stack.
|
||||||
|
*
|
||||||
|
* \{
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Most of the values described in this file are defined by the FLAC
|
||||||
|
format specification. There is nothing to tune here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** The largest legal metadata type code. */
|
||||||
|
#define FLAC__MAX_METADATA_TYPE_CODE (126u)
|
||||||
|
|
||||||
|
/** The minimum block size, in samples, permitted by the format. */
|
||||||
|
#define FLAC__MIN_BLOCK_SIZE (16u)
|
||||||
|
|
||||||
|
/** The maximum block size, in samples, permitted by the format. */
|
||||||
|
#define FLAC__MAX_BLOCK_SIZE (65535u)
|
||||||
|
|
||||||
|
/** The maximum block size, in samples, permitted by the FLAC subset for
|
||||||
|
* sample rates up to 48kHz. */
|
||||||
|
#define FLAC__SUBSET_MAX_BLOCK_SIZE_48000HZ (4608u)
|
||||||
|
|
||||||
|
/** The maximum number of channels permitted by the format. */
|
||||||
|
#define FLAC__MAX_CHANNELS (8u)
|
||||||
|
|
||||||
|
/** The minimum sample resolution permitted by the format. */
|
||||||
|
#define FLAC__MIN_BITS_PER_SAMPLE (4u)
|
||||||
|
|
||||||
|
/** The maximum sample resolution permitted by the format. */
|
||||||
|
#define FLAC__MAX_BITS_PER_SAMPLE (32u)
|
||||||
|
|
||||||
|
/** The maximum sample resolution permitted by libFLAC.
|
||||||
|
*
|
||||||
|
* \warning
|
||||||
|
* FLAC__MAX_BITS_PER_SAMPLE is the limit of the FLAC format. However,
|
||||||
|
* the reference encoder/decoder is currently limited to 24 bits because
|
||||||
|
* of prevalent 32-bit math, so make sure and use this value when
|
||||||
|
* appropriate.
|
||||||
|
*/
|
||||||
|
#define FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE (24u)
|
||||||
|
|
||||||
|
/** The maximum sample rate permitted by the format. The value is
|
||||||
|
* ((2 ^ 16) - 1) * 10; see <A HREF="../format.html">FLAC format</A>
|
||||||
|
* as to why.
|
||||||
|
*/
|
||||||
|
#define FLAC__MAX_SAMPLE_RATE (655350u)
|
||||||
|
|
||||||
|
/** The maximum LPC order permitted by the format. */
|
||||||
|
#define FLAC__MAX_LPC_ORDER (32u)
|
||||||
|
|
||||||
|
/** The maximum LPC order permitted by the FLAC subset for sample rates
|
||||||
|
* up to 48kHz. */
|
||||||
|
#define FLAC__SUBSET_MAX_LPC_ORDER_48000HZ (12u)
|
||||||
|
|
||||||
|
/** The minimum quantized linear predictor coefficient precision
|
||||||
|
* permitted by the format.
|
||||||
|
*/
|
||||||
|
#define FLAC__MIN_QLP_COEFF_PRECISION (5u)
|
||||||
|
|
||||||
|
/** The maximum quantized linear predictor coefficient precision
|
||||||
|
* permitted by the format.
|
||||||
|
*/
|
||||||
|
#define FLAC__MAX_QLP_COEFF_PRECISION (15u)
|
||||||
|
|
||||||
|
/** The maximum order of the fixed predictors permitted by the format. */
|
||||||
|
#define FLAC__MAX_FIXED_ORDER (4u)
|
||||||
|
|
||||||
|
/** The maximum Rice partition order permitted by the format. */
|
||||||
|
#define FLAC__MAX_RICE_PARTITION_ORDER (15u)
|
||||||
|
|
||||||
|
/** The maximum Rice partition order permitted by the FLAC Subset. */
|
||||||
|
#define FLAC__SUBSET_MAX_RICE_PARTITION_ORDER (8u)
|
||||||
|
|
||||||
|
/** The version string of the release, stamped onto the libraries and binaries.
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* This does not correspond to the shared library version number, which
|
||||||
|
* is used to determine binary compatibility.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const char *FLAC__VERSION_STRING;
|
||||||
|
|
||||||
|
/** The vendor string inserted by the encoder into the VORBIS_COMMENT block.
|
||||||
|
* This is a NUL-terminated ASCII string; when inserted into the
|
||||||
|
* VORBIS_COMMENT the trailing null is stripped.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const char *FLAC__VENDOR_STRING;
|
||||||
|
|
||||||
|
/** The byte string representation of the beginning of a FLAC stream. */
|
||||||
|
extern FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4]; /* = "fLaC" */
|
||||||
|
|
||||||
|
/** The 32-bit integer big-endian representation of the beginning of
|
||||||
|
* a FLAC stream.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_SYNC; /* = 0x664C6143 */
|
||||||
|
|
||||||
|
/** The length of the FLAC signature in bits. */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_SYNC_LEN; /* = 32 bits */
|
||||||
|
|
||||||
|
/** The length of the FLAC signature in bytes. */
|
||||||
|
#define FLAC__STREAM_SYNC_LENGTH (4u)
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* Subframe structures
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/** An enumeration of the available entropy coding methods. */
|
||||||
|
typedef enum {
|
||||||
|
FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE = 0
|
||||||
|
/**< Residual is coded by partitioning into contexts, each with it's own
|
||||||
|
* Rice parameter. */
|
||||||
|
} FLAC__EntropyCodingMethodType;
|
||||||
|
|
||||||
|
/** Maps a FLAC__EntropyCodingMethodType to a C string.
|
||||||
|
*
|
||||||
|
* Using a FLAC__EntropyCodingMethodType as the index to this array will
|
||||||
|
* give the string equivalent. The contents should not be modified.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[];
|
||||||
|
|
||||||
|
|
||||||
|
/** Contents of a Rice partitioned residual
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
|
||||||
|
unsigned *parameters;
|
||||||
|
/**< The Rice parameters for each context. */
|
||||||
|
|
||||||
|
unsigned *raw_bits;
|
||||||
|
/**< Widths for escape-coded partitions. */
|
||||||
|
|
||||||
|
unsigned capacity_by_order;
|
||||||
|
/**< The capacity of the \a parameters and \a raw_bits arrays
|
||||||
|
* specified as an order, i.e. the number of array elements
|
||||||
|
* allocated is 2 ^ \a capacity_by_order.
|
||||||
|
*/
|
||||||
|
} FLAC__EntropyCodingMethod_PartitionedRiceContents;
|
||||||
|
|
||||||
|
/** Header for a Rice partitioned residual. (c.f. <A HREF="../format.html#partitioned_rice">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
|
||||||
|
unsigned order;
|
||||||
|
/**< The partition order, i.e. # of contexts = 2 ^ \a order. */
|
||||||
|
|
||||||
|
const FLAC__EntropyCodingMethod_PartitionedRiceContents *contents;
|
||||||
|
/**< The context's Rice parameters and/or raw bits. */
|
||||||
|
|
||||||
|
} FLAC__EntropyCodingMethod_PartitionedRice;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; /**< == 4 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; /**< == 4 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN; /**< == 5 (bits) */
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
|
||||||
|
/**< == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */
|
||||||
|
|
||||||
|
/** Header for the entropy coding method. (c.f. <A HREF="../format.html#residual">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__EntropyCodingMethodType type;
|
||||||
|
union {
|
||||||
|
FLAC__EntropyCodingMethod_PartitionedRice partitioned_rice;
|
||||||
|
} data;
|
||||||
|
} FLAC__EntropyCodingMethod;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN; /**< == 2 (bits) */
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/** An enumeration of the available subframe types. */
|
||||||
|
typedef enum {
|
||||||
|
FLAC__SUBFRAME_TYPE_CONSTANT = 0, /**< constant signal */
|
||||||
|
FLAC__SUBFRAME_TYPE_VERBATIM = 1, /**< uncompressed signal */
|
||||||
|
FLAC__SUBFRAME_TYPE_FIXED = 2, /**< fixed polynomial prediction */
|
||||||
|
FLAC__SUBFRAME_TYPE_LPC = 3 /**< linear prediction */
|
||||||
|
} FLAC__SubframeType;
|
||||||
|
|
||||||
|
/** Maps a FLAC__SubframeType to a C string.
|
||||||
|
*
|
||||||
|
* Using a FLAC__SubframeType as the index to this array will
|
||||||
|
* give the string equivalent. The contents should not be modified.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const char * const FLAC__SubframeTypeString[];
|
||||||
|
|
||||||
|
|
||||||
|
/** CONSTANT subframe. (c.f. <A HREF="../format.html#subframe_constant">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__int32 value; /**< The constant signal value. */
|
||||||
|
} FLAC__Subframe_Constant;
|
||||||
|
|
||||||
|
|
||||||
|
/** VERBATIM subframe. (c.f. <A HREF="../format.html#subframe_verbatim">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
const FLAC__int32 *data; /**< A pointer to verbatim signal. */
|
||||||
|
} FLAC__Subframe_Verbatim;
|
||||||
|
|
||||||
|
|
||||||
|
/** FIXED subframe. (c.f. <A HREF="../format.html#subframe_fixed">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__EntropyCodingMethod entropy_coding_method;
|
||||||
|
/**< The residual coding method. */
|
||||||
|
|
||||||
|
unsigned order;
|
||||||
|
/**< The polynomial order. */
|
||||||
|
|
||||||
|
FLAC__int32 warmup[FLAC__MAX_FIXED_ORDER];
|
||||||
|
/**< Warmup samples to prime the predictor, length == order. */
|
||||||
|
|
||||||
|
const FLAC__int32 *residual;
|
||||||
|
/**< The residual signal, length == (blocksize minus order) samples. */
|
||||||
|
} FLAC__Subframe_Fixed;
|
||||||
|
|
||||||
|
|
||||||
|
/** LPC subframe. (c.f. <A HREF="../format.html#subframe_lpc">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__EntropyCodingMethod entropy_coding_method;
|
||||||
|
/**< The residual coding method. */
|
||||||
|
|
||||||
|
unsigned order;
|
||||||
|
/**< The FIR order. */
|
||||||
|
|
||||||
|
unsigned qlp_coeff_precision;
|
||||||
|
/**< Quantized FIR filter coefficient precision in bits. */
|
||||||
|
|
||||||
|
int quantization_level;
|
||||||
|
/**< The qlp coeff shift needed. */
|
||||||
|
|
||||||
|
FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER];
|
||||||
|
/**< FIR filter coefficients. */
|
||||||
|
|
||||||
|
FLAC__int32 warmup[FLAC__MAX_LPC_ORDER];
|
||||||
|
/**< Warmup samples to prime the predictor, length == order. */
|
||||||
|
|
||||||
|
const FLAC__int32 *residual;
|
||||||
|
/**< The residual signal, length == (blocksize minus order) samples. */
|
||||||
|
} FLAC__Subframe_LPC;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN; /**< == 4 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN; /**< == 5 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC subframe structure. (c.f. <A HREF="../format.html#subframe">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__SubframeType type;
|
||||||
|
union {
|
||||||
|
FLAC__Subframe_Constant constant;
|
||||||
|
FLAC__Subframe_Fixed fixed;
|
||||||
|
FLAC__Subframe_LPC lpc;
|
||||||
|
FLAC__Subframe_Verbatim verbatim;
|
||||||
|
} data;
|
||||||
|
unsigned wasted_bits;
|
||||||
|
} FLAC__Subframe;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN; /**< == 1 (bit) */
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN; /**< == 6 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN; /**< == 1 (bit) */
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK; /**< = 0x00 */
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK; /**< = 0x02 */
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK; /**< = 0x10 */
|
||||||
|
extern FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK; /**< = 0x40 */
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* Frame structures
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/** An enumeration of the available channel assignments. */
|
||||||
|
typedef enum {
|
||||||
|
FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, /**< independent channels */
|
||||||
|
FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, /**< left+side stereo */
|
||||||
|
FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, /**< right+side stereo */
|
||||||
|
FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 /**< mid+side stereo */
|
||||||
|
} FLAC__ChannelAssignment;
|
||||||
|
|
||||||
|
/** Maps a FLAC__ChannelAssignment to a C string.
|
||||||
|
*
|
||||||
|
* Using a FLAC__ChannelAssignment as the index to this array will
|
||||||
|
* give the string equivalent. The contents should not be modified.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const char * const FLAC__ChannelAssignmentString[];
|
||||||
|
|
||||||
|
/** An enumeration of the possible frame numbering methods. */
|
||||||
|
typedef enum {
|
||||||
|
FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER, /**< number contains the frame number */
|
||||||
|
FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER /**< number contains the sample number of first sample in frame */
|
||||||
|
} FLAC__FrameNumberType;
|
||||||
|
|
||||||
|
/** Maps a FLAC__FrameNumberType to a C string.
|
||||||
|
*
|
||||||
|
* Using a FLAC__FrameNumberType as the index to this array will
|
||||||
|
* give the string equivalent. The contents should not be modified.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const char * const FLAC__FrameNumberTypeString[];
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC frame header structure. (c.f. <A HREF="../format.html#frame_header">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned blocksize;
|
||||||
|
/**< The number of samples per subframe. */
|
||||||
|
|
||||||
|
unsigned sample_rate;
|
||||||
|
/**< The sample rate in Hz. */
|
||||||
|
|
||||||
|
unsigned channels;
|
||||||
|
/**< The number of channels (== number of subframes). */
|
||||||
|
|
||||||
|
FLAC__ChannelAssignment channel_assignment;
|
||||||
|
/**< The channel assignment for the frame. */
|
||||||
|
|
||||||
|
unsigned bits_per_sample;
|
||||||
|
/**< The sample resolution. */
|
||||||
|
|
||||||
|
FLAC__FrameNumberType number_type;
|
||||||
|
/**< The numbering scheme used for the frame. */
|
||||||
|
|
||||||
|
union {
|
||||||
|
FLAC__uint32 frame_number;
|
||||||
|
FLAC__uint64 sample_number;
|
||||||
|
} number;
|
||||||
|
/**< The frame number or sample number of first sample in frame;
|
||||||
|
* use the \a number_type value to determine which to use. */
|
||||||
|
|
||||||
|
FLAC__uint8 crc;
|
||||||
|
/**< CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0)
|
||||||
|
* of the raw frame header bytes, meaning everything before the CRC byte
|
||||||
|
* including the sync code.
|
||||||
|
*/
|
||||||
|
} FLAC__FrameHeader;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC; /**< == 0x3ffe; the frame header sync code */
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN; /**< == 14 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN; /**< == 2 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN; /**< == 4 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN; /**< == 4 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN; /**< == 4 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN; /**< == 3 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN; /**< == 1 (bit) */
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN; /**< == 8 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC frame footer structure. (c.f. <A HREF="../format.html#frame_footer">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__uint16 crc;
|
||||||
|
/**< CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with
|
||||||
|
* 0) of the bytes before the crc, back to and including the frame header
|
||||||
|
* sync code.
|
||||||
|
*/
|
||||||
|
} FLAC__FrameFooter;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN; /**< == 16 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC frame structure. (c.f. <A HREF="../format.html#frame">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__FrameHeader header;
|
||||||
|
FLAC__Subframe subframes[FLAC__MAX_CHANNELS];
|
||||||
|
FLAC__FrameFooter footer;
|
||||||
|
} FLAC__Frame;
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* Meta-data structures
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/** An enumeration of the available metadata block types. */
|
||||||
|
typedef enum {
|
||||||
|
|
||||||
|
FLAC__METADATA_TYPE_STREAMINFO = 0,
|
||||||
|
/**< <A HREF="../format.html#metadata_block_streaminfo">STREAMINFO</A> block */
|
||||||
|
|
||||||
|
FLAC__METADATA_TYPE_PADDING = 1,
|
||||||
|
/**< <A HREF="../format.html#metadata_block_padding">PADDING</A> block */
|
||||||
|
|
||||||
|
FLAC__METADATA_TYPE_APPLICATION = 2,
|
||||||
|
/**< <A HREF="../format.html#metadata_block_application">APPLICATION</A> block */
|
||||||
|
|
||||||
|
FLAC__METADATA_TYPE_SEEKTABLE = 3,
|
||||||
|
/**< <A HREF="../format.html#metadata_block_seektable">SEEKTABLE</A> block */
|
||||||
|
|
||||||
|
FLAC__METADATA_TYPE_VORBIS_COMMENT = 4,
|
||||||
|
/**< <A HREF="../format.html#metadata_block_vorbis_comment">VORBISCOMMENT</A> block (a.k.a. FLAC tags) */
|
||||||
|
|
||||||
|
FLAC__METADATA_TYPE_CUESHEET = 5,
|
||||||
|
/**< <A HREF="../format.html#metadata_block_cuesheet">CUESHEET</A> block */
|
||||||
|
|
||||||
|
FLAC__METADATA_TYPE_PICTURE = 6,
|
||||||
|
/**< <A HREF="../format.html#metadata_block_picture">PICTURE</A> block */
|
||||||
|
|
||||||
|
FLAC__METADATA_TYPE_UNDEFINED = 7
|
||||||
|
/**< marker to denote beginning of undefined type range; this number will increase as new metadata types are added */
|
||||||
|
|
||||||
|
} FLAC__MetadataType;
|
||||||
|
|
||||||
|
/** Maps a FLAC__MetadataType to a C string.
|
||||||
|
*
|
||||||
|
* Using a FLAC__MetadataType as the index to this array will
|
||||||
|
* give the string equivalent. The contents should not be modified.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const char * const FLAC__MetadataTypeString[];
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC STREAMINFO structure. (c.f. <A HREF="../format.html#metadata_block_streaminfo">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned min_blocksize, max_blocksize;
|
||||||
|
unsigned min_framesize, max_framesize;
|
||||||
|
unsigned sample_rate;
|
||||||
|
unsigned channels;
|
||||||
|
unsigned bits_per_sample;
|
||||||
|
FLAC__uint64 total_samples;
|
||||||
|
FLAC__byte md5sum[16];
|
||||||
|
} FLAC__StreamMetadata_StreamInfo;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN; /**< == 16 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN; /**< == 16 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN; /**< == 24 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN; /**< == 24 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN; /**< == 20 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN; /**< == 3 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN; /**< == 5 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN; /**< == 36 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN; /**< == 128 (bits) */
|
||||||
|
|
||||||
|
/** The total stream length of the STREAMINFO block in bytes. */
|
||||||
|
#define FLAC__STREAM_METADATA_STREAMINFO_LENGTH (34u)
|
||||||
|
|
||||||
|
/** FLAC PADDING structure. (c.f. <A HREF="../format.html#metadata_block_padding">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
int dummy;
|
||||||
|
/**< Conceptually this is an empty struct since we don't store the
|
||||||
|
* padding bytes. Empty structs are not allowed by some C compilers,
|
||||||
|
* hence the dummy.
|
||||||
|
*/
|
||||||
|
} FLAC__StreamMetadata_Padding;
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC APPLICATION structure. (c.f. <A HREF="../format.html#metadata_block_application">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__byte id[4];
|
||||||
|
FLAC__byte *data;
|
||||||
|
} FLAC__StreamMetadata_Application;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN; /**< == 32 (bits) */
|
||||||
|
|
||||||
|
/** SeekPoint structure used in SEEKTABLE blocks. (c.f. <A HREF="../format.html#seekpoint">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__uint64 sample_number;
|
||||||
|
/**< The sample number of the target frame. */
|
||||||
|
|
||||||
|
FLAC__uint64 stream_offset;
|
||||||
|
/**< The offset, in bytes, of the target frame with respect to
|
||||||
|
* beginning of the first frame. */
|
||||||
|
|
||||||
|
unsigned frame_samples;
|
||||||
|
/**< The number of samples in the target frame. */
|
||||||
|
} FLAC__StreamMetadata_SeekPoint;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN; /**< == 64 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN; /**< == 64 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN; /**< == 16 (bits) */
|
||||||
|
|
||||||
|
/** The total stream length of a seek point in bytes. */
|
||||||
|
#define FLAC__STREAM_METADATA_SEEKPOINT_LENGTH (18u)
|
||||||
|
|
||||||
|
/** The value used in the \a sample_number field of
|
||||||
|
* FLAC__StreamMetadataSeekPoint used to indicate a placeholder
|
||||||
|
* point (== 0xffffffffffffffff).
|
||||||
|
*/
|
||||||
|
extern FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC SEEKTABLE structure. (c.f. <A HREF="../format.html#metadata_block_seektable">format specification</A>)
|
||||||
|
*
|
||||||
|
* \note From the format specification:
|
||||||
|
* - The seek points must be sorted by ascending sample number.
|
||||||
|
* - Each seek point's sample number must be the first sample of the
|
||||||
|
* target frame.
|
||||||
|
* - Each seek point's sample number must be unique within the table.
|
||||||
|
* - Existence of a SEEKTABLE block implies a correct setting of
|
||||||
|
* total_samples in the stream_info block.
|
||||||
|
* - Behavior is undefined when more than one SEEKTABLE block is
|
||||||
|
* present in a stream.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned num_points;
|
||||||
|
FLAC__StreamMetadata_SeekPoint *points;
|
||||||
|
} FLAC__StreamMetadata_SeekTable;
|
||||||
|
|
||||||
|
|
||||||
|
/** Vorbis comment entry structure used in VORBIS_COMMENT blocks. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
|
||||||
|
*
|
||||||
|
* For convenience, the APIs maintain a trailing NUL character at the end of
|
||||||
|
* \a entry which is not counted toward \a length, i.e.
|
||||||
|
* \code strlen(entry) == length \endcode
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__uint32 length;
|
||||||
|
FLAC__byte *entry;
|
||||||
|
} FLAC__StreamMetadata_VorbisComment_Entry;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN; /**< == 32 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC VORBIS_COMMENT structure. (c.f. <A HREF="../format.html#metadata_block_vorbis_comment">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__StreamMetadata_VorbisComment_Entry vendor_string;
|
||||||
|
FLAC__uint32 num_comments;
|
||||||
|
FLAC__StreamMetadata_VorbisComment_Entry *comments;
|
||||||
|
} FLAC__StreamMetadata_VorbisComment;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN; /**< == 32 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC CUESHEET track index structure. (See the
|
||||||
|
* <A HREF="../format.html#cuesheet_track_index">format specification</A> for
|
||||||
|
* the full description of each field.)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__uint64 offset;
|
||||||
|
/**< Offset in samples, relative to the track offset, of the index
|
||||||
|
* point.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FLAC__byte number;
|
||||||
|
/**< The index point number. */
|
||||||
|
} FLAC__StreamMetadata_CueSheet_Index;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN; /**< == 64 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN; /**< == 8 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN; /**< == 3*8 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC CUESHEET track structure. (See the
|
||||||
|
* <A HREF="../format.html#cuesheet_track">format specification</A> for
|
||||||
|
* the full description of each field.)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__uint64 offset;
|
||||||
|
/**< Track offset in samples, relative to the beginning of the FLAC audio stream. */
|
||||||
|
|
||||||
|
FLAC__byte number;
|
||||||
|
/**< The track number. */
|
||||||
|
|
||||||
|
char isrc[13];
|
||||||
|
/**< Track ISRC. This is a 12-digit alphanumeric code plus a trailing \c NUL byte */
|
||||||
|
|
||||||
|
unsigned type:1;
|
||||||
|
/**< The track type: 0 for audio, 1 for non-audio. */
|
||||||
|
|
||||||
|
unsigned pre_emphasis:1;
|
||||||
|
/**< The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. */
|
||||||
|
|
||||||
|
FLAC__byte num_indices;
|
||||||
|
/**< The number of track index points. */
|
||||||
|
|
||||||
|
FLAC__StreamMetadata_CueSheet_Index *indices;
|
||||||
|
/**< NULL if num_indices == 0, else pointer to array of index points. */
|
||||||
|
|
||||||
|
} FLAC__StreamMetadata_CueSheet_Track;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN; /**< == 64 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN; /**< == 8 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN; /**< == 12*8 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN; /**< == 1 (bit) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN; /**< == 1 (bit) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN; /**< == 6+13*8 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN; /**< == 8 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC CUESHEET structure. (See the
|
||||||
|
* <A HREF="../format.html#metadata_block_cuesheet">format specification</A>
|
||||||
|
* for the full description of each field.)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
char media_catalog_number[129];
|
||||||
|
/**< Media catalog number, in ASCII printable characters 0x20-0x7e. In
|
||||||
|
* general, the media catalog number may be 0 to 128 bytes long; any
|
||||||
|
* unused characters should be right-padded with NUL characters.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FLAC__uint64 lead_in;
|
||||||
|
/**< The number of lead-in samples. */
|
||||||
|
|
||||||
|
FLAC__bool is_cd;
|
||||||
|
/**< \c true if CUESHEET corresponds to a Compact Disc, else \c false. */
|
||||||
|
|
||||||
|
unsigned num_tracks;
|
||||||
|
/**< The number of tracks. */
|
||||||
|
|
||||||
|
FLAC__StreamMetadata_CueSheet_Track *tracks;
|
||||||
|
/**< NULL if num_tracks == 0, else pointer to array of tracks. */
|
||||||
|
|
||||||
|
} FLAC__StreamMetadata_CueSheet;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN; /**< == 128*8 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN; /**< == 64 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN; /**< == 1 (bit) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN; /**< == 7+258*8 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN; /**< == 8 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag). */
|
||||||
|
typedef enum {
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER = 0, /**< Other */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD = 1, /**< 32x32 pixels 'file icon' (PNG only) */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON = 2, /**< Other file icon */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER = 3, /**< Cover (front) */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER = 4, /**< Cover (back) */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_LEAFLET_PAGE = 5, /**< Leaflet page */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA = 6, /**< Media (e.g. label side of CD) */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_LEAD_ARTIST = 7, /**< Lead artist/lead performer/soloist */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_ARTIST = 8, /**< Artist/performer */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_CONDUCTOR = 9, /**< Conductor */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_BAND = 10, /**< Band/Orchestra */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_COMPOSER = 11, /**< Composer */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_LYRICIST = 12, /**< Lyricist/text writer */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_RECORDING_LOCATION = 13, /**< Recording Location */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_RECORDING = 14, /**< During recording */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_PERFORMANCE = 15, /**< During performance */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_VIDEO_SCREEN_CAPTURE = 16, /**< Movie/video screen capture */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_FISH = 17, /**< A bright coloured fish */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_ILLUSTRATION = 18, /**< Illustration */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_BAND_LOGOTYPE = 19, /**< Band/artist logotype */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_PUBLISHER_LOGOTYPE = 20, /**< Publisher/Studio logotype */
|
||||||
|
FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED
|
||||||
|
} FLAC__StreamMetadata_Picture_Type;
|
||||||
|
|
||||||
|
/** Maps a FLAC__StreamMetadata_Picture_Type to a C string.
|
||||||
|
*
|
||||||
|
* Using a FLAC__StreamMetadata_Picture_Type as the index to this array
|
||||||
|
* will give the string equivalent. The contents should not be
|
||||||
|
* modified.
|
||||||
|
*/
|
||||||
|
extern FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[];
|
||||||
|
|
||||||
|
/** FLAC PICTURE structure. (See the
|
||||||
|
* <A HREF="../format.html#metadata_block_picture">format specification</A>
|
||||||
|
* for the full description of each field.)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__StreamMetadata_Picture_Type type;
|
||||||
|
/**< The kind of picture stored. */
|
||||||
|
|
||||||
|
char *mime_type;
|
||||||
|
/**< Picture data's MIME type, in ASCII printable characters
|
||||||
|
* 0x20-0x7e, NUL terminated. For best compatibility with players,
|
||||||
|
* use picture data of MIME type \c image/jpeg or \c image/png. A
|
||||||
|
* MIME type of '-->' is also allowed, in which case the picture
|
||||||
|
* data should be a complete URL. In file storage, the MIME type is
|
||||||
|
* stored as a 32-bit length followed by the ASCII string with no NUL
|
||||||
|
* terminator, but is converted to a plain C string in this structure
|
||||||
|
* for convenience.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FLAC__byte *description;
|
||||||
|
/**< Picture's description in UTF-8, NUL terminated. In file storage,
|
||||||
|
* the description is stored as a 32-bit length followed by the UTF-8
|
||||||
|
* string with no NUL terminator, but is converted to a plain C string
|
||||||
|
* in this structure for convenience.
|
||||||
|
*/
|
||||||
|
|
||||||
|
FLAC__uint32 width;
|
||||||
|
/**< Picture's width in pixels. */
|
||||||
|
|
||||||
|
FLAC__uint32 height;
|
||||||
|
/**< Picture's height in pixels. */
|
||||||
|
|
||||||
|
FLAC__uint32 depth;
|
||||||
|
/**< Picture's color depth in bits-per-pixel. */
|
||||||
|
|
||||||
|
FLAC__uint32 colors;
|
||||||
|
/**< For indexed palettes (like GIF), picture's number of colors (the
|
||||||
|
* number of palette entries), or \c 0 for non-indexed (i.e. 2^depth).
|
||||||
|
*/
|
||||||
|
|
||||||
|
FLAC__uint32 data_length;
|
||||||
|
/**< Length of binary picture data in bytes. */
|
||||||
|
|
||||||
|
FLAC__byte *data;
|
||||||
|
/**< Binary picture data. */
|
||||||
|
|
||||||
|
} FLAC__StreamMetadata_Picture;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN; /**< == 32 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN; /**< == 32 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN; /**< == 32 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN; /**< == 32 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN; /**< == 32 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN; /**< == 32 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN; /**< == 32 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN; /**< == 32 (bits) */
|
||||||
|
|
||||||
|
|
||||||
|
/** Structure that is used when a metadata block of unknown type is loaded.
|
||||||
|
* The contents are opaque. The structure is used only internally to
|
||||||
|
* correctly handle unknown metadata.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__byte *data;
|
||||||
|
} FLAC__StreamMetadata_Unknown;
|
||||||
|
|
||||||
|
|
||||||
|
/** FLAC metadata block structure. (c.f. <A HREF="../format.html#metadata_block">format specification</A>)
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
FLAC__MetadataType type;
|
||||||
|
/**< The type of the metadata block; used determine which member of the
|
||||||
|
* \a data union to dereference. If type >= FLAC__METADATA_TYPE_UNDEFINED
|
||||||
|
* then \a data.unknown must be used. */
|
||||||
|
|
||||||
|
FLAC__bool is_last;
|
||||||
|
/**< \c true if this metadata block is the last, else \a false */
|
||||||
|
|
||||||
|
unsigned length;
|
||||||
|
/**< Length, in bytes, of the block data as it appears in the stream. */
|
||||||
|
|
||||||
|
union {
|
||||||
|
FLAC__StreamMetadata_StreamInfo stream_info;
|
||||||
|
FLAC__StreamMetadata_Padding padding;
|
||||||
|
FLAC__StreamMetadata_Application application;
|
||||||
|
FLAC__StreamMetadata_SeekTable seek_table;
|
||||||
|
FLAC__StreamMetadata_VorbisComment vorbis_comment;
|
||||||
|
FLAC__StreamMetadata_CueSheet cue_sheet;
|
||||||
|
FLAC__StreamMetadata_Picture picture;
|
||||||
|
FLAC__StreamMetadata_Unknown unknown;
|
||||||
|
} data;
|
||||||
|
/**< Polymorphic block data; use the \a type value to determine which
|
||||||
|
* to use. */
|
||||||
|
} FLAC__StreamMetadata;
|
||||||
|
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN; /**< == 1 (bit) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN; /**< == 7 (bits) */
|
||||||
|
extern FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN; /**< == 24 (bits) */
|
||||||
|
|
||||||
|
/** The total stream length of a metadata block header in bytes. */
|
||||||
|
#define FLAC__STREAM_METADATA_HEADER_LENGTH (4u)
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* Utility functions
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/** Tests that a sample rate is valid for FLAC.
|
||||||
|
*
|
||||||
|
* \param sample_rate The sample rate to test for compliance.
|
||||||
|
* \retval FLAC__bool
|
||||||
|
* \c true if the given sample rate conforms to the specification, else
|
||||||
|
* \c false.
|
||||||
|
*/
|
||||||
|
FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate);
|
||||||
|
|
||||||
|
/** Tests that a sample rate is valid for the FLAC subset. The subset rules
|
||||||
|
* for valid sample rates are slightly more complex since the rate has to
|
||||||
|
* be expressible completely in the frame header.
|
||||||
|
*
|
||||||
|
* \param sample_rate The sample rate to test for compliance.
|
||||||
|
* \retval FLAC__bool
|
||||||
|
* \c true if the given sample rate conforms to the specification for the
|
||||||
|
* subset, else \c false.
|
||||||
|
*/
|
||||||
|
FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate);
|
||||||
|
|
||||||
|
/** Check a Vorbis comment entry name to see if it conforms to the Vorbis
|
||||||
|
* comment specification.
|
||||||
|
*
|
||||||
|
* Vorbis comment names must be composed only of characters from
|
||||||
|
* [0x20-0x3C,0x3E-0x7D].
|
||||||
|
*
|
||||||
|
* \param name A NUL-terminated string to be checked.
|
||||||
|
* \assert
|
||||||
|
* \code name != NULL \endcode
|
||||||
|
* \retval FLAC__bool
|
||||||
|
* \c false if entry name is illegal, else \c true.
|
||||||
|
*/
|
||||||
|
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *name);
|
||||||
|
|
||||||
|
/** Check a Vorbis comment entry value to see if it conforms to the Vorbis
|
||||||
|
* comment specification.
|
||||||
|
*
|
||||||
|
* Vorbis comment values must be valid UTF-8 sequences.
|
||||||
|
*
|
||||||
|
* \param value A string to be checked.
|
||||||
|
* \param length A the length of \a value in bytes. May be
|
||||||
|
* \c (unsigned)(-1) to indicate that \a value is a plain
|
||||||
|
* UTF-8 NUL-terminated string.
|
||||||
|
* \assert
|
||||||
|
* \code value != NULL \endcode
|
||||||
|
* \retval FLAC__bool
|
||||||
|
* \c false if entry name is illegal, else \c true.
|
||||||
|
*/
|
||||||
|
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length);
|
||||||
|
|
||||||
|
/** Check a Vorbis comment entry to see if it conforms to the Vorbis
|
||||||
|
* comment specification.
|
||||||
|
*
|
||||||
|
* Vorbis comment entries must be of the form 'name=value', and 'name' and
|
||||||
|
* 'value' must be legal according to
|
||||||
|
* FLAC__format_vorbiscomment_entry_name_is_legal() and
|
||||||
|
* FLAC__format_vorbiscomment_entry_value_is_legal() respectively.
|
||||||
|
*
|
||||||
|
* \param entry An entry to be checked.
|
||||||
|
* \param length The length of \a entry in bytes.
|
||||||
|
* \assert
|
||||||
|
* \code value != NULL \endcode
|
||||||
|
* \retval FLAC__bool
|
||||||
|
* \c false if entry name is illegal, else \c true.
|
||||||
|
*/
|
||||||
|
FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length);
|
||||||
|
|
||||||
|
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||||
|
/** Check a seek table to see if it conforms to the FLAC specification.
|
||||||
|
* See the format specification for limits on the contents of the
|
||||||
|
* seek table.
|
||||||
|
*
|
||||||
|
* \param seek_table A pointer to a seek table to be checked.
|
||||||
|
* \assert
|
||||||
|
* \code seek_table != NULL \endcode
|
||||||
|
* \retval FLAC__bool
|
||||||
|
* \c false if seek table is illegal, else \c true.
|
||||||
|
*/
|
||||||
|
FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table);
|
||||||
|
|
||||||
|
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||||
|
/** Sort a seek table's seek points according to the format specification.
|
||||||
|
* This includes a "unique-ification" step to remove duplicates, i.e.
|
||||||
|
* seek points with identical \a sample_number values. Duplicate seek
|
||||||
|
* points are converted into placeholder points and sorted to the end of
|
||||||
|
* the table.
|
||||||
|
*
|
||||||
|
* \param seek_table A pointer to a seek table to be sorted.
|
||||||
|
* \assert
|
||||||
|
* \code seek_table != NULL \endcode
|
||||||
|
* \retval unsigned
|
||||||
|
* The number of duplicate seek points converted into placeholders.
|
||||||
|
*/
|
||||||
|
FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table);
|
||||||
|
|
||||||
|
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||||
|
/** Check a cue sheet to see if it conforms to the FLAC specification.
|
||||||
|
* See the format specification for limits on the contents of the
|
||||||
|
* cue sheet.
|
||||||
|
*
|
||||||
|
* \param cue_sheet A pointer to an existing cue sheet to be checked.
|
||||||
|
* \param check_cd_da_subset If \c true, check CUESHEET against more
|
||||||
|
* stringent requirements for a CD-DA (audio) disc.
|
||||||
|
* \param violation Address of a pointer to a string. If there is a
|
||||||
|
* violation, a pointer to a string explanation of the
|
||||||
|
* violation will be returned here. \a violation may be
|
||||||
|
* \c NULL if you don't need the returned string. Do not
|
||||||
|
* free the returned string; it will always point to static
|
||||||
|
* data.
|
||||||
|
* \assert
|
||||||
|
* \code cue_sheet != NULL \endcode
|
||||||
|
* \retval FLAC__bool
|
||||||
|
* \c false if cue sheet is illegal, else \c true.
|
||||||
|
*/
|
||||||
|
FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation);
|
||||||
|
|
||||||
|
/* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */
|
||||||
|
/** Check picture data to see if it conforms to the FLAC specification.
|
||||||
|
* See the format specification for limits on the contents of the
|
||||||
|
* PICTURE block.
|
||||||
|
*
|
||||||
|
* \param picture A pointer to existing picture data to be checked.
|
||||||
|
* \param violation Address of a pointer to a string. If there is a
|
||||||
|
* violation, a pointer to a string explanation of the
|
||||||
|
* violation will be returned here. \a violation may be
|
||||||
|
* \c NULL if you don't need the returned string. Do not
|
||||||
|
* free the returned string; it will always point to static
|
||||||
|
* data.
|
||||||
|
* \assert
|
||||||
|
* \code picture != NULL \endcode
|
||||||
|
* \retval FLAC__bool
|
||||||
|
* \c false if picture data is illegal, else \c true.
|
||||||
|
*/
|
||||||
|
FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Picture *picture, const char **violation);
|
||||||
|
|
||||||
|
/* \} */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
2112
src/FLAC/include/FLAC/metadata.h
Normal file
2112
src/FLAC/include/FLAC/metadata.h
Normal file
File diff suppressed because it is too large
Load Diff
80
src/FLAC/include/FLAC/ordinals.h
Normal file
80
src/FLAC/include/FLAC/ordinals.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/* libFLAC - Free Lossless Audio Codec library
|
||||||
|
* Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* 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 name of the Xiph.org Foundation nor the names of its
|
||||||
|
* 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 FOUNDATION 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLAC__ORDINALS_H
|
||||||
|
#define FLAC__ORDINALS_H
|
||||||
|
|
||||||
|
#if !(defined(_MSC_VER) || defined(__BORLANDC__) || defined(__EMX__))
|
||||||
|
#include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef signed char FLAC__int8;
|
||||||
|
typedef unsigned char FLAC__uint8;
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
|
typedef __int16 FLAC__int16;
|
||||||
|
typedef __int32 FLAC__int32;
|
||||||
|
typedef __int64 FLAC__int64;
|
||||||
|
typedef unsigned __int16 FLAC__uint16;
|
||||||
|
typedef unsigned __int32 FLAC__uint32;
|
||||||
|
typedef unsigned __int64 FLAC__uint64;
|
||||||
|
#elif defined(__EMX__)
|
||||||
|
typedef short FLAC__int16;
|
||||||
|
typedef long FLAC__int32;
|
||||||
|
typedef long long FLAC__int64;
|
||||||
|
typedef unsigned short FLAC__uint16;
|
||||||
|
typedef unsigned long FLAC__uint32;
|
||||||
|
typedef unsigned long long FLAC__uint64;
|
||||||
|
#else
|
||||||
|
typedef int16_t FLAC__int16;
|
||||||
|
typedef int32_t FLAC__int32;
|
||||||
|
typedef int64_t FLAC__int64;
|
||||||
|
typedef uint16_t FLAC__uint16;
|
||||||
|
typedef uint32_t FLAC__uint32;
|
||||||
|
typedef uint64_t FLAC__uint64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int FLAC__bool;
|
||||||
|
|
||||||
|
typedef FLAC__uint8 FLAC__byte;
|
||||||
|
|
||||||
|
#ifdef true
|
||||||
|
#undef true
|
||||||
|
#endif
|
||||||
|
#ifdef false
|
||||||
|
#undef false
|
||||||
|
#endif
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#define true 1
|
||||||
|
#define false 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
1559
src/FLAC/include/FLAC/stream_decoder.h
Normal file
1559
src/FLAC/include/FLAC/stream_decoder.h
Normal file
File diff suppressed because it is too large
Load Diff
1769
src/FLAC/include/FLAC/stream_encoder.h
Normal file
1769
src/FLAC/include/FLAC/stream_encoder.h
Normal file
File diff suppressed because it is too large
Load Diff
18
src/FLAC/include/Makefile.am
Normal file
18
src/FLAC/include/Makefile.am
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# FLAC - Free Lossless Audio Codec
|
||||||
|
# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
#
|
||||||
|
# This file is part the FLAC project. FLAC is comprised of several
|
||||||
|
# components distributed under difference licenses. The codec libraries
|
||||||
|
# are distributed under Xiph.Org's BSD-like license (see the file
|
||||||
|
# COPYING.Xiph in this distribution). All other programs, libraries, and
|
||||||
|
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
|
||||||
|
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
|
||||||
|
# FLAC distribution contains at the top the terms under which it may be
|
||||||
|
# distributed.
|
||||||
|
#
|
||||||
|
# Since this particular file is relevant to all components of FLAC,
|
||||||
|
# it may be distributed under the Xiph.Org license, which is the least
|
||||||
|
# restrictive of those mentioned above. See the file COPYING.Xiph in this
|
||||||
|
# distribution.
|
||||||
|
|
||||||
|
SUBDIRS = FLAC share test_libs_common
|
12
src/FLAC/include/share/Makefile.am
Normal file
12
src/FLAC/include/share/Makefile.am
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
SUBDIRS = grabbag
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
getopt.h \
|
||||||
|
grabbag.h \
|
||||||
|
replaygain_analysis.h \
|
||||||
|
replaygain_synthesis.h \
|
||||||
|
utf8.h
|
184
src/FLAC/include/share/getopt.h
Normal file
184
src/FLAC/include/share/getopt.h
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
/*
|
||||||
|
NOTE:
|
||||||
|
I cannot get the vanilla getopt code to work (i.e. compile only what
|
||||||
|
is needed and not duplicate symbols found in the standard library)
|
||||||
|
on all the platforms that FLAC supports. In particular the gating
|
||||||
|
of code with the ELIDE_CODE #define is not accurate enough on systems
|
||||||
|
that are POSIX but not glibc. If someone has a patch that works on
|
||||||
|
GNU/Linux, Darwin, AND Solaris please submit it on the project page:
|
||||||
|
http://sourceforge.net/projects/flac
|
||||||
|
|
||||||
|
In the meantime I have munged the global symbols and removed gates
|
||||||
|
around code, while at the same time trying to touch the original as
|
||||||
|
little as possible.
|
||||||
|
*/
|
||||||
|
/* Declarations for getopt.
|
||||||
|
Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#ifndef SHARE__GETOPT_H
|
||||||
|
#define SHARE__GETOPT_H
|
||||||
|
|
||||||
|
/*[JEC] was:#ifndef __need_getopt*/
|
||||||
|
/*[JEC] was:# define _GETOPT_H 1*/
|
||||||
|
/*[JEC] was:#endif*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For communication from `share__getopt' to the caller.
|
||||||
|
When `share__getopt' finds an option that takes an argument,
|
||||||
|
the argument value is returned here.
|
||||||
|
Also, when `ordering' is RETURN_IN_ORDER,
|
||||||
|
each non-option ARGV-element is returned here. */
|
||||||
|
|
||||||
|
extern char *share__optarg;
|
||||||
|
|
||||||
|
/* Index in ARGV of the next element to be scanned.
|
||||||
|
This is used for communication to and from the caller
|
||||||
|
and for communication between successive calls to `share__getopt'.
|
||||||
|
|
||||||
|
On entry to `share__getopt', zero means this is the first call; initialize.
|
||||||
|
|
||||||
|
When `share__getopt' returns -1, this is the index of the first of the
|
||||||
|
non-option elements that the caller should itself scan.
|
||||||
|
|
||||||
|
Otherwise, `share__optind' communicates from one call to the next
|
||||||
|
how much of ARGV has been scanned so far. */
|
||||||
|
|
||||||
|
extern int share__optind;
|
||||||
|
|
||||||
|
/* Callers store zero here to inhibit the error message `share__getopt' prints
|
||||||
|
for unrecognized options. */
|
||||||
|
|
||||||
|
extern int share__opterr;
|
||||||
|
|
||||||
|
/* Set to an option character which was unrecognized. */
|
||||||
|
|
||||||
|
extern int share__optopt;
|
||||||
|
|
||||||
|
/*[JEC] was:#ifndef __need_getopt */
|
||||||
|
/* Describe the long-named options requested by the application.
|
||||||
|
The LONG_OPTIONS argument to share__getopt_long or share__getopt_long_only is a vector
|
||||||
|
of `struct share__option' terminated by an element containing a name which is
|
||||||
|
zero.
|
||||||
|
|
||||||
|
The field `has_arg' is:
|
||||||
|
share__no_argument (or 0) if the option does not take an argument,
|
||||||
|
share__required_argument (or 1) if the option requires an argument,
|
||||||
|
share__optional_argument (or 2) if the option takes an optional argument.
|
||||||
|
|
||||||
|
If the field `flag' is not NULL, it points to a variable that is set
|
||||||
|
to the value given in the field `val' when the option is found, but
|
||||||
|
left unchanged if the option is not found.
|
||||||
|
|
||||||
|
To have a long-named option do something other than set an `int' to
|
||||||
|
a compiled-in constant, such as set a value from `share__optarg', set the
|
||||||
|
option's `flag' field to zero and its `val' field to a nonzero
|
||||||
|
value (the equivalent single-letter option character, if there is
|
||||||
|
one). For long options that have a zero `flag' field, `share__getopt'
|
||||||
|
returns the contents of the `val' field. */
|
||||||
|
|
||||||
|
struct share__option
|
||||||
|
{
|
||||||
|
# if defined __STDC__ && __STDC__
|
||||||
|
const char *name;
|
||||||
|
# else
|
||||||
|
char *name;
|
||||||
|
# endif
|
||||||
|
/* has_arg can't be an enum because some compilers complain about
|
||||||
|
type mismatches in all the code that assumes it is an int. */
|
||||||
|
int has_arg;
|
||||||
|
int *flag;
|
||||||
|
int val;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Names for the values of the `has_arg' field of `struct share__option'. */
|
||||||
|
|
||||||
|
# define share__no_argument 0
|
||||||
|
# define share__required_argument 1
|
||||||
|
# define share__optional_argument 2
|
||||||
|
/*[JEC] was:#endif*/ /* need getopt */
|
||||||
|
|
||||||
|
|
||||||
|
/* Get definitions and prototypes for functions to process the
|
||||||
|
arguments in ARGV (ARGC of them, minus the program name) for
|
||||||
|
options given in OPTS.
|
||||||
|
|
||||||
|
Return the option character from OPTS just read. Return -1 when
|
||||||
|
there are no more options. For unrecognized options, or options
|
||||||
|
missing arguments, `share__optopt' is set to the option letter, and '?' is
|
||||||
|
returned.
|
||||||
|
|
||||||
|
The OPTS string is a list of characters which are recognized option
|
||||||
|
letters, optionally followed by colons, specifying that that letter
|
||||||
|
takes an argument, to be placed in `share__optarg'.
|
||||||
|
|
||||||
|
If a letter in OPTS is followed by two colons, its argument is
|
||||||
|
optional. This behavior is specific to the GNU `share__getopt'.
|
||||||
|
|
||||||
|
The argument `--' causes premature termination of argument
|
||||||
|
scanning, explicitly telling `share__getopt' that there are no more
|
||||||
|
options.
|
||||||
|
|
||||||
|
If OPTS begins with `--', then non-option arguments are treated as
|
||||||
|
arguments to the option '\0'. This behavior is specific to the GNU
|
||||||
|
`share__getopt'. */
|
||||||
|
|
||||||
|
/*[JEC] was:#if defined __STDC__ && __STDC__*/
|
||||||
|
/*[JEC] was:# ifdef __GNU_LIBRARY__*/
|
||||||
|
/* Many other libraries have conflicting prototypes for getopt, with
|
||||||
|
differences in the consts, in stdlib.h. To avoid compilation
|
||||||
|
errors, only prototype getopt for the GNU C library. */
|
||||||
|
extern int share__getopt (int argc, char **argv, const char *shortopts);
|
||||||
|
/*[JEC] was:# else*/ /* not __GNU_LIBRARY__ */
|
||||||
|
/*[JEC] was:extern int getopt ();*/
|
||||||
|
/*[JEC] was:# endif*/ /* __GNU_LIBRARY__ */
|
||||||
|
|
||||||
|
/*[JEC] was:# ifndef __need_getopt*/
|
||||||
|
extern int share__getopt_long (int argc, char **argv, const char *shortopts,
|
||||||
|
const struct share__option *longopts, int *longind);
|
||||||
|
extern int share__getopt_long_only (int argc, char **argv,
|
||||||
|
const char *shortopts,
|
||||||
|
const struct share__option *longopts, int *longind);
|
||||||
|
|
||||||
|
/* Internal only. Users should not call this directly. */
|
||||||
|
extern int share___getopt_internal (int argc, char **argv,
|
||||||
|
const char *shortopts,
|
||||||
|
const struct share__option *longopts, int *longind,
|
||||||
|
int long_only);
|
||||||
|
/*[JEC] was:# endif*/
|
||||||
|
/*[JEC] was:#else*/ /* not __STDC__ */
|
||||||
|
/*[JEC] was:extern int getopt ();*/
|
||||||
|
/*[JEC] was:# ifndef __need_getopt*/
|
||||||
|
/*[JEC] was:extern int getopt_long ();*/
|
||||||
|
/*[JEC] was:extern int getopt_long_only ();*/
|
||||||
|
|
||||||
|
/*[JEC] was:extern int _getopt_internal ();*/
|
||||||
|
/*[JEC] was:# endif*/
|
||||||
|
/*[JEC] was:#endif*/ /* __STDC__ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Make sure we later can get all the definitions and declarations. */
|
||||||
|
/*[JEC] was:#undef __need_getopt*/
|
||||||
|
|
||||||
|
#endif /* getopt.h */
|
29
src/FLAC/include/share/grabbag.h
Normal file
29
src/FLAC/include/share/grabbag.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/* grabbag - Convenience lib for various routines common to several tools
|
||||||
|
* Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE__GRABBAG_H
|
||||||
|
#define SHARE__GRABBAG_H
|
||||||
|
|
||||||
|
/* These can't be included by themselves, only from within grabbag.h */
|
||||||
|
#include "grabbag/cuesheet.h"
|
||||||
|
#include "grabbag/file.h"
|
||||||
|
#include "grabbag/picture.h"
|
||||||
|
#include "grabbag/replaygain.h"
|
||||||
|
#include "grabbag/seektable.h"
|
||||||
|
|
||||||
|
#endif
|
10
src/FLAC/include/share/grabbag/Makefile.am
Normal file
10
src/FLAC/include/share/grabbag/Makefile.am
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
cuesheet.h \
|
||||||
|
file.h \
|
||||||
|
picture.h \
|
||||||
|
replaygain.h \
|
||||||
|
seektable.h
|
42
src/FLAC/include/share/grabbag/cuesheet.h
Normal file
42
src/FLAC/include/share/grabbag/cuesheet.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/* grabbag - Convenience lib for various routines common to several tools
|
||||||
|
* Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
|
||||||
|
|
||||||
|
#ifndef GRABBAG__CUESHEET_H
|
||||||
|
#define GRABBAG__CUESHEET_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "FLAC/metadata.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
unsigned grabbag__cuesheet_msf_to_frame(unsigned minutes, unsigned seconds, unsigned frames);
|
||||||
|
void grabbag__cuesheet_frame_to_msf(unsigned frame, unsigned *minutes, unsigned *seconds, unsigned *frames);
|
||||||
|
|
||||||
|
FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset);
|
||||||
|
|
||||||
|
void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
63
src/FLAC/include/share/grabbag/file.h
Normal file
63
src/FLAC/include/share/grabbag/file.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/* grabbag - Convenience lib for various routines common to several tools
|
||||||
|
* Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Convenience routines for manipulating files */
|
||||||
|
|
||||||
|
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
|
||||||
|
|
||||||
|
#ifndef GRABAG__FILE_H
|
||||||
|
#define GRABAG__FILE_H
|
||||||
|
|
||||||
|
/* needed because of off_t */
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/types.h> /* for off_t */
|
||||||
|
#include <stdio.h> /* for FILE */
|
||||||
|
#include "FLAC/ordinals.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void grabbag__file_copy_metadata(const char *srcpath, const char *destpath);
|
||||||
|
off_t grabbag__file_get_filesize(const char *srcpath);
|
||||||
|
const char *grabbag__file_get_basename(const char *srcpath);
|
||||||
|
|
||||||
|
/* read_only == false means "make file writable by user"
|
||||||
|
* read_only == true means "make file read-only for everyone"
|
||||||
|
*/
|
||||||
|
FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only);
|
||||||
|
|
||||||
|
/* returns true iff stat() succeeds for both files and they have the same device and inode. */
|
||||||
|
/* on windows, uses GetFileInformationByHandle() to compare */
|
||||||
|
FLAC__bool grabbag__file_are_same(const char *f1, const char *f2);
|
||||||
|
|
||||||
|
/* attempts to make writable before unlinking */
|
||||||
|
FLAC__bool grabbag__file_remove_file(const char *filename);
|
||||||
|
|
||||||
|
/* these will forcibly set stdin/stdout to binary mode (for OSes that require it) */
|
||||||
|
FILE *grabbag__file_get_binary_stdin(void);
|
||||||
|
FILE *grabbag__file_get_binary_stdout(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
46
src/FLAC/include/share/grabbag/picture.h
Normal file
46
src/FLAC/include/share/grabbag/picture.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/* grabbag - Convenience lib for various routines common to several tools
|
||||||
|
* Copyright (C) 2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
|
||||||
|
|
||||||
|
#ifndef GRABBAG__PICTURE_H
|
||||||
|
#define GRABBAG__PICTURE_H
|
||||||
|
|
||||||
|
#include "FLAC/metadata.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* spec should be of the form "[TYPE]|MIME_TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE", e.g.
|
||||||
|
* "|image/jpeg|||cover.jpg"
|
||||||
|
* "4|image/jpeg||300x300x24|backcover.jpg"
|
||||||
|
* "|image/png|description|300x300x24/71|cover.png"
|
||||||
|
* "-->|image/gif||300x300x24/71|http://blah.blah.blah/cover.gif"
|
||||||
|
*
|
||||||
|
* empty type means default to FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER
|
||||||
|
* empty resolution spec means to get from the file (cannot get used with "-->" linked images)
|
||||||
|
* spec and error_message must not be NULL
|
||||||
|
*/
|
||||||
|
FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
72
src/FLAC/include/share/grabbag/replaygain.h
Normal file
72
src/FLAC/include/share/grabbag/replaygain.h
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/* grabbag - Convenience lib for various routines common to several tools
|
||||||
|
* Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This wraps the replaygain_analysis lib, which is LGPL. This wrapper
|
||||||
|
* allows analysis of different input resolutions by automatically
|
||||||
|
* scaling the input signal
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
|
||||||
|
|
||||||
|
#ifndef GRABBAG__REPLAYGAIN_H
|
||||||
|
#define GRABBAG__REPLAYGAIN_H
|
||||||
|
|
||||||
|
#include "FLAC/metadata.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern const unsigned GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED;
|
||||||
|
|
||||||
|
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS; /* = "REPLAYGAIN_REFERENCE_LOUDNESS" */
|
||||||
|
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN; /* = "REPLAYGAIN_TRACK_GAIN" */
|
||||||
|
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK; /* = "REPLAYGAIN_TRACK_PEAK" */
|
||||||
|
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN; /* = "REPLAYGAIN_ALBUM_GAIN" */
|
||||||
|
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK; /* = "REPLAYGAIN_ALBUM_PEAK" */
|
||||||
|
|
||||||
|
FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency);
|
||||||
|
|
||||||
|
FLAC__bool grabbag__replaygain_init(unsigned sample_frequency);
|
||||||
|
|
||||||
|
/* 'bps' must be valid for FLAC, i.e. >=4 and <= 32 */
|
||||||
|
FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, unsigned bps, unsigned samples);
|
||||||
|
|
||||||
|
void grabbag__replaygain_get_album(float *gain, float *peak);
|
||||||
|
void grabbag__replaygain_get_title(float *gain, float *peak);
|
||||||
|
|
||||||
|
/* These three functions return an error string on error, or NULL if successful */
|
||||||
|
const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak);
|
||||||
|
const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak);
|
||||||
|
const char *grabbag__replaygain_store_to_vorbiscomment_reference(FLAC__StreamMetadata *block);
|
||||||
|
const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak);
|
||||||
|
const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak);
|
||||||
|
const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime);
|
||||||
|
const char *grabbag__replaygain_store_to_file_reference(const char *filename, FLAC__bool preserve_modtime);
|
||||||
|
const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime);
|
||||||
|
const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime);
|
||||||
|
|
||||||
|
FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, FLAC__bool strict, double *reference, double *gain, double *peak);
|
||||||
|
double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
38
src/FLAC/include/share/grabbag/seektable.h
Normal file
38
src/FLAC/include/share/grabbag/seektable.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/* grabbag - Convenience lib for various routines common to several tools
|
||||||
|
* Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Convenience routines for working with seek tables */
|
||||||
|
|
||||||
|
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
|
||||||
|
|
||||||
|
#ifndef GRABAG__SEEKTABLE_H
|
||||||
|
#define GRABAG__SEEKTABLE_H
|
||||||
|
|
||||||
|
#include "FLAC/format.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
59
src/FLAC/include/share/replaygain_analysis.h
Normal file
59
src/FLAC/include/share/replaygain_analysis.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* ReplayGainAnalysis - analyzes input samples and give the recommended dB change
|
||||||
|
* Copyright (C) 2001 David Robinson and Glen Sawyer
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* concept and filter values by David Robinson (David@Robinson.org)
|
||||||
|
* -- blame him if you think the idea is flawed
|
||||||
|
* coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
|
||||||
|
* -- blame him if you think this runs too slowly, or the coding is otherwise flawed
|
||||||
|
* minor cosmetic tweaks to integrate with FLAC by Josh Coalson
|
||||||
|
*
|
||||||
|
* For an explanation of the concepts and the basic algorithms involved, go to:
|
||||||
|
* http://www.replaygain.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GAIN_ANALYSIS_H
|
||||||
|
#define GAIN_ANALYSIS_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#define GAIN_NOT_ENOUGH_SAMPLES -24601
|
||||||
|
#define GAIN_ANALYSIS_ERROR 0
|
||||||
|
#define GAIN_ANALYSIS_OK 1
|
||||||
|
|
||||||
|
#define INIT_GAIN_ANALYSIS_ERROR 0
|
||||||
|
#define INIT_GAIN_ANALYSIS_OK 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef float Float_t; /* Type used for filtering */
|
||||||
|
|
||||||
|
extern Float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
|
||||||
|
|
||||||
|
int InitGainAnalysis ( long samplefreq );
|
||||||
|
int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
|
||||||
|
int ResetSampleFrequency ( long samplefreq );
|
||||||
|
Float_t GetTitleGain ( void );
|
||||||
|
Float_t GetAlbumGain ( void );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* GAIN_ANALYSIS_H */
|
51
src/FLAC/include/share/replaygain_synthesis.h
Normal file
51
src/FLAC/include/share/replaygain_synthesis.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/* replaygain_synthesis - Routines for applying ReplayGain to a signal
|
||||||
|
* Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
|
||||||
|
#define FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
|
||||||
|
|
||||||
|
#include <stdlib.h> /* for size_t */
|
||||||
|
#include "FLAC/ordinals.h"
|
||||||
|
|
||||||
|
#define FLAC_SHARE__MAX_SUPPORTED_CHANNELS 2
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
NOISE_SHAPING_NONE = 0,
|
||||||
|
NOISE_SHAPING_LOW = 1,
|
||||||
|
NOISE_SHAPING_MEDIUM = 2,
|
||||||
|
NOISE_SHAPING_HIGH = 3
|
||||||
|
} NoiseShaping;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const float* FilterCoeff;
|
||||||
|
FLAC__uint64 Mask;
|
||||||
|
double Add;
|
||||||
|
float Dither;
|
||||||
|
float ErrorHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */
|
||||||
|
float DitherHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16];
|
||||||
|
int LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS];
|
||||||
|
unsigned LastHistoryIndex;
|
||||||
|
NoiseShaping ShapingType;
|
||||||
|
} DitherContext;
|
||||||
|
|
||||||
|
void FLAC__replaygain_synthesis__init_dither_context(DitherContext *dither, int bits, int shapingtype);
|
||||||
|
|
||||||
|
/* scale = (float) pow(10., (double)replaygain * 0.05); */
|
||||||
|
size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context);
|
||||||
|
|
||||||
|
#endif
|
25
src/FLAC/include/share/utf8.h
Normal file
25
src/FLAC/include/share/utf8.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef SHARE__UTF8_H
|
||||||
|
#define SHARE__UTF8_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert a string between UTF-8 and the locale's charset.
|
||||||
|
* Invalid bytes are replaced by '#', and characters that are
|
||||||
|
* not available in the target encoding are replaced by '?'.
|
||||||
|
*
|
||||||
|
* If the locale's charset is not set explicitly then it is
|
||||||
|
* obtained using nl_langinfo(CODESET), where available, the
|
||||||
|
* environment variable CHARSET, or assumed to be US-ASCII.
|
||||||
|
*
|
||||||
|
* Return value of conversion functions:
|
||||||
|
*
|
||||||
|
* -1 : memory allocation failed
|
||||||
|
* 0 : data was converted exactly
|
||||||
|
* 1 : valid data was converted approximately (using '?')
|
||||||
|
* 2 : input was invalid (but still converted, using '#')
|
||||||
|
* 3 : unknown encoding (but still converted, using '?')
|
||||||
|
*/
|
||||||
|
|
||||||
|
int utf8_encode(const char *from, char **to);
|
||||||
|
int utf8_decode(const char *from, char **to);
|
||||||
|
|
||||||
|
#endif
|
7
src/FLAC/include/test_libs_common/Makefile.am
Normal file
7
src/FLAC/include/test_libs_common/Makefile.am
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
file_utils_flac.h \
|
||||||
|
metadata_utils.h
|
34
src/FLAC/include/test_libs_common/file_utils_flac.h
Normal file
34
src/FLAC/include/test_libs_common/file_utils_flac.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/* test_libFLAC - Unit tester for libFLAC
|
||||||
|
* Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FLAC__TEST_LIBFLAC_FILE_UTILS_H
|
||||||
|
#define FLAC__TEST_LIBFLAC_FILE_UTILS_H
|
||||||
|
|
||||||
|
/* needed because of off_t */
|
||||||
|
#if HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "FLAC/format.h"
|
||||||
|
#include <sys/types.h> /* for off_t */
|
||||||
|
|
||||||
|
extern const long file_utils__ogg_serial_number;
|
||||||
|
|
||||||
|
FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata);
|
||||||
|
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user