Remove seal
This commit is contained in:
parent
25cb419093
commit
4b8495d443
2
Makefile
2
Makefile
@ -1,7 +1,5 @@
|
||||
all:
|
||||
make -C seal-hack
|
||||
make -C oswan
|
||||
|
||||
clean:
|
||||
make -C seal-hack clean
|
||||
make -C oswan clean
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
Release 1.0.7 July 30th, 1999
|
||||
- Source code released under the GNU Lesser General Public License (LGPL)
|
||||
|
||||
Release 1.0.6 December 25th, 1998
|
||||
- New API functions ASetAudioMixerValue and AUpdateAudioEx
|
||||
- Minor fixes in ENSONIQ SoundScape and Windows Sound System drivers
|
||||
- Fixed DJGPP memory protection fault due to page swapping
|
||||
- Windows 95 and NT driver thread priority changed
|
||||
- Workaround to get sound on some SB compatible cards
|
||||
- Port to Intel BeOS R4 platforms
|
||||
- New experimental accelerated DirectSound driver
|
||||
|
||||
Release 1.0.5 October 18th, 1998
|
||||
- Fixed problems with ENSONIQ AudioPCI cards (Thanks Bomb!)
|
||||
- Port to OS/2 platforms (Thanks Marty!)
|
||||
- Port to Intel BeOS R3 platforms
|
||||
- HTML documentation
|
||||
|
||||
Release 1.0.4 April 12th, 1998
|
||||
- Memory leak in AFreeWaveFile() fixed
|
||||
- New API call to retrieve tracks' parameters
|
||||
|
||||
Release 1.0.3 January 9th, 1997
|
||||
- Windows Wave and DirectSound drivers bug fixes
|
||||
- Minor bug fix in XM module file loader
|
||||
- Silence driver now actually "play" modules
|
||||
|
||||
Release 1.0.1 September 25th, 1996
|
||||
- Support for DirectSound in Windows 95 and NT
|
||||
- Support for Sound Blaster AWE32 (EMU8000) sound cards
|
||||
- Support for Ultrasound PnP (InterWave) sound cards
|
||||
- Support for MultiTracker 1.0 module files
|
||||
- New synchronization callback feature
|
||||
- New file offset parameter in loading routines
|
||||
- Data type names changed for better portability
|
||||
- Fixed mono playback for non-wavetable sound cards
|
||||
- Volume was too quiet for 8-bit sound cards
|
||||
- Fixed WATCOM C/C++ 10.x naming convention bug
|
||||
- Fixed 4DOS-only batch files to work with COMMAND.COM
|
||||
- Many other minor bug fixes
|
||||
|
||||
Release 1.0.0 June 8th, 1996
|
||||
- First release
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
SEAL Audio Library Release 1.0.7
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
32-bit multichannel audio system
|
||||
for DOS, Windows 95, Windows NT,
|
||||
OS/2, BeOS and Linux platforms.
|
||||
Supports SB, SBPro, SB16, AWE32,
|
||||
PAS, PAS16, GUS, GUSDB, GUSMAX,
|
||||
IW, WSS, ESS and Aria cards.
|
||||
Plays MOD/MTM/S3M/XM modules.
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Full source code available!
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
@ -1,505 +0,0 @@
|
||||
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.
|
||||
|
||||
|
||||
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
|
||||
|
||||
Appendix: 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 an 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 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!
|
||||
@ -1,6 +0,0 @@
|
||||
all:
|
||||
cd src ; make
|
||||
|
||||
clean:
|
||||
-rm lib/SDL/*.a
|
||||
cd src ; make clean
|
||||
@ -1,39 +0,0 @@
|
||||
This is the OS/2 port of the Synthetic Audio Library (SEAL).
|
||||
|
||||
The DLL included can be used to add OS/2 native support for playing module
|
||||
files and streamed audio to OS/2 Presentation Manager (PM) and VIO
|
||||
applications. It can also be used to assist in the porting of other DOS,
|
||||
Windows, and Linux applications that also use the SEAL API.
|
||||
|
||||
To build applications with the SEAL library, simply link them with the
|
||||
AUDIO.LIB file and include the AUDIO.H file in your programs. The standard SEAL
|
||||
documentation covers the usage of the standard SEAL API. There are a few
|
||||
additional considerations in using the OS/2 version:
|
||||
|
||||
* The OS/2 version is multithreaded. This means that the SEAL library is
|
||||
updating the audio buffers in the background while the rest of your
|
||||
application is running. Unlike the DOS and Windows versions, you DO NOT
|
||||
HAVE TO call the AUpdateAudio function to update the audio buffers. This
|
||||
also means that some care needs to be taken when updating the voices
|
||||
and sound buffers yourself. It is recommended that you use DosEnterCritSec
|
||||
and DosExitCritSec around areas where voices are created and destroyed.
|
||||
|
||||
* Some of the SEAL API functions require other threads to be running when
|
||||
they are called. If you are in a critical section when you call some
|
||||
functions, it can cause deadlock because the critical section prevents
|
||||
other threads in the same task from running. Do not call the following
|
||||
functions in a critical section: AOpenAudio, ACloseAudio, AUpdateAudio.
|
||||
|
||||
* The AUpdateAudio function was implemented, but not to update the audio.
|
||||
It was made to be a means of synchronizing your application with the audio
|
||||
stream. When you call AUpdateAudio, the calling thread will block until
|
||||
an audio buffer needs more data. For a good example of how to use this
|
||||
function and the rest of the SEAL API, ask me for the source code for
|
||||
MAME for OS/2. E-mail me at mta3206@grace.isc.rit.edu.
|
||||
|
||||
|
||||
There are no known OS/2 specific bugs at this time.
|
||||
|
||||
Look for a DART-enabled version soon.
|
||||
|
||||
- Marty
|
||||
@ -1,224 +0,0 @@
|
||||
|
||||
Synthetic Audio Library (SEAL) Development Kit
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999 Carlos Hasan
|
||||
All Rights Reserved
|
||||
|
||||
OS/2 Sound Driver Copyright (C) 1998 Martin Amodeo
|
||||
|
||||
|
||||
This 1.0.7 release of the Synthetic Audio Library (SEAL) lets you write
|
||||
applications that conform to the 1.0 SEAL API which is able to play
|
||||
digital audio waveforms and music modules on many platforms.
|
||||
|
||||
|
||||
What's New
|
||||
----------
|
||||
|
||||
- Source code released under the GNU Lesser General Public License (LGPL)
|
||||
|
||||
Features
|
||||
--------
|
||||
- simple and powerful API interface
|
||||
- 32 simultaneous digital audio channels
|
||||
- smooth pitch shifting, volume and panning controllers per channel
|
||||
- smart digital filtering for improved sound quality
|
||||
- efficient digital audio waveform mixing algorithms combined with
|
||||
uncompromising low-level optimizations
|
||||
- importing of wave and music file formats such as Protracker 1.1,
|
||||
MultiTracker 1.0, Scream Tracker 3.0 and FastTracker 2.0 modules
|
||||
- performance tuned for the i486 and Pentium processors
|
||||
- native support in DOS for hardware wavetable accelerators such
|
||||
as the Sound Blaster AWE32, Gravis Forte's UltraSound, and normal
|
||||
digital audio devices such as the Sound Blaster 1.5/2.0/Pro/16,
|
||||
Pro Audio Spectrum 16, Windows Sound System, Ensoniq Soundscape
|
||||
and Aria soundcards
|
||||
|
||||
|
||||
Supported platforms
|
||||
-------------------
|
||||
The SEAL SDK is available for DOS, Extended DOS, Windows 95, Windows NT,
|
||||
OS/2, BeOS and Linux platforms. FreeBSD, SPARC SunOS, SPARC Solaris and
|
||||
SGI Indigo ports are in progress. The following compilers were used to
|
||||
build the library files:
|
||||
|
||||
- Borland C++ 4.5 compiler for DOS and Win32s
|
||||
- WATCOM C/C++ 10.0 compiler for DOS and Windows
|
||||
- Microsoft Visual C++ 4.1 compiler for Windows 95
|
||||
- DJGPP 2.0 port of GNU C/C++ compiler for DOS
|
||||
- GNU C/C++ 2.7.0 for Linux (a.out and ELF)
|
||||
- Metrowerks CodeWarrior C++ for Intel BeOS Release 3
|
||||
- EMX port of GNU CC 2.7.x for OS/2 platforms
|
||||
|
||||
|
||||
The SEAL SDK contains
|
||||
---------------------
|
||||
- SEAL API header and library files
|
||||
- SEAL audio library source code files (GPL license)
|
||||
- set of example source code files
|
||||
|
||||
|
||||
---------------------------------------------------------------------
|
||||
IMPORTANT: Please make sure you understand the Copyright and License
|
||||
information (in the file named LICENSE.TXT) before using this release.
|
||||
---------------------------------------------------------------------
|
||||
|
||||
|
||||
Installing the Software
|
||||
-----------------------
|
||||
The SEAL SDK can be installed unpacking the distribution archive
|
||||
in your hard disk. For example,
|
||||
|
||||
C:\>PKUNZIP -d SEAL107.ZIP
|
||||
|
||||
The SEAL SDK include and library directories can be installed in
|
||||
your C programming environment modifying the header and library
|
||||
directory paths. Here are some examples to compile and link
|
||||
the SEAL audio system library with your own programs:
|
||||
|
||||
- WATCOM C/C++32 10.0 and DOS4GW DOS Extender:
|
||||
wcl386 -I\audio\include example.c \audio\lib\dos\audiowcf.lib
|
||||
|
||||
- DJGPP 2.0 port of GNU CC for DOS/DPMI32:
|
||||
gcc -I\audio\include -o example example.c \audio\lib\dos\audiodjf.a
|
||||
|
||||
- Visual C/C++ 4.1 for Windows 95 and Windows NT:
|
||||
cl -DWIN32 -I\audio\include example.c \audio\lib\Win32\audw32vc.lib
|
||||
|
||||
- Borland C++ 4.5 for Win32s:
|
||||
bcc32a -WC -I\audio\include example.c \audio\lib\Win32\audw32bc.lib
|
||||
|
||||
- GNU CC 2.7.0 for Linux (ELF binaries):
|
||||
gcc -Iaudio/include -o example example.c audio/lib/Linux/libaudio.a
|
||||
|
||||
- Metrowerks CodeWarrior C++ for BeOS R3:
|
||||
mwcc -Iaudio/include -o example example.c audio/lib/BeOS/libaudio.a
|
||||
|
||||
The above examples assume that the audio system was installed at the
|
||||
root directory of the current drive. For Windows 95 and Windows NT
|
||||
applications you must copy the AUDIOW32.DLL dynamic-link library into
|
||||
the Windows system directory, usually located at C:\WINDOWS\SYSTEM in
|
||||
your hard disk.
|
||||
|
||||
|
||||
Notes about DOS Drivers
|
||||
-----------------------
|
||||
For applications running in DOS, the audio system will try to detect
|
||||
the hardware sound devices installed on your system. Since there can
|
||||
be problems to autodetect your sound hardware, your application should
|
||||
provide a way to force the use of a particular audio device driver.
|
||||
|
||||
Here is a list of notes for the autodetection methods used by the audio
|
||||
device drivers under the DOS operating system:
|
||||
|
||||
- Sound Blaster 1.0/1.5/2.0/Pro/16 device drivers:
|
||||
These drivers use the BLASTER environment variable to determine
|
||||
the hardware I/O base port address, IRQ interrupt line and DMA
|
||||
channels. The model of the card is then determined by hardware
|
||||
reading the DSP version number. If you do not get sound, try
|
||||
forcing other SB model by using the "T" parameter of the BLASTER
|
||||
environment variable:
|
||||
|
||||
T1 = Sound Blaster 1.0
|
||||
T2 = Sound Blaster 1.5
|
||||
T3 = Sound Blaster 2.0
|
||||
T4 = Sound Blaster Pro
|
||||
T6 = Sound Blaster 16
|
||||
|
||||
- Sound Blaster AWE32 and Sound Blaster 32 device drivers:
|
||||
The driver uses the BLASTER environment variable, you must
|
||||
specify the EMU8000 I/O base port address parameter. If your
|
||||
card does not have DRAM local sound memory, you must use the
|
||||
card as a Sound Blaster 16 or earlier.
|
||||
|
||||
- Pro Audio Spectrum, Pro Audio Spectrum Plus/16 device drivers:
|
||||
These drivers need to have the MVSOUND.SYS driver installed
|
||||
in your CONFIG.SYS configuration file. The model of the card
|
||||
is determined by hardware checking the card features bits.
|
||||
|
||||
- Gravis Ultrasound, Ultrasound MAX device drivers:
|
||||
This driver uses the ULTRASND environment variable to determine
|
||||
the hardware configuration of your card. For applications using
|
||||
the DOS4GW extender, the GF1-IRQ number must be less than 8 to
|
||||
work correctly.
|
||||
|
||||
- Gravis Ultrasound Daughterboard / MAX (CS4231) device drivers:
|
||||
This driver uses the CS4231 codec of your GUS DB/MAX card, so
|
||||
you must have the ULTRASND and ULTRA16 environment variables.
|
||||
|
||||
- Gravis Ultrasound PnP (Pro), InterWave-based device drivers:
|
||||
This driver uses the ULTRASND and INTERWAVE environment variables
|
||||
to determine the hardware configuration of your sound board.
|
||||
|
||||
- Windows Sound System device driver:
|
||||
This driver automatically detect WSS sound devices installed
|
||||
at the 530, E80, F40 or 604 I/O base port addresses and uses
|
||||
by default the IRQ line #7 and DMA channel #1 for playback.
|
||||
Since there can be hardware conflicts, the driver first check
|
||||
for the WSSCFG environment variable which has the following
|
||||
format:
|
||||
SET WSSCFG=Annn In Dn
|
||||
| | |
|
||||
| | +-- DMA channel (0,1,3)
|
||||
| +---- IRQ number (7,9,10,11)
|
||||
+----- I/O port (530,E80,F40,604)
|
||||
|
||||
You must write the above command in your AUTOEXEC.BAT start-up
|
||||
batch file. Also, some WSS clone devices need to run an utility
|
||||
to put the card in WSS mode (ie. MAD16 OPTi-based cards).
|
||||
|
||||
- Ensoniq Soundscape, Soundscape Elite device drivers:
|
||||
These drivers uses the SNDSCAPE environment variable to read
|
||||
the SNDSCAPE.INI configuration file.
|
||||
|
||||
- Sierra Semoconductors' Aria sound card driver:
|
||||
This driver uses the ARIA environment variable to read the
|
||||
hardware configuration parameters.
|
||||
|
||||
- Ensoniq AudioPCI and Creative PCI64 sound cards:
|
||||
These cards have to be configured in Legacy emulation mode
|
||||
under DOS. The library will use these cards as Ensoniq
|
||||
SoundScape ISA cards.
|
||||
|
||||
If you experience any problems, please try avoiding autodetection and
|
||||
tell your application what device driver to use. Also, ensure your
|
||||
system has no TSR's loaded in memory (such as SBOS for GUS cards).
|
||||
|
||||
|
||||
Notes about Windows 95
|
||||
----------------------
|
||||
The SEAL audio system for DOS and Extended DOS has been sucessfully
|
||||
tested under Windows 95 DOS boxes running in foreground. However,
|
||||
some Windows 95 sound drivers might not be able to share the sound
|
||||
hardware with DOS sessions (such as the Ultrasound drivers). In such
|
||||
cases, you must either remove the Windows 95 drivers or exit to DOS
|
||||
to run your DOS programs.
|
||||
|
||||
|
||||
Notes about Linux
|
||||
-----------------
|
||||
The SEAL audio system for Linux uses the UNIX Sound System interface,
|
||||
also known as the VoxWare Kit. The audio system can be easily ported
|
||||
to other UNIX operating system running in Intel x86 platforms where
|
||||
the UNIX Sound System interface is also available, such as FreeBSD,
|
||||
386bsd, SCO and SVR4.2 operating systems.
|
||||
|
||||
|
||||
Notes about BeOS
|
||||
----------------
|
||||
The SEAL audio library for Intel BeOS Release 3 also works with
|
||||
New MediaKit sound drivers found on BeOS R4. The SEAL 1.06 library
|
||||
comes with ELF binaries for Intel BeOS Release 4.
|
||||
|
||||
|
||||
Contacting the Author
|
||||
---------------------
|
||||
If you have questions, problems or comments you can contact the author
|
||||
at the following email address: chasan@dcc.uchile.cl.
|
||||
|
||||
|
||||
Closing Words
|
||||
-------------
|
||||
I would like to thank all the beta testers and specially to Jon L.
|
||||
for the music module file used by the example programs, and to all
|
||||
the IRC friends at the #coders channel.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,479 +0,0 @@
|
||||
/* check.c - misc. routines from the reference guide */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#ifndef linux
|
||||
#include <conio.h>
|
||||
#endif
|
||||
#include <audio.h>
|
||||
|
||||
|
||||
/* enable filtering */
|
||||
#define FILTER
|
||||
|
||||
|
||||
/* soy paranoico! */
|
||||
#define Assert(x) AssertFailed((x),#x,__LINE__,__FILE__)
|
||||
|
||||
void AssertFailed(UINT rc, LPSTR lpszExpr, int nLine, LPSTR lpszFileName)
|
||||
{
|
||||
CHAR szText[128];
|
||||
|
||||
if (rc != AUDIO_ERROR_NONE) {
|
||||
AGetErrorText(rc, szText, sizeof(szText) - 1);
|
||||
fprintf(stderr, "ASSERT(%s:%d): %s\nERROR: %s\n",
|
||||
lpszFileName, nLine, lpszExpr, szText);
|
||||
ACloseAudio();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* APingAudio, AGetAudioDevCaps */
|
||||
VOID DetectAudioDevice(VOID)
|
||||
{
|
||||
AUDIOCAPS caps;
|
||||
UINT nDeviceId;
|
||||
if (APingAudio(&nDeviceId) != AUDIO_ERROR_NONE)
|
||||
printf("no audio found\n");
|
||||
else {
|
||||
AGetAudioDevCaps(nDeviceId, &caps);
|
||||
printf("%s device found\n", caps.szProductName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* AGetAudioDevCaps, AGetAudioNumDevs */
|
||||
VOID PrintAudioDevs(VOID)
|
||||
{
|
||||
AUDIOCAPS caps;
|
||||
UINT nDeviceId;
|
||||
for (nDeviceId = 0; nDeviceId < AGetAudioNumDevs(); nDeviceId++) {
|
||||
Assert(AGetAudioDevCaps(nDeviceId, &caps));
|
||||
printf("nDeviceId=%d wProductId=%d szProductName=%s\n",
|
||||
nDeviceId, caps.wProductId, caps.szProductName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* AOpenAudio, AGetErrorText */
|
||||
VOID InitializeAudio(VOID)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
CHAR szText[128];
|
||||
UINT rc;
|
||||
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
#ifdef FILTER
|
||||
info.wFormat |= AUDIO_FORMAT_FILTER;
|
||||
#endif
|
||||
info.nSampleRate = 44100;
|
||||
if ((rc = AOpenAudio(&info)) != AUDIO_ERROR_NONE) {
|
||||
AGetErrorText(rc, szText, sizeof(szText) - 1);
|
||||
printf("ERROR: %s\n", szText);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
printf("Audio device initialized at %d bits %s %u Hz\n",
|
||||
info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8,
|
||||
info.wFormat & AUDIO_FORMAT_STEREO ?
|
||||
"stereo" : "mono", info.nSampleRate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ASetAudioTimerProc, ASetAudioTimerRate */
|
||||
volatile UINT nTickCounter = 0;
|
||||
|
||||
VOID AIAPI TimerHandler(VOID)
|
||||
{
|
||||
nTickCounter++;
|
||||
}
|
||||
|
||||
VOID InitTimerHandler(VOID)
|
||||
{
|
||||
Assert(ASetAudioTimerProc(TimerHandler));
|
||||
Assert(ASetAudioTimerRate(125));
|
||||
}
|
||||
|
||||
VOID DoneTimerHandler(VOID)
|
||||
{
|
||||
Assert(ASetAudioTimerProc(NULL));
|
||||
}
|
||||
|
||||
VOID TestTimerServices(VOID)
|
||||
{
|
||||
InitTimerHandler();
|
||||
do {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
fprintf(stderr, "Elapsed: %2.2f secs\r", nTickCounter / 50.0F);
|
||||
} while (nTickCounter < 2*50);
|
||||
DoneTimerHandler();
|
||||
}
|
||||
|
||||
|
||||
/* ACreateAudioVoice, ADestroyAudioVoice, APlayVoice, ASetVoiceXXX */
|
||||
VOID PlayWaveform(LPAUDIOWAVE lpWave)
|
||||
{
|
||||
HAC hVoice;
|
||||
BOOL stopped;
|
||||
Assert(ACreateAudioVoice(&hVoice));
|
||||
Assert(APlayVoice(hVoice, lpWave));
|
||||
Assert(ASetVoiceVolume(hVoice, 64));
|
||||
Assert(ASetVoicePanning(hVoice, 128));
|
||||
printf("press any key to stop\n");
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
Assert(AGetVoiceStatus(hVoice, &stopped));
|
||||
if (stopped) break;
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
Assert(AStopVoice(hVoice));
|
||||
Assert(ADestroyAudioVoice(hVoice));
|
||||
}
|
||||
|
||||
VOID TestPlayWaveform(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
Assert(ALoadWaveFile("test.wav", &lpWave, 0));
|
||||
lpWave->wFormat |= AUDIO_FORMAT_LOOP;
|
||||
lpWave->dwLoopStart = 0;
|
||||
lpWave->dwLoopEnd = lpWave->dwLength;
|
||||
Assert(AOpenVoices(1));
|
||||
PlayWaveform(lpWave);
|
||||
Assert(ACloseVoices());
|
||||
Assert(AFreeWaveFile(lpWave));
|
||||
}
|
||||
|
||||
|
||||
/* APrimeVoice, AStartVoice, ASetVoiceXXX */
|
||||
VOID PlayChord(HAC aVoices[3], LPAUDIOWAVE lpWave, LONG aFreqs[3])
|
||||
{
|
||||
UINT n;
|
||||
for (n = 0; n < 3; n++) {
|
||||
Assert(APrimeVoice(aVoices[n], lpWave));
|
||||
Assert(ASetVoiceFrequency(aVoices[n], aFreqs[n]));
|
||||
Assert(ASetVoiceVolume(aVoices[n], 64));
|
||||
}
|
||||
for (n = 0; n < 3; n++) {
|
||||
Assert(AStartVoice(aVoices[n]));
|
||||
}
|
||||
}
|
||||
|
||||
VOID TestPlayChord(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC aVoices[3];
|
||||
LONG aFreqs[3] = { (8*6000)/8, (8*6000)/6, (8*6000)/5 };
|
||||
UINT n;
|
||||
Assert(ALoadWaveFile("test.wav", &lpWave, 0));
|
||||
Assert(AOpenVoices(3));
|
||||
for (n = 0; n < 3; n++)
|
||||
Assert(ACreateAudioVoice(&aVoices[n]));
|
||||
printf("press any key to stop\n");
|
||||
InitTimerHandler();
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
/* play chord two times per second */
|
||||
if (nTickCounter >= 25) {
|
||||
PlayChord(aVoices, lpWave, aFreqs);
|
||||
nTickCounter -= 25;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
DoneTimerHandler();
|
||||
for (n = 0; n < 3; n++) {
|
||||
Assert(AStopVoice(aVoices[n]));
|
||||
Assert(ADestroyAudioVoice(aVoices[n]));
|
||||
}
|
||||
Assert(ACloseVoices());
|
||||
Assert(AFreeWaveFile(lpWave));
|
||||
}
|
||||
|
||||
|
||||
/* ASetVoicePosition, AGetVoicePosition */
|
||||
VOID PlayEchoVoices(HAC aVoices[2], LPAUDIOWAVE lpWave, LONG dwDelay)
|
||||
{
|
||||
Assert(APrimeVoice(aVoices[0], lpWave));
|
||||
Assert(APrimeVoice(aVoices[1], lpWave));
|
||||
Assert(ASetVoiceFrequency(aVoices[0], lpWave->nSampleRate / 2));
|
||||
Assert(ASetVoiceFrequency(aVoices[1], lpWave->nSampleRate / 2));
|
||||
Assert(ASetVoiceVolume(aVoices[0], 64));
|
||||
Assert(ASetVoiceVolume(aVoices[1], 48));
|
||||
Assert(ASetVoicePosition(aVoices[1], dwDelay));
|
||||
Assert(AStartVoice(aVoices[0]));
|
||||
Assert(AStartVoice(aVoices[1]));
|
||||
}
|
||||
|
||||
VOID TestPlayEcho(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC aVoices[2];
|
||||
UINT n;
|
||||
Assert(ALoadWaveFile("test.wav", &lpWave, 0));
|
||||
Assert(AOpenVoices(2));
|
||||
for (n = 0; n < 2; n++)
|
||||
Assert(ACreateAudioVoice(&aVoices[n]));
|
||||
printf("press any key to stop\n");
|
||||
InitTimerHandler();
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
/* play voices two times per second */
|
||||
if (nTickCounter >= 25) {
|
||||
PlayEchoVoices(aVoices, lpWave, 800);
|
||||
nTickCounter -= 25;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
DoneTimerHandler();
|
||||
for (n = 0; n < 2; n++) {
|
||||
Assert(AStopVoice(aVoices[n]));
|
||||
Assert(ADestroyAudioVoice(aVoices[n]));
|
||||
}
|
||||
Assert(ACloseVoices());
|
||||
Assert(AFreeWaveFile(lpWave));
|
||||
}
|
||||
|
||||
|
||||
/* ASetVoiceFrequency */
|
||||
VOID PlayVoiceStereo(HAC aVoices[2], LPAUDIOWAVE lpWave, LONG dwPitchShift)
|
||||
{
|
||||
Assert(APrimeVoice(aVoices[0], lpWave));
|
||||
Assert(APrimeVoice(aVoices[1], lpWave));
|
||||
Assert(ASetVoiceVolume(aVoices[0], 64));
|
||||
Assert(ASetVoiceVolume(aVoices[1], 64));
|
||||
Assert(ASetVoiceFrequency(aVoices[0], lpWave->nSampleRate));
|
||||
Assert(ASetVoiceFrequency(aVoices[1], lpWave->nSampleRate + dwPitchShift));
|
||||
Assert(ASetVoicePanning(aVoices[0], 0));
|
||||
Assert(ASetVoicePanning(aVoices[1], 255));
|
||||
Assert(AStartVoice(aVoices[0]));
|
||||
Assert(AStartVoice(aVoices[1]));
|
||||
}
|
||||
|
||||
VOID TestPlayStereoEnh(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC aVoices[2];
|
||||
UINT n;
|
||||
Assert(ALoadWaveFile("test.wav", &lpWave, 0));
|
||||
Assert(AOpenVoices(2));
|
||||
for (n = 0; n < 2; n++)
|
||||
Assert(ACreateAudioVoice(&aVoices[n]));
|
||||
printf("press any key to stop\n");
|
||||
InitTimerHandler();
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
/* play voices two times per second */
|
||||
if (nTickCounter >= 25) {
|
||||
PlayVoiceStereo(aVoices, lpWave, 100);
|
||||
nTickCounter -= 25;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
DoneTimerHandler();
|
||||
for (n = 0; n < 2; n++) {
|
||||
Assert(AStopVoice(aVoices[n]));
|
||||
Assert(ADestroyAudioVoice(aVoices[n]));
|
||||
}
|
||||
Assert(ACloseVoices());
|
||||
Assert(AFreeWaveFile(lpWave));
|
||||
}
|
||||
|
||||
|
||||
/* ACreateAudioData, AWriteAudioData */
|
||||
LPAUDIOWAVE CreateAudio8BitMono(WORD nSampleRate,
|
||||
LPBYTE lpData, DWORD dwLength)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
if ((lpWave = (LPAUDIOWAVE) malloc(sizeof(AUDIOWAVE))) != NULL) {
|
||||
lpWave->wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO;
|
||||
lpWave->nSampleRate = nSampleRate;
|
||||
lpWave->dwLength = dwLength;
|
||||
lpWave->dwLoopStart = lpWave->dwLoopEnd = 0L;
|
||||
Assert(ACreateAudioData(lpWave));
|
||||
memcpy(lpWave->lpData, lpData, dwLength);
|
||||
Assert(AWriteAudioData(lpWave, 0L, dwLength));
|
||||
}
|
||||
return lpWave;
|
||||
}
|
||||
|
||||
VOID TestCreateAudioData(VOID)
|
||||
{
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC hVoice;
|
||||
static BYTE aData[4000];
|
||||
UINT n;
|
||||
|
||||
/* create 500 Hz sinewave (sampled at 4 kHz) */
|
||||
for (n = 0; n < sizeof(aData); n++)
|
||||
aData[n] = (BYTE)(127.0 * sin((500.0 * 3.141592653 * n) / sizeof(aData)));
|
||||
|
||||
lpWave = CreateAudio8BitMono(4000, aData, sizeof(aData));
|
||||
if (lpWave == NULL) {
|
||||
printf("not enough memory\n");
|
||||
return;
|
||||
}
|
||||
Assert(AOpenVoices(1));
|
||||
Assert(ACreateAudioVoice(&hVoice));
|
||||
printf("press any key to stop\n");
|
||||
InitTimerHandler();
|
||||
while (!kbhit()) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
/* play voices two times per second */
|
||||
if (nTickCounter >= 25) {
|
||||
Assert(APlayVoice(hVoice, lpWave));
|
||||
Assert(ASetVoiceVolume(hVoice, 64));
|
||||
nTickCounter -= 25;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
DoneTimerHandler();
|
||||
Assert(AStopVoice(hVoice));
|
||||
Assert(ADestroyAudioVoice(hVoice));
|
||||
Assert(ACloseVoices());
|
||||
Assert(ADestroyAudioData(lpWave));
|
||||
free(lpWave);
|
||||
}
|
||||
|
||||
|
||||
/* ACreateAudioData, AWriteAudioData */
|
||||
VOID StreamData8BitMono(FILE *stream, HAC hVoice, LPAUDIOWAVE lpWave)
|
||||
{
|
||||
static BYTE aBuffer[1024];
|
||||
LPBYTE lpChunk;
|
||||
UINT nLength, nChunkSize;
|
||||
DWORD dwOffset;
|
||||
static LONG dwVoicePosition;
|
||||
|
||||
if (2*sizeof(aBuffer) > lpWave->dwLength) {
|
||||
printf("the waveform is too small\n");
|
||||
return;
|
||||
}
|
||||
memset(lpWave->lpData, 0x80, lpWave->dwLength);
|
||||
Assert(AWriteAudioData(lpWave, 0L, lpWave->dwLength));
|
||||
lpWave->wFormat |= AUDIO_FORMAT_LOOP;
|
||||
lpWave->dwLoopStart = 0L;
|
||||
lpWave->dwLoopEnd = lpWave->dwLength;
|
||||
Assert(APlayVoice(hVoice, lpWave));
|
||||
Assert(ASetVoiceVolume(hVoice, 64));
|
||||
dwOffset = 0L;
|
||||
while ((nLength = fread(aBuffer, 1, sizeof(aBuffer), stream)) != 0) {
|
||||
if (kbhit()) break;
|
||||
|
||||
#ifndef SIGNED
|
||||
{
|
||||
UINT n;
|
||||
for (n = 0; n < nLength; n++)
|
||||
aBuffer[n] ^= 0x80;
|
||||
}
|
||||
#endif
|
||||
|
||||
lpChunk = aBuffer;
|
||||
while (nLength > 0) {
|
||||
nChunkSize = nLength;
|
||||
if (dwOffset + nChunkSize > lpWave->dwLength)
|
||||
nChunkSize = lpWave->dwLength - dwOffset;
|
||||
for (;;) {
|
||||
#ifndef WIN32
|
||||
Assert(AUpdateAudio());
|
||||
#endif
|
||||
Assert(AGetVoicePosition(hVoice, &dwVoicePosition));
|
||||
if (dwOffset + nChunkSize > lpWave->dwLength) {
|
||||
if (dwVoicePosition < dwOffset &&
|
||||
dwVoicePosition > dwOffset +
|
||||
nChunkSize - lpWave->dwLength)
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (dwVoicePosition < dwOffset ||
|
||||
dwVoicePosition > dwOffset + nChunkSize)
|
||||
break;
|
||||
}
|
||||
}
|
||||
memcpy(lpWave->lpData + dwOffset, lpChunk, nChunkSize);
|
||||
Assert(AWriteAudioData(lpWave, dwOffset, nChunkSize));
|
||||
if ((dwOffset += nChunkSize) >= lpWave->dwLength)
|
||||
dwOffset = 0L;
|
||||
lpChunk += nChunkSize;
|
||||
nLength -= nChunkSize;
|
||||
}
|
||||
}
|
||||
if (kbhit()) getch();
|
||||
}
|
||||
|
||||
VOID TestAudioStream(VOID)
|
||||
{
|
||||
FILE *stream;
|
||||
HAC hVoice;
|
||||
AUDIOWAVE Wave;
|
||||
|
||||
/* open .wav file and skip header structure */
|
||||
if ((stream = fopen("8mono.wav", "rb")) == NULL) {
|
||||
printf("cant open raw 8-bit mono file\n");
|
||||
return;
|
||||
}
|
||||
fseek(stream, 48L, SEEK_SET);
|
||||
|
||||
/* start playing the "data" chunk of the .wav file */
|
||||
Assert(AOpenVoices(1));
|
||||
Assert(ACreateAudioVoice(&hVoice));
|
||||
Wave.wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO;
|
||||
Wave.nSampleRate = 11025;
|
||||
Wave.dwLength = Wave.dwLoopEnd = 10000;
|
||||
Wave.dwLoopStart = 0;
|
||||
Assert(ACreateAudioData(&Wave));
|
||||
printf("press any key to stop\n");
|
||||
StreamData8BitMono(stream, hVoice, &Wave);
|
||||
Assert(AStopVoice(hVoice));
|
||||
Assert(ADestroyAudioVoice(hVoice));
|
||||
Assert(ACloseVoices());
|
||||
Assert(ADestroyAudioData(&Wave));
|
||||
fclose(stream);
|
||||
}
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifndef WIN32
|
||||
AInitialize();
|
||||
#endif
|
||||
|
||||
printf("------------ DetectAudioDevice() ------------\n");
|
||||
DetectAudioDevice();
|
||||
printf("------------ PrintAudioDevs() ---------------\n");
|
||||
PrintAudioDevs();
|
||||
printf("------------ InitializeAudio() --------------\n");
|
||||
InitializeAudio();
|
||||
printf("------------ TestTimerServices() ------------\n");
|
||||
TestTimerServices();
|
||||
printf("------------ TestPlayWaveform() -------------\n");
|
||||
TestPlayWaveform();
|
||||
printf("------------ TestPlayChord() ----------------\n");
|
||||
TestPlayChord();
|
||||
printf("------------ TestPlayEcho() -----------------\n");
|
||||
TestPlayEcho();
|
||||
printf("------------ TestPlayStereoEnh() ------------\n");
|
||||
TestPlayStereoEnh();
|
||||
printf("------------ TestCreateAudioData() ----------\n");
|
||||
TestCreateAudioData();
|
||||
printf("------------ TestAudioStream() --------------\n");
|
||||
TestAudioStream();
|
||||
printf("------------ ACloseAudio() ------------------\n");
|
||||
Assert(ACloseAudio());
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
program Demo;
|
||||
uses
|
||||
SysUtils, Audio;
|
||||
|
||||
var
|
||||
Caps: TAudioCaps;
|
||||
Info: TAudioInfo;
|
||||
pModule: PAudioModule;
|
||||
szFileName : Array [0..127] of Char;
|
||||
bStatus: Integer;
|
||||
begin
|
||||
if ParamCount <> 1 then
|
||||
begin
|
||||
Writeln('use: demo filename[.mod|.s3m|.xm]');
|
||||
Halt(0);
|
||||
end;
|
||||
Info.nDeviceId := AUDIO_DEVICE_MAPPER;
|
||||
Info.wFormat := AUDIO_FORMAT_16BITS or AUDIO_FORMAT_STEREO or AUDIO_FORMAT_FILTER;
|
||||
Info.nSampleRate := 44100;
|
||||
if AOpenAudio(Info) <> 0 then
|
||||
begin
|
||||
Writeln('Audio initialization failed');
|
||||
Halt(1);
|
||||
end;
|
||||
AGetAudioDevCaps(Info.nDeviceId, Caps);
|
||||
Write(Caps.szProductName,' playing at ');
|
||||
if Info.wFormat and AUDIO_FORMAT_16BITS <> 0 then
|
||||
Write('16-bit ') else Write('8-bit ');
|
||||
if Info.wFormat and AUDIO_FORMAT_STEREO <> 0 then
|
||||
Write('stereo ') else Write('mono ');
|
||||
Writeln(Info.nSampleRate,' Hz');
|
||||
if ALoadModuleFile(StrPCopy(szFileName, ParamStr(1)), pModule, 0) <> 0 then
|
||||
begin
|
||||
Writeln('Cant load module file');
|
||||
ACloseAudio;
|
||||
Halt(1);
|
||||
end;
|
||||
AOpenVoices(pModule^.nTracks);
|
||||
APlayModule(pModule);
|
||||
while (AGetModuleStatus(bStatus) = 0) do
|
||||
begin
|
||||
if bStatus <> 0 then break;
|
||||
AUpdateAudio;
|
||||
end;
|
||||
AStopModule;
|
||||
ACloseVoices;
|
||||
AFreeModuleFile(pModule);
|
||||
ACloseAudio;
|
||||
end.
|
||||
Binary file not shown.
@ -1,67 +0,0 @@
|
||||
/* example1.c - initialize and print device information */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
AUDIOCAPS caps;
|
||||
UINT rc, nDevId;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* show registered device drivers */
|
||||
printf("List of registered devices:\n");
|
||||
for (nDevId = 0; nDevId < AGetAudioNumDevs(); nDevId++) {
|
||||
AGetAudioDevCaps(nDevId, &caps);
|
||||
printf(" %2d. %s\n", nDevId, caps.szProductName);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* NOTE: Here we can use any of the above devices, or we can
|
||||
* use the virtual device AUDIO_DEVICE_MAPPER for detection.
|
||||
*/
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
if ((rc = AOpenAudio(&info)) != AUDIO_ERROR_NONE) {
|
||||
CHAR szText[80];
|
||||
AGetErrorText(rc, szText, sizeof(szText) - 1);
|
||||
printf("ERROR: %s\n", szText);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: Since the audio device may not support the playback
|
||||
* format and sampling frequency, the audio system uses the
|
||||
* closest configuration which is then returned to the user
|
||||
* in the AUDIOINFO structure.
|
||||
*
|
||||
*/
|
||||
|
||||
/* print information */
|
||||
AGetAudioDevCaps(info.nDeviceId, &caps);
|
||||
printf("%s at %d-bit %s %u Hz detected\n",
|
||||
caps.szProductName,
|
||||
info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8,
|
||||
info.wFormat & AUDIO_FORMAT_STEREO ? "stereo" : "mono",
|
||||
info.nSampleRate);
|
||||
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example1</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
@ -1,70 +0,0 @@
|
||||
/* example2.c - play a module file */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
LPAUDIOMODULE lpModule;
|
||||
int ret;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = 2;// AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
|
||||
#ifdef USEFILTER
|
||||
/* enable antialias dynamic filtering */
|
||||
info.wFormat |= AUDIO_FORMAT_FILTER;
|
||||
#endif
|
||||
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* load module file */
|
||||
ret = ALoadModuleFile("test.s3m", &lpModule, 0);
|
||||
if (lpModule == NULL)
|
||||
{
|
||||
printf("Error loding file... [%d]\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* open voices and play module */
|
||||
AOpenVoices(lpModule->nTracks);
|
||||
APlayModule(lpModule);
|
||||
|
||||
/* program main execution loop */
|
||||
printf("Playing module file, press any key to stop.\n");
|
||||
while (!kbhit()) {
|
||||
BOOL stopped;
|
||||
|
||||
/* check if the module is stopped */
|
||||
AGetModuleStatus(&stopped);
|
||||
if (stopped) break;
|
||||
|
||||
/* update audio system */
|
||||
AUpdateAudio();
|
||||
}
|
||||
|
||||
/* stop module and close voices */
|
||||
AStopModule();
|
||||
ACloseVoices();
|
||||
|
||||
/* release module file */
|
||||
AFreeModuleFile(lpModule);
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example2</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
@ -1,87 +0,0 @@
|
||||
/* example3.c - play a waveform file */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
#define NUMVOICES 3*3
|
||||
|
||||
#define FREQ(nPeriod) (((LONG) lpWave->nSampleRate * 428) / nPeriod)
|
||||
|
||||
UINT aPeriodTable[48] =
|
||||
{ /* C C# D D# E F F# G G# A A# B */
|
||||
856,808,762,720,678,640,604,570,538,508,480,453,
|
||||
428,404,381,360,339,320,302,285,269,254,240,226,
|
||||
214,202,190,180,170,160,151,143,135,127,120,113,
|
||||
107,101,95,90,85,80,75,71,67,63,60,56
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC hVoice[NUMVOICES];
|
||||
BOOL stopped;
|
||||
UINT n, m;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* load waveform file */
|
||||
ALoadWaveFile("test.wav", &lpWave, 0);
|
||||
|
||||
/* open and allocate voices */
|
||||
AOpenVoices(NUMVOICES);
|
||||
for (n = 0; n < NUMVOICES; n++) {
|
||||
ACreateAudioVoice(&hVoice[n]);
|
||||
ASetVoiceVolume(hVoice[n], 64);
|
||||
ASetVoicePanning(hVoice[n], n & 1 ? 0 : 255);
|
||||
}
|
||||
|
||||
/* program main execution loop */
|
||||
printf("Playing waveform, press any key to stop.\n");
|
||||
for (n = m = 0; !kbhit() && n < 48 - 7; n++) {
|
||||
/* play chord C-E-G */
|
||||
APlayVoice(hVoice[m+0], lpWave);
|
||||
APlayVoice(hVoice[m+1], lpWave);
|
||||
APlayVoice(hVoice[m+2], lpWave);
|
||||
ASetVoiceFrequency(hVoice[m+0], FREQ(aPeriodTable[n+0]));
|
||||
ASetVoiceFrequency(hVoice[m+1], FREQ(aPeriodTable[n+4]));
|
||||
ASetVoiceFrequency(hVoice[m+2], FREQ(aPeriodTable[n+7]));
|
||||
m = (m + 3) % NUMVOICES;
|
||||
|
||||
/* wait until note finishes */
|
||||
do {
|
||||
/* update audio system */
|
||||
AUpdateAudio();
|
||||
AGetVoiceStatus(hVoice[0], &stopped);
|
||||
} while (!stopped);
|
||||
}
|
||||
|
||||
/* stop and release voices */
|
||||
for (n = 0; n < NUMVOICES; n++) {
|
||||
AStopVoice(hVoice[n]);
|
||||
ADestroyAudioVoice(hVoice[n]);
|
||||
}
|
||||
ACloseVoices();
|
||||
|
||||
/* release the waveform file */
|
||||
AFreeWaveFile(lpWave);
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example3</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
@ -1,78 +0,0 @@
|
||||
/* example4.c - play module and waveform file */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
LPAUDIOMODULE lpModule;
|
||||
LPAUDIOWAVE lpWave;
|
||||
HAC hVoice;
|
||||
BOOL stopped;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = 1;//AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* load module and waveform file */
|
||||
ALoadModuleFile("test.s3m", &lpModule, 0);
|
||||
ALoadWaveFile("test.wav", &lpWave, 0);
|
||||
|
||||
/* open voices for module and waveform */
|
||||
AOpenVoices(lpModule->nTracks + 1);
|
||||
|
||||
/* play the module file */
|
||||
APlayModule(lpModule);
|
||||
ASetModuleVolume(64);
|
||||
|
||||
/* play the waveform through a voice */
|
||||
ACreateAudioVoice(&hVoice);
|
||||
APlayVoice(hVoice, lpWave);
|
||||
ASetVoiceVolume(hVoice, 48);
|
||||
ASetVoicePanning(hVoice, 128);
|
||||
|
||||
/* program main execution loop */
|
||||
printf("Playing module and waveform, press any key to stop.\n");
|
||||
while (!kbhit()) {
|
||||
/* update audio system */
|
||||
AUpdateAudio();
|
||||
|
||||
/* restart waveform if stopped */
|
||||
AGetVoiceStatus(hVoice, &stopped);
|
||||
if (stopped) APlayVoice(hVoice, lpWave);
|
||||
|
||||
/* check if the module is stopped */
|
||||
AGetModuleStatus(&stopped);
|
||||
if (stopped) break;
|
||||
}
|
||||
|
||||
/* stop playing the waveform */
|
||||
AStopVoice(hVoice);
|
||||
ADestroyAudioVoice(hVoice);
|
||||
|
||||
/* stop playing the module */
|
||||
AStopModule();
|
||||
ACloseVoices();
|
||||
|
||||
/* release the waveform & module */
|
||||
AFreeWaveFile(lpWave);
|
||||
AFreeModuleFile(lpModule);
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example4</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
@ -1,120 +0,0 @@
|
||||
/* example5.c - update the system using the timer interrupt, please compile
|
||||
* using WATCOM C/C++32 and assume that the stack segment is
|
||||
* not pegged to the DGROUP segment:
|
||||
*
|
||||
* wcl386 -l=dos4g -zu -s -I..\include example5.c ..\lib\dos\audiowcf.lib
|
||||
*/
|
||||
|
||||
#ifndef __WATCOMC__
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("This example only works with WATCOM C/C++32 and DOS4GW\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <audio.h>
|
||||
#include <conio.h>
|
||||
#include <dos.h>
|
||||
|
||||
/* call the timer handler 70 times per second */
|
||||
#define TIMER_RATE (1193180/70)
|
||||
|
||||
volatile void (interrupt far *lpfnBIOSTimerHandler)(void) = NULL;
|
||||
volatile long dwTimerAccum = 0L;
|
||||
|
||||
void SetBorderColor(BYTE nColor)
|
||||
{
|
||||
outp(0x3c0, 0x31);
|
||||
outp(0x3c0, nColor);
|
||||
}
|
||||
|
||||
void interrupt far TimerHandler(void)
|
||||
{
|
||||
SetBorderColor(1);
|
||||
AUpdateAudio();
|
||||
SetBorderColor(0);
|
||||
if ((dwTimerAccum += TIMER_RATE) >= 0x10000L) {
|
||||
dwTimerAccum -= 0x10000L;
|
||||
lpfnBIOSTimerHandler();
|
||||
}
|
||||
else {
|
||||
outp(0x20, 0x20);
|
||||
}
|
||||
}
|
||||
|
||||
VOID InitTimerHandler(VOID)
|
||||
{
|
||||
lpfnBIOSTimerHandler = _dos_getvect(0x08);
|
||||
_dos_setvect(0x08, TimerHandler);
|
||||
outp(0x43, 0x34);
|
||||
outp(0x40, LOBYTE(TIMER_RATE));
|
||||
outp(0x40, HIBYTE(TIMER_RATE));
|
||||
}
|
||||
|
||||
VOID DoneTimerHandler(VOID)
|
||||
{
|
||||
outp(0x43, 0x34);
|
||||
outp(0x40, 0x00);
|
||||
outp(0x40, 0x00);
|
||||
_dos_setvect(0x08, lpfnBIOSTimerHandler);
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
static AUDIOINFO info;
|
||||
static AUDIOCAPS caps;
|
||||
static LPAUDIOMODULE lpModule;
|
||||
|
||||
/* initialize audio library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* show device information */
|
||||
AGetAudioDevCaps(info.nDeviceId, &caps);
|
||||
printf("%s detected. Please type EXIT to return.\n", caps.szProductName);
|
||||
|
||||
/* load module file */
|
||||
ALoadModuleFile("test.s3m", &lpModule, 0);
|
||||
|
||||
/* open voices for module */
|
||||
AOpenVoices(lpModule->nTracks);
|
||||
|
||||
/* play the module file */
|
||||
APlayModule(lpModule);
|
||||
|
||||
/* initialize the timer routines */
|
||||
InitTimerHandler();
|
||||
|
||||
/* invoke the DOS command processor */
|
||||
system(getenv("COMSPEC"));
|
||||
|
||||
/* terminate the timer routines */
|
||||
DoneTimerHandler();
|
||||
|
||||
/* stop playing the module */
|
||||
AStopModule();
|
||||
ACloseVoices();
|
||||
|
||||
/* release the waveform & module */
|
||||
AFreeModuleFile(lpModule);
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example5</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
@ -1,100 +0,0 @@
|
||||
/* example6.c - play a streamed sample (sine wave) using triple buffering */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <audio.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__)
|
||||
#include <conio.h>
|
||||
#else
|
||||
#define kbhit() 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
AUDIOINFO info;
|
||||
AUDIOCAPS caps;
|
||||
AUDIOWAVE wave;
|
||||
HAC voice;
|
||||
int i;
|
||||
float t, dt;
|
||||
long position, chunkSize, chunkPosition;
|
||||
|
||||
/* initialize library */
|
||||
AInitialize();
|
||||
|
||||
/* open audio device */
|
||||
info.nDeviceId = AUDIO_DEVICE_MAPPER;
|
||||
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
info.nSampleRate = 44100;
|
||||
AOpenAudio(&info);
|
||||
|
||||
/* show device name */
|
||||
AGetAudioDevCaps(info.nDeviceId, &caps);
|
||||
printf("%s detected. Press any key to exit.\n", caps.szProductName);
|
||||
|
||||
/* open audio voice */
|
||||
AOpenVoices(1);
|
||||
ACreateAudioVoice(&voice);
|
||||
ASetVoiceVolume(voice, 64);
|
||||
ASetVoicePanning(voice, 128);
|
||||
|
||||
/* setup buffer length to 1/60th of a second */
|
||||
chunkPosition = 0;
|
||||
chunkSize = info.nSampleRate / 60;
|
||||
|
||||
/* create a looped sound buffer of 3 x 1/60th secs */
|
||||
wave.nSampleRate = info.nSampleRate;
|
||||
wave.dwLength = 3 * chunkSize;
|
||||
wave.dwLoopStart = 0;
|
||||
wave.dwLoopEnd = wave.dwLength;
|
||||
wave.wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO | AUDIO_FORMAT_LOOP;
|
||||
ACreateAudioData(&wave);
|
||||
|
||||
/* clean up sound buffer */
|
||||
memset(wave.lpData, 0, wave.dwLength);
|
||||
AWriteAudioData(&wave, 0, wave.dwLength);
|
||||
|
||||
/* setup 200 Hz sine wave parameters */
|
||||
t = 0.0;
|
||||
dt = 2.0 * M_PI * 200.0 / wave.nSampleRate;
|
||||
|
||||
printf("%d-bit %s %u Hz, buffer size = %ld, chunk size = %ld\n",
|
||||
info.wFormat & AUDIO_FORMAT_16BITS ? 16 : 8,
|
||||
info.wFormat & AUDIO_FORMAT_STEREO ? "stereo" : "mono",
|
||||
info.nSampleRate, wave.dwLength, chunkSize);
|
||||
|
||||
/* start playing the sound buffer */
|
||||
APlayVoice(voice, &wave);
|
||||
|
||||
while (!kbhit()) {
|
||||
/* do not fill more than 'chunkSize' samples */
|
||||
AUpdateAudioEx(chunkSize);
|
||||
|
||||
/* update the chunk of samples at 'chunkPosition' */
|
||||
AGetVoicePosition(voice, &position);
|
||||
if (position < chunkPosition || position >= chunkPosition + chunkSize) {
|
||||
for (i = 0; i < chunkSize; i++)
|
||||
wave.lpData[chunkPosition++] = 64.0 * sin(t += dt);
|
||||
AWriteAudioData(&wave, chunkPosition - chunkSize, chunkSize);
|
||||
if (chunkPosition >= wave.dwLength)
|
||||
chunkPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* stop playing the buffer */
|
||||
AStopVoice(voice);
|
||||
|
||||
/* release sound buffer */
|
||||
ADestroyAudioData(&wave);
|
||||
|
||||
/* release audio voices */
|
||||
ADestroyAudioVoice(voice);
|
||||
ACloseVoices();
|
||||
|
||||
/* close audio device */
|
||||
ACloseAudio();
|
||||
return 0;
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.apple.xcode.dsym.example6</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>dSYM</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
case `uname -sr` in
|
||||
IRIX\ 4.0.*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/Indigo -laudio -lm" ;;
|
||||
SunOS\ 4.1.*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/SunOS -laudio -lm" ;;
|
||||
SunOS\ 5.*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/Solaris -laudio -lm" ;;
|
||||
Linux*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/Linux -lsdlseal -lm `sdl-config --libs`" ;;
|
||||
Darwin*)
|
||||
CC=clang
|
||||
STRIP=false
|
||||
LIBS="-L../lib/MacOSX -laudio -lm `allegro-config --libs` -arch i386" ;;
|
||||
FreeBSD*)
|
||||
CC=gcc
|
||||
STRIP=strip
|
||||
LIBS="-L../lib/FreeBSD -laudio -lm" ;;
|
||||
BeOS*)
|
||||
CC=gcc
|
||||
STRIP=true
|
||||
LIBS="-L../lib/BeOS -laudio -lroot -lbe -lmedia" ;;
|
||||
*)
|
||||
echo "This program has not been tested on your machine!"
|
||||
exit
|
||||
esac
|
||||
|
||||
for f in 1 2 3 4 5 6; do
|
||||
echo "compiling example$f.c"
|
||||
$CC -I../include -g -o example$f example$f.c $LIBS
|
||||
$STRIP example$f
|
||||
done
|
||||
@ -1,88 +0,0 @@
|
||||
@echo off
|
||||
|
||||
if "%1"=="bcl" goto bcl
|
||||
if "%1"=="wcl" goto wcl
|
||||
if "%1"=="bcx" goto bcx
|
||||
if "%1"=="wcf" goto wcf
|
||||
if "%1"=="djf" goto djf
|
||||
if "%1"=="w16bc" goto w16bc
|
||||
if "%1"=="w16wc" goto w16wc
|
||||
if "%1"=="w32bc" goto w32bc
|
||||
if "%1"=="w32wc" goto w32wc
|
||||
if "%1"=="w32vc" goto w32vc
|
||||
if "%1"=="w32bp" goto w32bp
|
||||
|
||||
:usage
|
||||
echo **** usage: build [target]
|
||||
echo ****
|
||||
echo **** 16-bit DOS real mode, large memory model:
|
||||
echo **** bcl - Borland C++ 3.1 real mode
|
||||
echo **** wcl - Watcom C/C++16 10.0 real mode
|
||||
echo ****
|
||||
echo **** 16-bit DOS protected mode, large memory model:
|
||||
echo **** bcx - Borland C++ 4.5 protected mode (DPMI16 PowerPack)
|
||||
echo ****
|
||||
echo **** 32-bit DOS protected mode, flat memory model:
|
||||
echo **** wcf - Watcom C/C++32 10.0 protected mode (DOS4GW Extender)
|
||||
echo **** djf - DJGPP V 2.0 protected mode (GO32/DPMI32 Extender)
|
||||
echo ****
|
||||
echo **** 16-bit Windows 3.x protected mode, large memory model:
|
||||
echo **** w16bc - Borland C++ 3.1 protected mode (Win16)
|
||||
echo **** w16wc - Watcom C/C++16 10.0 protected mode (Win16)
|
||||
echo ****
|
||||
echo **** 32-bit Windows 95/NT protected mode, flat memory model:
|
||||
echo **** w32bc - Borland C++ 4.5 protected mode (Win32)
|
||||
echo **** w32wc - Watcom C/C++16 10.0 protected mode (Win32)
|
||||
echo **** w32vc - Microsoft Visual C++ 4.1 protected mode (Win32)
|
||||
echo **** w32bp - Borland Delphi 2.0 protected mode (Win32)
|
||||
echo ****
|
||||
echo **** NOTE: 16-bit libraries are not available in this release.
|
||||
goto exit
|
||||
|
||||
:bcl
|
||||
for %%f in (*.c) do bcc -ml -I..\include ..\lib\dos\audiobcl.lib %%f
|
||||
goto exit
|
||||
|
||||
:wcl
|
||||
for %%f in (*.c) do wcl -ml -I..\include ..\lib\dos\audiowcl.lib %%f
|
||||
goto exit
|
||||
|
||||
:bcx
|
||||
for %%f in (*.c) do bcc -ml -WX -I..\include ..\lib\dos\audiobcx.lib %%f
|
||||
goto exit
|
||||
|
||||
:wcf
|
||||
for %%f in (*.c) do wcl386 -zq -I..\include ..\lib\dos\audiowcf.lib %%f
|
||||
goto exit
|
||||
|
||||
:djf
|
||||
for %%f in (1 2 3 4) do gcc -o example%%f.exe -I..\include example%%f.c -L..\lib\dos -laudio
|
||||
goto exit
|
||||
|
||||
:w16bc
|
||||
for %%f in (*.c) do bcc -ml -W -I..\include ..\lib\win16\audw16bc.lib %%f
|
||||
goto exit
|
||||
|
||||
:w16wc
|
||||
for %%f in (*.c) do wcl -ml -zw -I..\include ..\lib\win16\audw16wc.lib mmsystem.lib %%f
|
||||
goto exit
|
||||
|
||||
:w32bc
|
||||
for %%f in (*.c) do bcc32a -WC -DWIN32 -I..\include ..\lib\win32\audw32bc.lib %%f
|
||||
goto exit
|
||||
|
||||
:w32wc
|
||||
for %%f in (*.c) do wcl386 -l=nt -DWIN32 -I..\include ..\lib\win32\audw32wc.lib %%f
|
||||
goto exit
|
||||
|
||||
:w32vc
|
||||
for %%f in (*.c) do cl -DWIN32 -I..\include ..\lib\win32\audw32vc.lib %%f
|
||||
goto exit
|
||||
|
||||
:w32bp
|
||||
dcc32 -CC -U..\include demo.pas
|
||||
goto exit
|
||||
|
||||
:exit
|
||||
if exist *.obj del *.obj > nul
|
||||
if exist *.o del *.o > nul
|
||||
Binary file not shown.
Binary file not shown.
@ -1,377 +0,0 @@
|
||||
VERSION 5.00
|
||||
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
|
||||
Begin VB.Form Form1
|
||||
BorderStyle = 1 'Fixed Single
|
||||
Caption = "Seal 1.03 - Visual Basic Interface"
|
||||
ClientHeight = 5220
|
||||
ClientLeft = 2220
|
||||
ClientTop = 2205
|
||||
ClientWidth = 6690
|
||||
ControlBox = 0 'False
|
||||
LinkTopic = "Form1"
|
||||
MaxButton = 0 'False
|
||||
PaletteMode = 1 'UseZOrder
|
||||
ScaleHeight = 5220
|
||||
ScaleWidth = 6690
|
||||
Begin VB.CommandButton Command3
|
||||
Caption = "Quit"
|
||||
Height = 375
|
||||
Left = 5880
|
||||
TabIndex = 12
|
||||
Top = 0
|
||||
Width = 735
|
||||
End
|
||||
Begin VB.TextBox Text1
|
||||
Appearance = 0 'Flat
|
||||
BackColor = &H80000004&
|
||||
BorderStyle = 0 'None
|
||||
Enabled = 0 'False
|
||||
BeginProperty Font
|
||||
Name = "MS Sans Serif"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 285
|
||||
Left = 1440
|
||||
TabIndex = 9
|
||||
Text = "None"
|
||||
Top = 120
|
||||
Width = 4215
|
||||
End
|
||||
Begin TabDlg.SSTab SSTab1
|
||||
Height = 4455
|
||||
Left = 360
|
||||
TabIndex = 0
|
||||
Top = 480
|
||||
Width = 6015
|
||||
_ExtentX = 10610
|
||||
_ExtentY = 7858
|
||||
_Version = 327680
|
||||
Tab = 2
|
||||
TabHeight = 520
|
||||
TabCaption(0) = "Song Selector"
|
||||
TabPicture(0) = "Form1.frx":0000
|
||||
Tab(0).ControlCount= 3
|
||||
Tab(0).ControlEnabled= 0 'False
|
||||
Tab(0).Control(0)= "File1"
|
||||
Tab(0).Control(0).Enabled= 0 'False
|
||||
Tab(0).Control(1)= "Drive1"
|
||||
Tab(0).Control(1).Enabled= 0 'False
|
||||
Tab(0).Control(2)= "Dir1"
|
||||
Tab(0).Control(2).Enabled= 0 'False
|
||||
TabCaption(1) = "PlayBack Controls"
|
||||
TabPicture(1) = "Form1.frx":001C
|
||||
Tab(1).ControlCount= 6
|
||||
Tab(1).ControlEnabled= 0 'False
|
||||
Tab(1).Control(0)= "Label2"
|
||||
Tab(1).Control(0).Enabled= 0 'False
|
||||
Tab(1).Control(1)= "Frame1"
|
||||
Tab(1).Control(1).Enabled= 0 'False
|
||||
Tab(1).Control(2)= "Command2"
|
||||
Tab(1).Control(2).Enabled= -1 'True
|
||||
Tab(1).Control(3)= "PlayButton"
|
||||
Tab(1).Control(3).Enabled= -1 'True
|
||||
Tab(1).Control(4)= "Command1"
|
||||
Tab(1).Control(4).Enabled= -1 'True
|
||||
Tab(1).Control(5)= "StopButton"
|
||||
Tab(1).Control(5).Enabled= -1 'True
|
||||
TabCaption(2) = "Author Info"
|
||||
TabPicture(2) = "Form1.frx":0038
|
||||
Tab(2).ControlCount= 4
|
||||
Tab(2).ControlEnabled= -1 'True
|
||||
Tab(2).Control(0)= "Label4"
|
||||
Tab(2).Control(0).Enabled= 0 'False
|
||||
Tab(2).Control(1)= "Label3"
|
||||
Tab(2).Control(1).Enabled= 0 'False
|
||||
Tab(2).Control(2)= "Command4"
|
||||
Tab(2).Control(2).Enabled= 0 'False
|
||||
Tab(2).Control(3)= "Command5"
|
||||
Tab(2).Control(3).Enabled= 0 'False
|
||||
Begin VB.CommandButton Command5
|
||||
Caption = "SEAL Page"
|
||||
Height = 615
|
||||
Left = 1200
|
||||
TabIndex = 16
|
||||
Top = 3240
|
||||
Width = 3855
|
||||
End
|
||||
Begin VB.CommandButton Command4
|
||||
Caption = "Egerter Software Home Page"
|
||||
Height = 615
|
||||
Left = 1200
|
||||
TabIndex = 13
|
||||
Top = 2040
|
||||
Width = 3855
|
||||
End
|
||||
Begin VB.CommandButton StopButton
|
||||
Caption = "Stop"
|
||||
Height = 495
|
||||
Left = -72480
|
||||
TabIndex = 7
|
||||
Top = 2520
|
||||
Width = 855
|
||||
End
|
||||
Begin VB.CommandButton Command1
|
||||
Caption = "Next"
|
||||
Height = 495
|
||||
Left = -71400
|
||||
TabIndex = 6
|
||||
Top = 1800
|
||||
Width = 855
|
||||
End
|
||||
Begin VB.CommandButton PlayButton
|
||||
Caption = "Play"
|
||||
Height = 495
|
||||
Left = -72480
|
||||
TabIndex = 5
|
||||
Top = 1800
|
||||
Width = 855
|
||||
End
|
||||
Begin VB.CommandButton Command2
|
||||
Caption = "Prev"
|
||||
Height = 495
|
||||
Left = -73560
|
||||
TabIndex = 4
|
||||
Top = 1800
|
||||
Width = 855
|
||||
End
|
||||
Begin VB.DirListBox Dir1
|
||||
Height = 1440
|
||||
Left = -74280
|
||||
TabIndex = 3
|
||||
Top = 960
|
||||
Width = 4695
|
||||
End
|
||||
Begin VB.DriveListBox Drive1
|
||||
Height = 315
|
||||
Left = -74280
|
||||
TabIndex = 2
|
||||
Top = 480
|
||||
Width = 4695
|
||||
End
|
||||
Begin VB.FileListBox File1
|
||||
Height = 1650
|
||||
Left = -74280
|
||||
Pattern = "*.mod;*.s3m;*.mtm;*.xm"
|
||||
TabIndex = 1
|
||||
Top = 2520
|
||||
Width = 4695
|
||||
End
|
||||
Begin VB.Frame Frame1
|
||||
Caption = "Playback"
|
||||
Height = 2175
|
||||
Left = -74280
|
||||
TabIndex = 10
|
||||
Top = 1200
|
||||
Width = 4575
|
||||
End
|
||||
Begin VB.Label Label3
|
||||
Caption = "SEAL by Carlos Hasan"
|
||||
BeginProperty Font
|
||||
Name = "MS Sans Serif"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 255
|
||||
Left = 1440
|
||||
TabIndex = 15
|
||||
Top = 1080
|
||||
Width = 3495
|
||||
End
|
||||
Begin VB.Label Label4
|
||||
Caption = "Modifications to VB interface by Barry Egerter"
|
||||
Height = 255
|
||||
Left = 1440
|
||||
TabIndex = 14
|
||||
Top = 1320
|
||||
Width = 3615
|
||||
End
|
||||
Begin VB.Label Label2
|
||||
Caption = "Use this simple playback system to control the music."
|
||||
Height = 255
|
||||
Left = -74160
|
||||
TabIndex = 11
|
||||
Top = 720
|
||||
Width = 4335
|
||||
End
|
||||
End
|
||||
Begin VB.Label Label1
|
||||
Caption = "Current Song:"
|
||||
Height = 255
|
||||
Left = 360
|
||||
TabIndex = 8
|
||||
Top = 120
|
||||
Width = 1095
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "Form1"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Dim iewindow As InternetExplorer
|
||||
Dim szFileName As String * 256
|
||||
Dim lpModule As Long
|
||||
Dim bSongPlaying As Long
|
||||
|
||||
|
||||
Private Sub Command1_Click()
|
||||
|
||||
Dim pnOrder As Long
|
||||
Dim lpnRow As Long
|
||||
|
||||
If AGetModulePosition(pnOrder, lpnRow) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If ASetModulePosition(pnOrder + 1, 0) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Command2_Click()
|
||||
|
||||
Dim pnOrder As Long
|
||||
Dim lpnRow As Long
|
||||
|
||||
If AGetModulePosition(pnOrder, lpnRow) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If pnOrder > 1 Then
|
||||
pnOrder = pnOrder - 1
|
||||
Else
|
||||
pnOrder = 0
|
||||
End If
|
||||
|
||||
If ASetModulePosition(pnOrder, 0) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Command3_Click()
|
||||
|
||||
StopButton_Click
|
||||
Form1.Hide
|
||||
Unload Form1
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Command4_Click()
|
||||
|
||||
Set iewindow = New InternetExplorer
|
||||
|
||||
iewindow.Visible = True
|
||||
iewindow.Navigate ("http://www.egerter.com")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Command5_Click()
|
||||
|
||||
Set iewindow = New InternetExplorer
|
||||
|
||||
iewindow.Visible = True
|
||||
iewindow.Navigate ("http://www.egerter.com/seal")
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Dir1_Change()
|
||||
|
||||
File1.Path = Dir1.Path
|
||||
File1.Refresh
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Drive1_Change()
|
||||
|
||||
Dir1.Path = Drive1.Drive
|
||||
Dir1.Refresh
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub File1_Click()
|
||||
|
||||
Text1.Text = Dir1.Path + "\" + File1.filename
|
||||
Text1.Refresh
|
||||
szFileName = Text1.Text
|
||||
StopButton_Click
|
||||
|
||||
SSTab1.Tab = 1
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub PlayButton_Click()
|
||||
' WARNING! It's the very first time I have ever used VB, after some hours
|
||||
' I could finally write a sort of interface for AUDIOW32.DLL, it's not
|
||||
' perfect, there are still some things I couldn't figure how to port.
|
||||
' I used VB 4.0 and SEAL 1.03 to test this code.
|
||||
|
||||
Dim Info As AudioInfo
|
||||
|
||||
If bSongPlaying Then
|
||||
StopButton_Click
|
||||
End If
|
||||
|
||||
' set up audio configuration structure
|
||||
Info.nDeviceId = AUDIO_DEVICE_MAPPER
|
||||
Info.wFormat = AUDIO_FORMAT_STEREO + AUDIO_FORMAT_16BITS
|
||||
Info.nSampleRate = 22050 ' 44100 is an unsigned 16-bit integer!
|
||||
|
||||
' open the default audio device, return if error
|
||||
If AOpenAudio(Info) <> AUDIO_ERROR_NONE Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' open 32 active voices
|
||||
If AOpenVoices(32) <> AUDIO_ERROR_NONE Then
|
||||
ACloseAudio
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' load module file from disk, shutdown and return if error
|
||||
If ALoadModuleFile(szFileName, lpModule, 0) <> AUDIO_ERROR_NONE Then
|
||||
ACloseVoices
|
||||
ACloseAudio
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' start playing the module file
|
||||
If APlayModule(lpModule) <> AUDIO_ERROR_NONE Then
|
||||
ACloseVoices
|
||||
ACloseAudio
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
bSongPlaying = 1
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub StopButton_Click()
|
||||
|
||||
If bSongPlaying = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
bSongPlaying = 0
|
||||
|
||||
' stop playing the module file
|
||||
AStopModule
|
||||
|
||||
' release the module file
|
||||
AFreeModuleFile (lpModule)
|
||||
|
||||
' close audio device
|
||||
ACloseVoices
|
||||
ACloseAudio
|
||||
|
||||
End Sub
|
||||
Binary file not shown.
@ -1,43 +0,0 @@
|
||||
Type=Exe
|
||||
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0; COMDLG32.OCX
|
||||
Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX
|
||||
Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0; RICHTX32.OCX
|
||||
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0; COMCTL32.OCX
|
||||
Object={FAEEE763-117E-101B-8933-08002B2F4F5A}#1.1#0; DBLIST32.OCX
|
||||
Object={00028C01-0000-0000-0000-000000000046}#1.0#0; DBGRID32.OCX
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\SYSTEM\stdole2.tlb#Standard OLE Types
|
||||
Reference=*\G{EE008642-64A8-11CE-920F-08002B369A33}#2.0#0#C:\WINDOWS\SYSTEM\MSRDO20.DLL#Microsoft Remote Data Object 2.0
|
||||
Reference=*\G{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.0#0#C:\WINDOWS\SYSTEM\SHDOCVW.DLL#Microsoft Internet Controls
|
||||
Form=Form1.frm
|
||||
Module=Audio; audio.Bas
|
||||
Form=frmSplash.frm
|
||||
IconForm="Form1"
|
||||
Startup="frmSplash"
|
||||
HelpFile=""
|
||||
Title="SealStuf"
|
||||
ExeName32="SEAL_VB.exe"
|
||||
Command32=""
|
||||
Name="SEALVB"
|
||||
HelpContextID="0"
|
||||
CompatibleMode="0"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=0
|
||||
AutoIncrementVer=0
|
||||
ServerSupportFiles=0
|
||||
VersionComments="Modified by Barry Egerter with initial code by Carlos Hasan"
|
||||
VersionCompanyName="Egerter Software"
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=0
|
||||
Unattended=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
||||
@ -1,3 +0,0 @@
|
||||
Form1 = 212, 37, 735, 505, C, 23, 44, 546, 512,
|
||||
Audio = 0, 0, 0, 0, C
|
||||
frmSplash = 88, 88, 611, 556, C, 92, 63, 615, 531,
|
||||
@ -1,230 +0,0 @@
|
||||
VERSION 5.00
|
||||
Begin VB.Form frmSplash
|
||||
BorderStyle = 3 'Fixed Dialog
|
||||
ClientHeight = 4245
|
||||
ClientLeft = 255
|
||||
ClientTop = 1410
|
||||
ClientWidth = 7380
|
||||
ClipControls = 0 'False
|
||||
ControlBox = 0 'False
|
||||
Icon = "Splash.frx":0000
|
||||
KeyPreview = -1 'True
|
||||
LinkTopic = "Form2"
|
||||
MaxButton = 0 'False
|
||||
MinButton = 0 'False
|
||||
ScaleHeight = 4245
|
||||
ScaleWidth = 7380
|
||||
ShowInTaskbar = 0 'False
|
||||
StartUpPosition = 2 'CenterScreen
|
||||
Begin VB.Frame Frame1
|
||||
Height = 4050
|
||||
Left = 150
|
||||
TabIndex = 0
|
||||
Top = 60
|
||||
Width = 7080
|
||||
Begin VB.Timer Timer1
|
||||
Interval = 1000
|
||||
Left = 6600
|
||||
Top = 3240
|
||||
End
|
||||
Begin VB.Label Label1
|
||||
AutoSize = -1 'True
|
||||
Caption = "Visual Basic Interface"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 15.75
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 360
|
||||
Left = 2400
|
||||
TabIndex = 9
|
||||
Top = 1800
|
||||
Width = 3240
|
||||
End
|
||||
Begin VB.Image imgLogo
|
||||
Height = 2385
|
||||
Left = 360
|
||||
Picture = "Splash.frx":000C
|
||||
Stretch = -1 'True
|
||||
Top = 795
|
||||
Width = 1815
|
||||
End
|
||||
Begin VB.Label lblCopyright
|
||||
Caption = "Copyright 1997"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 400
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 255
|
||||
Left = 4560
|
||||
TabIndex = 4
|
||||
Top = 3060
|
||||
Width = 2415
|
||||
End
|
||||
Begin VB.Label lblCompany
|
||||
Caption = "Egerter Software"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 400
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 255
|
||||
Left = 4560
|
||||
TabIndex = 3
|
||||
Top = 3270
|
||||
Width = 2415
|
||||
End
|
||||
Begin VB.Label lblWarning
|
||||
AutoSize = -1 'True
|
||||
Caption = "Warning - Do not close the application while a song is still playing.......bugs exist!"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 400
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 210
|
||||
Left = 600
|
||||
TabIndex = 2
|
||||
Top = 3720
|
||||
Width = 5790
|
||||
End
|
||||
Begin VB.Label lblVersion
|
||||
Alignment = 1 'Right Justify
|
||||
AutoSize = -1 'True
|
||||
Caption = "Version 1.0"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 12
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 285
|
||||
Left = 5580
|
||||
TabIndex = 5
|
||||
Top = 2700
|
||||
Width = 1275
|
||||
End
|
||||
Begin VB.Label lblPlatform
|
||||
Alignment = 1 'Right Justify
|
||||
AutoSize = -1 'True
|
||||
Caption = "for Windows 95/NT"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 15.75
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 360
|
||||
Left = 4020
|
||||
TabIndex = 6
|
||||
Top = 2340
|
||||
Width = 2835
|
||||
End
|
||||
Begin VB.Label lblProductName
|
||||
AutoSize = -1 'True
|
||||
Caption = "Seal 1.03"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 32.25
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 765
|
||||
Left = 2280
|
||||
TabIndex = 8
|
||||
Top = 1080
|
||||
Width = 2775
|
||||
End
|
||||
Begin VB.Label lblLicenseTo
|
||||
Alignment = 1 'Right Justify
|
||||
Caption = "Licensed to all users of the Egerter Software Web site. Free for home and office use."
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 8.25
|
||||
Charset = 0
|
||||
Weight = 400
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 255
|
||||
Left = 120
|
||||
TabIndex = 1
|
||||
Top = 240
|
||||
Width = 6855
|
||||
End
|
||||
Begin VB.Label lblCompanyProduct
|
||||
AutoSize = -1 'True
|
||||
Caption = "Carlos Hasan presents"
|
||||
BeginProperty Font
|
||||
Name = "Arial"
|
||||
Size = 18
|
||||
Charset = 0
|
||||
Weight = 700
|
||||
Underline = 0 'False
|
||||
Italic = 0 'False
|
||||
Strikethrough = 0 'False
|
||||
EndProperty
|
||||
Height = 435
|
||||
Left = 1800
|
||||
TabIndex = 7
|
||||
Top = 705
|
||||
Width = 3870
|
||||
End
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "frmSplash"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Dim counter
|
||||
Option Explicit
|
||||
|
||||
Private Sub Form_KeyPress(KeyAscii As Integer)
|
||||
Unload Me
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Unload(Cancel As Integer)
|
||||
|
||||
Load Form1
|
||||
Form1.Show
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Frame1_Click()
|
||||
Unload Me
|
||||
End Sub
|
||||
|
||||
Private Sub Timer1_Timer()
|
||||
counter = counter + 1
|
||||
If counter > 7 Then
|
||||
Unload Me
|
||||
End If
|
||||
End Sub
|
||||
Binary file not shown.
@ -1,288 +0,0 @@
|
||||
Attribute VB_Name = "Audio"
|
||||
'
|
||||
' $Id: audio.h 1.17 1996/09/25 17:13:02 chasan released $
|
||||
'
|
||||
' SEAL Synthetic Audio Library API Interface
|
||||
'
|
||||
' Copyright (C) 1995, 1996, 1997, 1998, 1999 Carlos Hasan
|
||||
'
|
||||
' 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 of the License, or
|
||||
' (at your option) any later version.
|
||||
'
|
||||
' MICROSOFT VISUAL BASIC INTERFACE FOR WINDOWS 95/NT
|
||||
'
|
||||
|
||||
Option Explicit
|
||||
|
||||
' audio system version number
|
||||
Public Const AUDIO_SYSTEM_VERSION = &H101
|
||||
|
||||
' audio capabilities bit fields definitions
|
||||
Public Const AUDIO_FORMAT_1M08 = &H1
|
||||
Public Const AUDIO_FORMAT_1S08 = &H2
|
||||
Public Const AUDIO_FORMAT_1M16 = &H4
|
||||
Public Const AUDIO_FORMAT_1S16 = &H8
|
||||
Public Const AUDIO_FORMAT_2M08 = &H10
|
||||
Public Const AUDIO_FORMAT_2S08 = &H20
|
||||
Public Const AUDIO_FORMAT_2M16 = &H40
|
||||
Public Const AUDIO_FORMAT_2S16 = &H80
|
||||
Public Const AUDIO_FORMAT_4M08 = &H100
|
||||
Public Const AUDIO_FORMAT_4S08 = &H200
|
||||
Public Const AUDIO_FORMAT_4M16 = &H400
|
||||
Public Const AUDIO_FORMAT_4S16 = &H800
|
||||
|
||||
' audio format bit fields defines for devices and waveforms
|
||||
Public Const AUDIO_FORMAT_8BITS = &H0
|
||||
Public Const AUDIO_FORMAT_16BITS = &H1
|
||||
Public Const AUDIO_FORMAT_LOOP = &H10
|
||||
Public Const AUDIO_FORMAT_BIDILOOP = &H20
|
||||
Public Const AUDIO_FORMAT_REVERSE = &H80
|
||||
Public Const AUDIO_FORMAT_MONO = &H0
|
||||
Public Const AUDIO_FORMAT_STEREO = &H100
|
||||
Public Const AUDIO_FORMAT_FILTER = &H8000
|
||||
|
||||
' audio resource limits defines
|
||||
Public Const AUDIO_MAX_VOICES = 32
|
||||
Public Const AUDIO_MAX_SAMPLES = 16
|
||||
Public Const AUDIO_MAX_PATCHES = 128
|
||||
Public Const AUDIO_MAX_PATTERNS = 256
|
||||
Public Const AUDIO_MAX_ORDERS = 256
|
||||
Public Const AUDIO_MAX_NOTES = 96
|
||||
Public Const AUDIO_MAX_POINTS = 12
|
||||
Public Const AUDIO_MIN_PERIOD = 1
|
||||
Public Const AUDIO_MAX_PERIOD = 31999
|
||||
Public Const AUDIO_MIN_VOLUME = 0
|
||||
Public Const AUDIO_MAX_VOLUME = 64
|
||||
Public Const AUDIO_MIN_PANNING = 0
|
||||
Public Const AUDIO_MAX_PANNING = 255
|
||||
Public Const AUDIO_MIN_POSITION = 0
|
||||
Public Const AUDIO_MAX_POSITION = 1048576
|
||||
Public Const AUDIO_MIN_FREQUENCY = 512
|
||||
Public Const AUDIO_MAX_FREQUENCY = 524288
|
||||
|
||||
' audio error code defines
|
||||
Public Const AUDIO_ERROR_NONE = 0
|
||||
Public Const AUDIO_ERROR_INVALHANDLE = 1
|
||||
Public Const AUDIO_ERROR_INVALPARAM = 2
|
||||
Public Const AUDIO_ERROR_NOTSUPPORTED = 3
|
||||
Public Const AUDIO_ERROR_BADDEVICEID = 4
|
||||
Public Const AUDIO_ERROR_NODEVICE = 5
|
||||
Public Const AUDIO_ERROR_DEVICEBUSY = 6
|
||||
Public Const AUDIO_ERROR_BADFORMAT = 7
|
||||
Public Const AUDIO_ERROR_NOMEMORY = 8
|
||||
Public Const AUDIO_ERROR_NODRAMMEMORY = 9
|
||||
Public Const AUDIO_ERROR_FILENOTFOUND = 10
|
||||
Public Const AUDIO_ERROR_BADFILEFORMAT = 11
|
||||
Public Const AUDIO_LAST_ERROR = 11
|
||||
|
||||
' audio device identifiers
|
||||
Public Const AUDIO_DEVICE_NONE = 0
|
||||
Public Const AUDIO_DEVICE_MAPPER = 65535
|
||||
|
||||
' audio product identifiers
|
||||
Public Const AUDIO_PRODUCT_NONE = 0
|
||||
Public Const AUDIO_PRODUCT_SB = 1
|
||||
Public Const AUDIO_PRODUCT_SB15 = 2
|
||||
Public Const AUDIO_PRODUCT_SB20 = 3
|
||||
Public Const AUDIO_PRODUCT_SBPRO = 4
|
||||
Public Const AUDIO_PRODUCT_SB16 = 5
|
||||
Public Const AUDIO_PRODUCT_AWE32 = 6
|
||||
Public Const AUDIO_PRODUCT_WSS = 7
|
||||
Public Const AUDIO_PRODUCT_ESS = 8
|
||||
Public Const AUDIO_PRODUCT_GUS = 9
|
||||
Public Const AUDIO_PRODUCT_GUSDB = 10
|
||||
Public Const AUDIO_PRODUCT_GUSMAX = 11
|
||||
Public Const AUDIO_PRODUCT_IWAVE = 12
|
||||
Public Const AUDIO_PRODUCT_PAS = 13
|
||||
Public Const AUDIO_PRODUCT_PAS16 = 14
|
||||
Public Const AUDIO_PRODUCT_ARIA = 15
|
||||
Public Const AUDIO_PRODUCT_WINDOWS = 256
|
||||
Public Const AUDIO_PRODUCT_LINUX = 257
|
||||
Public Const AUDIO_PRODUCT_SPARC = 258
|
||||
Public Const AUDIO_PRODUCT_SGI = 259
|
||||
Public Const AUDIO_PRODUCT_DSOUND = 260
|
||||
|
||||
' audio envelope bit fields
|
||||
Public Const AUDIO_ENVELOPE_ON = &H1
|
||||
Public Const AUDIO_ENVELOPE_SUSTAIN = &H2
|
||||
Public Const AUDIO_ENVELOPE_LOOP = &H4
|
||||
|
||||
' audio pattern bit fields
|
||||
Public Const AUDIO_PATTERN_PACKED = &H80
|
||||
Public Const AUDIO_PATTERN_NOTE = &H1
|
||||
Public Const AUDIO_PATTERN_SAMPLE = &H2
|
||||
Public Const AUDIO_PATTERN_VOLUME = &H4
|
||||
Public Const AUDIO_PATTERN_COMMAND = &H8
|
||||
Public Const AUDIO_PATTERN_PARAMS = &H10
|
||||
|
||||
' audio module bit fields
|
||||
Public Const AUDIO_MODULE_AMIGA = &H0
|
||||
Public Const AUDIO_MODULE_LINEAR = &H1
|
||||
Public Const AUDIO_MODULE_PANNING = &H8000
|
||||
|
||||
' FIXME: structures should be byte aligned
|
||||
|
||||
' audio capabilities structure
|
||||
Public Type AudioCaps
|
||||
wProductId As Integer ' product identifier
|
||||
szProductName As String * 30 ' product name
|
||||
dwFormats As Long ' formats supported
|
||||
End Type
|
||||
|
||||
|
||||
' audio format structure
|
||||
Public Type AudioInfo
|
||||
nDeviceId As Long ' device identifier
|
||||
wFormat As Integer ' playback format
|
||||
nSampleRate As Integer ' sampling frequency
|
||||
End Type
|
||||
|
||||
' audio waveform structure
|
||||
Public Type AudioWave
|
||||
lpData As Long ' data pointer
|
||||
dwHandle As Long ' waveform handle
|
||||
dwLength As Long ' waveform length
|
||||
dwLoopStart As Long ' loop start point
|
||||
dwLoopEnd As Long ' loop end point
|
||||
nSampleRate As Integer ' sampling rate
|
||||
wFormat As Integer ' format bits
|
||||
End Type
|
||||
|
||||
|
||||
' audio envelope point structure
|
||||
Public Type AudioPoint
|
||||
nFrame As Integer ' envelope frame
|
||||
nValue As Integer ' envelope value
|
||||
End Type
|
||||
|
||||
' audio envelope structure
|
||||
Public Type AudioEnvelope
|
||||
aEnvelope(0 To 11) As AudioPoint ' envelope points
|
||||
nPoints As Byte ' number of points
|
||||
nSustain As Byte ' sustain point
|
||||
nLoopStart As Byte ' loop start point
|
||||
nLoopEnd As Byte ' loop end point
|
||||
wFlags As Integer ' envelope flags
|
||||
nSpeed As Integer ' envelope speed
|
||||
End Type
|
||||
|
||||
' audio sample structure
|
||||
Public Type AudioSample
|
||||
szSampleName As String * 32 ' sample name
|
||||
nVolume As Byte ' default volume
|
||||
nPanning As Byte ' default panning
|
||||
nRelativeNote As Byte ' relative note
|
||||
nFinetune As Byte ' finetune
|
||||
Wave As AudioWave ' waveform handle
|
||||
End Type
|
||||
|
||||
' audio patch structure
|
||||
Public Type AudioPatch
|
||||
szPatchName As String * 32 ' patch name
|
||||
aSampleNumber(0 To 95) As Byte ' multi-sample table
|
||||
nSamples As Integer ' number of samples
|
||||
nVibratoType As Byte ' vibrato type
|
||||
nVibratoSweep As Byte ' vibrato sweep
|
||||
nVibratoDepth As Byte ' vibrato depth
|
||||
nVibratoRate As Byte ' vibrato rate
|
||||
nVolumeFadeout As Integer ' volume fadeout
|
||||
Volume As AudioEnvelope ' volume envelope
|
||||
Panning As AudioEnvelope ' panning envelope
|
||||
aSampleTable As Long ' sample table (pointer)
|
||||
End Type
|
||||
|
||||
' audio pattern structure
|
||||
Public Type AudioPattern
|
||||
nPacking As Integer ' packing type
|
||||
nTracks As Integer ' number of tracks
|
||||
nRows As Integer ' number of rows
|
||||
nSize As Integer ' data size
|
||||
lpData As Long ' data pointer
|
||||
End Type
|
||||
|
||||
' audio module structure
|
||||
Public Type AudioModule
|
||||
szModuleName As String * 32 ' module name
|
||||
wFlags As Integer ' module flags
|
||||
nOrders As Integer ' number of orders
|
||||
nRestart As Integer ' restart position
|
||||
nTracks As Integer ' number of tracks
|
||||
nPatterns As Integer ' number of patterns
|
||||
nPatches As Integer ' number of patches
|
||||
nTempo As Integer ' initial tempo
|
||||
nBPM As Integer ' initial BPM
|
||||
aOrderTable(0 To 255) As Byte ' order table
|
||||
aPanningTable(0 To 31) As Byte ' panning table
|
||||
aPatternTable As Long ' pattern table (pointer)
|
||||
aPatchTable As Long ' patch table (pointer)
|
||||
End Type
|
||||
|
||||
' FIXME: how do I define callback functions?
|
||||
'typedef VOID (AIAPI* LPFNAUDIOWAVE)(LPBYTE, UINT);
|
||||
'typedef VOID (AIAPI* LPFNAUDIOTIMER)(VOID);
|
||||
'typedef VOID (AIAPI* LPFNAUDIOCALLBACK)(BYTE, UINT, UINT);
|
||||
|
||||
' audio interface API prototypes
|
||||
Public Declare Function AInitialize Lib "AudioW32" () As Long
|
||||
Public Declare Function AGetVersion Lib "AudioW32" () As Long
|
||||
Public Declare Function AGetAudioNumDevs Lib "AudioW32" () As Long
|
||||
Public Declare Function AGetAudioDevCaps Lib "AudioW32" (ByVal nDeviceId As Long, ByRef lpCaps As AudioCaps) As Long
|
||||
Public Declare Function AGetErrorText Lib "AudioW32" (ByVal nErrorCode As Long, ByVal lpszText As String, ByVal nSize As Long) As Long
|
||||
|
||||
Public Declare Function APingAudio Lib "AudioW32" (ByRef lpnDeviceId As Long) As Long
|
||||
Public Declare Function AOpenAudio Lib "AudioW32" (ByRef lpInfo As AudioInfo) As Long
|
||||
Public Declare Function ACloseAudio Lib "AudioW32" () As Long
|
||||
Public Declare Function AUpdateAudio Lib "AudioW32" () As Long
|
||||
|
||||
Public Declare Function AOpenVoices Lib "AudioW32" (ByVal nVoices As Long) As Long
|
||||
Public Declare Function ACloseVoices Lib "AudioW32" () As Long
|
||||
|
||||
Public Declare Function ASetAudioCallback Lib "AudioW32" (ByVal lpfnAudioWave As Long) As Long
|
||||
Public Declare Function ASetAudioTimerProc Lib "AudioW32" (ByVal lpfnAudioTimer As Long) As Long
|
||||
Public Declare Function ASetAudioTimerRate Lib "AudioW32" (ByVal nTimerRate As Long) As Long
|
||||
|
||||
Public Declare Function AGetAudioDataAvail Lib "AudioW32" () As Long
|
||||
Public Declare Function ACreateAudioData Lib "AudioW32" (ByRef lpWave As AudioWave) As Long
|
||||
Public Declare Function ADestroyAudioData Lib "AudioW32" (ByRef lpWave As AudioWave) As Long
|
||||
Public Declare Function AWriteAudioData Lib "AudioW32" (ByRef lpWave As AudioWave, ByVal dwOffset As Long, ByVal nCount As Long) As Long
|
||||
|
||||
Public Declare Function ACreateAudioVoice Lib "AudioW32" (ByRef lphVoice As Long) As Long
|
||||
Public Declare Function ADestroyAudioVoice Lib "AudioW32" (ByVal hVoice As Long) As Long
|
||||
|
||||
Public Declare Function APlayVoice Lib "AudioW32" (ByVal hVoice As Long, ByVal lpWave As Long) As Long
|
||||
Public Declare Function APrimeVoice Lib "AudioW32" (ByVal hVoice As Long, ByVal lpWave As Long) As Long
|
||||
Public Declare Function AStartVoice Lib "AudioW32" (ByVal hVoice As Long) As Long
|
||||
Public Declare Function AStopVoice Lib "AudioW32" (ByVal hVoice As Long) As Long
|
||||
|
||||
Public Declare Function ASetVoicePosition Lib "AudioW32" (ByVal hVoice As Long, ByVal dwPosition As Long) As Long
|
||||
Public Declare Function ASetVoiceFrequency Lib "AudioW32" (ByVal hVoice As Long, ByVal dwFrequency As Long) As Long
|
||||
Public Declare Function ASetVoiceVolume Lib "AudioW32" (ByVal hVoice As Long, ByVal nVolume As Long) As Long
|
||||
Public Declare Function ASetVoicePanning Lib "AudioW32" (ByVal hVoice As Long, ByVal nPanning As Long) As Long
|
||||
|
||||
Public Declare Function AGetVoicePosition Lib "AudioW32" (ByVal hVoice As Long, ByRef lpdwPosition As Long) As Long
|
||||
Public Declare Function AGetVoiceFrequency Lib "AudioW32" (ByVal hVoice As Long, ByRef lpdwFrequency As Long) As Long
|
||||
Public Declare Function AGetVoiceVolume Lib "AudioW32" (ByVal hVoice As Long, ByRef lpnVolume As Long) As Long
|
||||
Public Declare Function AGetVoicePanning Lib "AudioW32" (ByVal hVoice As Long, ByRef lpnPanning As Long) As Long
|
||||
Public Declare Function AGetVoiceStatus Lib "AudioW32" (ByVal hVoice As Long, ByRef lpnStatus As Long) As Long
|
||||
|
||||
Public Declare Function APlayModule Lib "AudioW32" (ByVal lpModule As Long) As Long
|
||||
Public Declare Function AStopModule Lib "AudioW32" () As Long
|
||||
Public Declare Function APauseModule Lib "AudioW32" () As Long
|
||||
Public Declare Function AResumeModule Lib "AudioW32" () As Long
|
||||
Public Declare Function ASetModuleVolume Lib "AudioW32" (ByVal nVolume As Long) As Long
|
||||
Public Declare Function ASetModulePosition Lib "AudioW32" (ByVal nOrder As Long, ByVal nRow As Long) As Long
|
||||
Public Declare Function AGetModuleVolume Lib "AudioW32" (ByVal lpnVolume As Long) As Long
|
||||
Public Declare Function AGetModulePosition Lib "AudioW32" (ByRef pnOrder As Long, ByRef lpnRow As Long) As Long
|
||||
Public Declare Function AGetModuleStatus Lib "AudioW32" (ByRef lpnStatus As Long) As Long
|
||||
Public Declare Function ASetModuleCallback Lib "AudioW32" (ByVal lpfnAudioCallback As Long) As Long
|
||||
|
||||
' FIXME: how do I define pointers to AudioModule and AudioWave?
|
||||
|
||||
Public Declare Function ALoadModuleFile Lib "AudioW32" (ByVal lpszFileName As String, ByRef lplpModule As Long, ByVal dwFileOffset As Long) As Long
|
||||
Public Declare Function AFreeModuleFile Lib "AudioW32" (ByVal lpModule As Long) As Long
|
||||
|
||||
Public Declare Function ALoadWaveFile Lib "AudioW32" (ByVal lpszFileName As String, ByRef lplpWave As Long, ByVal dwFileOffset As Long) As Long
|
||||
Public Declare Function AFreeWaveFile Lib "AudioW32" (ByVal lpWave As Long) As Long
|
||||
|
||||
@ -1,388 +0,0 @@
|
||||
/*
|
||||
* $Id: audio.h 1.17 1996/09/25 17:13:02 chasan released $
|
||||
* 1.18 1998/10/12 23:54:08 chasan released
|
||||
* 1.19 1998/10/24 18:20:52 chasan released
|
||||
* 1.20 1999/06/27 17:49:49 chasan released
|
||||
*
|
||||
* SEAL Synthetic Audio Library API Interface
|
||||
*
|
||||
* Copyright (C) 1995, 1996, 1997, 1998, 1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_H
|
||||
#define __AUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#define AIAPI
|
||||
#else
|
||||
#define AIAPI __stdcall
|
||||
#endif
|
||||
|
||||
#ifndef WINAPI
|
||||
|
||||
#if 0
|
||||
typedef void VOID;
|
||||
typedef char CHAR;
|
||||
typedef int INT;
|
||||
typedef long LONG;
|
||||
typedef int BOOL;
|
||||
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned long DWORD;
|
||||
#else
|
||||
typedef void VOID;
|
||||
typedef int8_t CHAR;
|
||||
typedef int32_t INT;
|
||||
typedef int32_t LONG;
|
||||
typedef int8_t BOOL;
|
||||
|
||||
typedef uint8_t BYTE;
|
||||
typedef uint16_t WORD;
|
||||
typedef uint32_t UINT;
|
||||
typedef uint32_t DWORD;
|
||||
#endif
|
||||
typedef VOID* LPVOID;
|
||||
typedef CHAR* LPCHAR;
|
||||
typedef INT* LPINT;
|
||||
typedef LONG* LPLONG;
|
||||
typedef BOOL* LPBOOL;
|
||||
typedef BYTE* LPBYTE;
|
||||
typedef WORD* LPWORD;
|
||||
typedef UINT* LPUINT;
|
||||
typedef DWORD* LPDWORD;
|
||||
typedef char* LPSTR;
|
||||
typedef uint64_t HANDLE;
|
||||
|
||||
/* helper macros */
|
||||
#define LOBYTE(s) ((BYTE)(s))
|
||||
#define HIBYTE(s) ((BYTE)((WORD)(s)>>8))
|
||||
#define LOWORD(l) ((WORD)(l))
|
||||
#define HIWORD(l) ((WORD)((DWORD)(l)>>16))
|
||||
#define MAKEWORD(l,h) ((WORD)(((BYTE)(l))|(((WORD)((BYTE)(h)))<<8)))
|
||||
#define MAKELONG(l,h) ((DWORD)(((WORD)(l))|(((DWORD)((WORD)(h)))<<16)))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* audio system version number */
|
||||
#define AUDIO_SYSTEM_VERSION 0x0106
|
||||
|
||||
/* audio capabilities bit fields definitions */
|
||||
#define AUDIO_FORMAT_1M08 0x00000001
|
||||
#define AUDIO_FORMAT_1S08 0x00000002
|
||||
#define AUDIO_FORMAT_1M16 0x00000004
|
||||
#define AUDIO_FORMAT_1S16 0x00000008
|
||||
#define AUDIO_FORMAT_2M08 0x00000010
|
||||
#define AUDIO_FORMAT_2S08 0x00000020
|
||||
#define AUDIO_FORMAT_2M16 0x00000040
|
||||
#define AUDIO_FORMAT_2S16 0x00000080
|
||||
#define AUDIO_FORMAT_4M08 0x00000100
|
||||
#define AUDIO_FORMAT_4S08 0x00000200
|
||||
#define AUDIO_FORMAT_4M16 0x00000400
|
||||
#define AUDIO_FORMAT_4S16 0x00000800
|
||||
|
||||
/* audio format bit fields defines for devices and waveforms */
|
||||
#define AUDIO_FORMAT_8BITS 0x0000
|
||||
#define AUDIO_FORMAT_16BITS 0x0001
|
||||
#define AUDIO_FORMAT_LOOP 0x0010
|
||||
#define AUDIO_FORMAT_BIDILOOP 0x0020
|
||||
#define AUDIO_FORMAT_REVERSE 0x0080
|
||||
#define AUDIO_FORMAT_MONO 0x0000
|
||||
#define AUDIO_FORMAT_STEREO 0x0100
|
||||
#define AUDIO_FORMAT_FILTER 0x8000
|
||||
|
||||
/* audio resource limits defines */
|
||||
#define AUDIO_MAX_VOICES 32
|
||||
#define AUDIO_MAX_SAMPLES 16
|
||||
#define AUDIO_MAX_PATCHES 128
|
||||
#define AUDIO_MAX_PATTERNS 256
|
||||
#define AUDIO_MAX_ORDERS 256
|
||||
#define AUDIO_MAX_NOTES 96
|
||||
#define AUDIO_MAX_POINTS 12
|
||||
#define AUDIO_MIN_PERIOD 1
|
||||
#define AUDIO_MAX_PERIOD 31999
|
||||
#define AUDIO_MIN_VOLUME 0x00
|
||||
#define AUDIO_MAX_VOLUME 0x40
|
||||
#define AUDIO_MIN_PANNING 0x00
|
||||
#define AUDIO_MAX_PANNING 0xFF
|
||||
#define AUDIO_MIN_POSITION 0x00000000L
|
||||
#define AUDIO_MAX_POSITION 0x00100000L
|
||||
#define AUDIO_MIN_FREQUENCY 0x00000200L
|
||||
#define AUDIO_MAX_FREQUENCY 0x00080000L
|
||||
|
||||
/* audio error code defines */
|
||||
#define AUDIO_ERROR_NONE 0x0000
|
||||
#define AUDIO_ERROR_INVALHANDLE 0x0001
|
||||
#define AUDIO_ERROR_INVALPARAM 0x0002
|
||||
#define AUDIO_ERROR_NOTSUPPORTED 0x0003
|
||||
#define AUDIO_ERROR_BADDEVICEID 0x0004
|
||||
#define AUDIO_ERROR_NODEVICE 0x0005
|
||||
#define AUDIO_ERROR_DEVICEBUSY 0x0006
|
||||
#define AUDIO_ERROR_BADFORMAT 0x0007
|
||||
#define AUDIO_ERROR_NOMEMORY 0x0008
|
||||
#define AUDIO_ERROR_NODRAMMEMORY 0x0009
|
||||
#define AUDIO_ERROR_FILENOTFOUND 0x000A
|
||||
#define AUDIO_ERROR_BADFILEFORMAT 0x000B
|
||||
#define AUDIO_LAST_ERROR 0x000B
|
||||
|
||||
/* audio device identifiers */
|
||||
#define AUDIO_DEVICE_NONE 0x0000
|
||||
#define AUDIO_DEVICE_MAPPER 0xFFFF
|
||||
|
||||
/* audio product identifiers */
|
||||
#define AUDIO_PRODUCT_NONE 0x0000
|
||||
#define AUDIO_PRODUCT_SB 0x0001
|
||||
#define AUDIO_PRODUCT_SB15 0x0002
|
||||
#define AUDIO_PRODUCT_SB20 0x0003
|
||||
#define AUDIO_PRODUCT_SBPRO 0x0004
|
||||
#define AUDIO_PRODUCT_SB16 0x0005
|
||||
#define AUDIO_PRODUCT_AWE32 0x0006
|
||||
#define AUDIO_PRODUCT_WSS 0x0007
|
||||
#define AUDIO_PRODUCT_ESS 0x0008
|
||||
#define AUDIO_PRODUCT_GUS 0x0009
|
||||
#define AUDIO_PRODUCT_GUSDB 0x000A
|
||||
#define AUDIO_PRODUCT_GUSMAX 0x000B
|
||||
#define AUDIO_PRODUCT_IWAVE 0x000C
|
||||
#define AUDIO_PRODUCT_PAS 0x000D
|
||||
#define AUDIO_PRODUCT_PAS16 0x000E
|
||||
#define AUDIO_PRODUCT_ARIA 0x000F
|
||||
#define AUDIO_PRODUCT_WINDOWS 0x0100
|
||||
#define AUDIO_PRODUCT_LINUX 0x0101
|
||||
#define AUDIO_PRODUCT_SPARC 0x0102
|
||||
#define AUDIO_PRODUCT_SGI 0x0103
|
||||
#define AUDIO_PRODUCT_DSOUND 0x0104
|
||||
#define AUDIO_PRODUCT_OS2MMPM 0x0105
|
||||
#define AUDIO_PRODUCT_OS2DART 0x0106
|
||||
#define AUDIO_PRODUCT_BEOSR3 0x0107
|
||||
#define AUDIO_PRODUCT_BEOS 0x0108
|
||||
#define AUDIO_PRODUCT_QNX 0x0109
|
||||
|
||||
/* audio mixer channels */
|
||||
#define AUDIO_MIXER_MASTER_VOLUME 0x0001
|
||||
#define AUDIO_MIXER_TREBLE 0x0002
|
||||
#define AUDIO_MIXER_BASS 0x0003
|
||||
#define AUDIO_MIXER_CHORUS 0x0004
|
||||
#define AUDIO_MIXER_REVERB 0x0005
|
||||
|
||||
/* audio envelope bit fields */
|
||||
#define AUDIO_ENVELOPE_ON 0x0001
|
||||
#define AUDIO_ENVELOPE_SUSTAIN 0x0002
|
||||
#define AUDIO_ENVELOPE_LOOP 0x0004
|
||||
|
||||
/* audio pattern bit fields */
|
||||
#define AUDIO_PATTERN_PACKED 0x0080
|
||||
#define AUDIO_PATTERN_NOTE 0x0001
|
||||
#define AUDIO_PATTERN_SAMPLE 0x0002
|
||||
#define AUDIO_PATTERN_VOLUME 0x0004
|
||||
#define AUDIO_PATTERN_COMMAND 0x0008
|
||||
#define AUDIO_PATTERN_PARAMS 0x0010
|
||||
|
||||
/* audio module bit fields */
|
||||
#define AUDIO_MODULE_AMIGA 0x0000
|
||||
#define AUDIO_MODULE_LINEAR 0x0001
|
||||
#define AUDIO_MODULE_PANNING 0x8000
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* audio capabilities structure */
|
||||
typedef struct {
|
||||
WORD wProductId; /* product identifier */
|
||||
CHAR szProductName[30]; /* product name */
|
||||
DWORD dwFormats; /* formats supported */
|
||||
} AUDIOCAPS, *LPAUDIOCAPS;
|
||||
|
||||
/* audio format structure */
|
||||
typedef struct {
|
||||
UINT nDeviceId; /* device identifier */
|
||||
WORD wFormat; /* playback format */
|
||||
WORD nSampleRate; /* sampling frequency */
|
||||
} AUDIOINFO, *LPAUDIOINFO;
|
||||
|
||||
/* audio waveform structure */
|
||||
typedef struct {
|
||||
LPBYTE lpData; /* data pointer */
|
||||
DWORD dwHandle; /* waveform handle */
|
||||
DWORD dwLength; /* waveform length */
|
||||
DWORD dwLoopStart; /* loop start point */
|
||||
DWORD dwLoopEnd; /* loop end point */
|
||||
WORD nSampleRate; /* sampling rate */
|
||||
WORD wFormat; /* format bits */
|
||||
} AUDIOWAVE, *LPAUDIOWAVE;
|
||||
|
||||
|
||||
/* audio envelope point structure */
|
||||
typedef struct {
|
||||
WORD nFrame; /* envelope frame */
|
||||
WORD nValue; /* envelope value */
|
||||
} AUDIOPOINT, *LPAUDIOPOINT;
|
||||
|
||||
/* audio envelope structure */
|
||||
typedef struct {
|
||||
AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */
|
||||
BYTE nPoints; /* number of points */
|
||||
BYTE nSustain; /* sustain point */
|
||||
BYTE nLoopStart; /* loop start point */
|
||||
BYTE nLoopEnd; /* loop end point */
|
||||
WORD wFlags; /* envelope flags */
|
||||
WORD nSpeed; /* envelope speed */
|
||||
} AUDIOENVELOPE, *LPAUDIOENVELOPE;
|
||||
|
||||
/* audio sample structure */
|
||||
typedef struct {
|
||||
CHAR szSampleName[32]; /* sample name */
|
||||
BYTE nVolume; /* default volume */
|
||||
BYTE nPanning; /* default panning */
|
||||
BYTE nRelativeNote; /* relative note */
|
||||
BYTE nFinetune; /* finetune */
|
||||
AUDIOWAVE Wave; /* waveform handle */
|
||||
} AUDIOSAMPLE, *LPAUDIOSAMPLE;
|
||||
|
||||
/* audio patch structure */
|
||||
typedef struct {
|
||||
CHAR szPatchName[32]; /* patch name */
|
||||
BYTE aSampleNumber[AUDIO_MAX_NOTES]; /* multi-sample table */
|
||||
WORD nSamples; /* number of samples */
|
||||
BYTE nVibratoType; /* vibrato type */
|
||||
BYTE nVibratoSweep; /* vibrato sweep */
|
||||
BYTE nVibratoDepth; /* vibrato depth */
|
||||
BYTE nVibratoRate; /* vibrato rate */
|
||||
WORD nVolumeFadeout; /* volume fadeout */
|
||||
AUDIOENVELOPE Volume; /* volume envelope */
|
||||
AUDIOENVELOPE Panning; /* panning envelope */
|
||||
LPAUDIOSAMPLE aSampleTable; /* sample table */
|
||||
} AUDIOPATCH, *LPAUDIOPATCH;
|
||||
|
||||
/* audio pattern structure */
|
||||
typedef struct {
|
||||
WORD nPacking; /* packing type */
|
||||
WORD nTracks; /* number of tracks */
|
||||
WORD nRows; /* number of rows */
|
||||
WORD nSize; /* data size */
|
||||
LPBYTE lpData; /* data pointer */
|
||||
} AUDIOPATTERN, *LPAUDIOPATTERN;
|
||||
|
||||
/* audio module structure */
|
||||
typedef struct {
|
||||
CHAR szModuleName[32]; /* module name */
|
||||
WORD wFlags; /* module flags */
|
||||
WORD nOrders; /* number of orders */
|
||||
WORD nRestart; /* restart position */
|
||||
WORD nTracks; /* number of tracks */
|
||||
WORD nPatterns; /* number of patterns */
|
||||
WORD nPatches; /* number of patches */
|
||||
WORD nTempo; /* initial tempo */
|
||||
WORD nBPM; /* initial BPM */
|
||||
BYTE aOrderTable[AUDIO_MAX_ORDERS]; /* order table */
|
||||
BYTE aPanningTable[AUDIO_MAX_VOICES]; /* panning table */
|
||||
LPAUDIOPATTERN aPatternTable; /* pattern table */
|
||||
LPAUDIOPATCH aPatchTable; /* patch table */
|
||||
} AUDIOMODULE, *LPAUDIOMODULE;
|
||||
|
||||
/* audio music track structure */
|
||||
typedef struct {
|
||||
BYTE nNote; /* note index */
|
||||
BYTE nPatch; /* patch number */
|
||||
BYTE nSample; /* sample number */
|
||||
BYTE nCommand; /* effect command */
|
||||
BYTE bParams; /* effect params */
|
||||
BYTE nVolumeCmd; /* volume command */
|
||||
BYTE nVolume; /* volume level */
|
||||
BYTE nPanning; /* stereo panning */
|
||||
LONG dwFrequency; /* note frequency */
|
||||
WORD wPeriod; /* note period */
|
||||
} AUDIOTRACK, *LPAUDIOTRACK;
|
||||
|
||||
/* audio callback function defines */
|
||||
typedef VOID (AIAPI* LPFNAUDIOWAVE)(LPBYTE, UINT);
|
||||
typedef VOID (AIAPI* LPFNAUDIOTIMER)();
|
||||
typedef VOID (AIAPI* LPFNAUDIOCALLBACK)(BYTE, UINT, UINT);
|
||||
|
||||
/* audio handle defines */
|
||||
typedef HANDLE HAC;
|
||||
typedef HAC* LPHAC;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* audio interface API prototypes */
|
||||
UINT AIAPI AInitialize();
|
||||
UINT AIAPI AGetVersion();
|
||||
UINT AIAPI AGetAudioNumDevs();
|
||||
UINT AIAPI AGetAudioDevCaps(UINT nDeviceId, LPAUDIOCAPS lpCaps);
|
||||
UINT AIAPI AGetErrorText(UINT nErrorCode, LPSTR lpText, UINT nSize);
|
||||
|
||||
UINT AIAPI APingAudio(LPUINT lpnDeviceId);
|
||||
UINT AIAPI AOpenAudio(LPAUDIOINFO lpInfo);
|
||||
UINT AIAPI ACloseAudio();
|
||||
UINT AIAPI AUpdateAudio();
|
||||
UINT AIAPI AUpdateAudioEx(UINT nFrames);
|
||||
|
||||
UINT AIAPI ASetAudioMixerValue(UINT nChannel, UINT nValue);
|
||||
|
||||
UINT AIAPI AOpenVoices(UINT nVoices);
|
||||
UINT AIAPI ACloseVoices();
|
||||
|
||||
UINT AIAPI ASetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave);
|
||||
UINT AIAPI ASetAudioTimerProc(LPFNAUDIOTIMER lpfnAudioTimer);
|
||||
UINT AIAPI ASetAudioTimerRate(UINT nTimerRate);
|
||||
|
||||
LONG AIAPI AGetAudioDataAvail();
|
||||
UINT AIAPI ACreateAudioData(LPAUDIOWAVE lpWave);
|
||||
UINT AIAPI ADestroyAudioData(LPAUDIOWAVE lpWave);
|
||||
UINT AIAPI AWriteAudioData(LPAUDIOWAVE lpWave, DWORD dwOffset, UINT nCount);
|
||||
|
||||
UINT AIAPI ACreateAudioVoice(LPHAC lphVoice);
|
||||
UINT AIAPI ADestroyAudioVoice(HAC hVoice);
|
||||
|
||||
UINT AIAPI APlayVoice(HAC hVoice, LPAUDIOWAVE lpWave);
|
||||
UINT AIAPI APrimeVoice(HAC hVoice, LPAUDIOWAVE lpWave);
|
||||
UINT AIAPI AStartVoice(HAC hVoice);
|
||||
UINT AIAPI AStopVoice(HAC hVoice);
|
||||
|
||||
UINT AIAPI ASetVoicePosition(HAC hVoice, LONG dwPosition);
|
||||
UINT AIAPI ASetVoiceFrequency(HAC hVoice, LONG dwFrequency);
|
||||
UINT AIAPI ASetVoiceVolume(HAC hVoice, UINT nVolume);
|
||||
UINT AIAPI ASetVoicePanning(HAC hVoice, UINT nPanning);
|
||||
|
||||
UINT AIAPI AGetVoicePosition(HAC hVoice, LPLONG lpdwPosition);
|
||||
UINT AIAPI AGetVoiceFrequency(HAC hVoice, LPLONG lpdwFrequency);
|
||||
UINT AIAPI AGetVoiceVolume(HAC hVoice, LPUINT lpnVolume);
|
||||
UINT AIAPI AGetVoicePanning(HAC hVoice, LPUINT lpnPanning);
|
||||
UINT AIAPI AGetVoiceStatus(HAC hVoice, LPBOOL lpnStatus);
|
||||
|
||||
UINT AIAPI APlayModule(LPAUDIOMODULE lpModule);
|
||||
UINT AIAPI AStopModule();
|
||||
UINT AIAPI APauseModule();
|
||||
UINT AIAPI AResumeModule();
|
||||
UINT AIAPI ASetModuleVolume(UINT nVolume);
|
||||
UINT AIAPI ASetModulePosition(UINT nOrder, UINT nRow);
|
||||
UINT AIAPI AGetModuleVolume(LPUINT lpnVolume);
|
||||
UINT AIAPI AGetModulePosition(LPUINT pnOrder, LPUINT lpnRow);
|
||||
UINT AIAPI AGetModuleStatus(LPBOOL lpnStatus);
|
||||
UINT AIAPI ASetModuleCallback(LPFNAUDIOCALLBACK lpfnAudioCallback);
|
||||
|
||||
UINT AIAPI ALoadModuleFile(LPSTR lpszFileName,
|
||||
LPAUDIOMODULE* lplpModule, DWORD dwFileOffset);
|
||||
UINT AIAPI AFreeModuleFile(LPAUDIOMODULE lpModule);
|
||||
|
||||
UINT AIAPI ALoadWaveFile(LPSTR lpszFileName,
|
||||
LPAUDIOWAVE* lplpWave, DWORD dwFileOffset);
|
||||
UINT AIAPI AFreeWaveFile(LPAUDIOWAVE lpWave);
|
||||
|
||||
UINT AIAPI AGetModuleTrack(UINT nTrack, LPAUDIOTRACK lpTrack);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,950 +0,0 @@
|
||||
{*
|
||||
* $Id: audio.h 1.16 1996/09/25 13:09:09 chasan released $
|
||||
*
|
||||
* SEAL Synthetic Audio Library API Interface
|
||||
*
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*}
|
||||
|
||||
unit Audio;
|
||||
|
||||
interface
|
||||
uses
|
||||
SysUtils, Windows;
|
||||
|
||||
const
|
||||
{ audio system version number }
|
||||
AUDIO_SYSTEM_VERSION = $0101;
|
||||
|
||||
{ audio capabilities bit fields definitions }
|
||||
AUDIO_FORMAT_1M08 = $00000001;
|
||||
AUDIO_FORMAT_1S08 = $00000002;
|
||||
AUDIO_FORMAT_1M16 = $00000004;
|
||||
AUDIO_FORMAT_1S16 = $00000008;
|
||||
AUDIO_FORMAT_2M08 = $00000010;
|
||||
AUDIO_FORMAT_2S08 = $00000020;
|
||||
AUDIO_FORMAT_2M16 = $00000040;
|
||||
AUDIO_FORMAT_2S16 = $00000080;
|
||||
AUDIO_FORMAT_4M08 = $00000100;
|
||||
AUDIO_FORMAT_4S08 = $00000200;
|
||||
AUDIO_FORMAT_4M16 = $00000400;
|
||||
AUDIO_FORMAT_4S16 = $00000800;
|
||||
|
||||
{ audio format bit fields defines for devices and waveforms }
|
||||
AUDIO_FORMAT_8BITS = $0000;
|
||||
AUDIO_FORMAT_16BITS = $0001;
|
||||
AUDIO_FORMAT_LOOP = $0010;
|
||||
AUDIO_FORMAT_BIDILOOP = $0020;
|
||||
AUDIO_FORMAT_REVERSE = $0080;
|
||||
AUDIO_FORMAT_MONO = $0000;
|
||||
AUDIO_FORMAT_STEREO = $0100;
|
||||
AUDIO_FORMAT_FILTER = $8000;
|
||||
|
||||
{ audio resource limits defines }
|
||||
AUDIO_MAX_VOICES = 32;
|
||||
AUDIO_MAX_SAMPLES = 16;
|
||||
AUDIO_MAX_PATCHES = 128;
|
||||
AUDIO_MAX_PATTERNS = 256;
|
||||
AUDIO_MAX_ORDERS = 256;
|
||||
AUDIO_MAX_NOTES = 96;
|
||||
AUDIO_MAX_POINTS = 12;
|
||||
AUDIO_MIN_PERIOD = 1;
|
||||
AUDIO_MAX_PERIOD = 31999;
|
||||
AUDIO_MIN_VOLUME = $00;
|
||||
AUDIO_MAX_VOLUME = $40;
|
||||
AUDIO_MIN_PANNING = $00;
|
||||
AUDIO_MAX_PANNING = $FF;
|
||||
AUDIO_MIN_POSITION = $00000000;
|
||||
AUDIO_MAX_POSITION = $00100000;
|
||||
AUDIO_MIN_FREQUENCY = $00000200;
|
||||
AUDIO_MAX_FREQUENCY = $00080000;
|
||||
|
||||
{ audio error code defines }
|
||||
AUDIO_ERROR_NONE = $0000;
|
||||
AUDIO_ERROR_INVALHANDLE = $0001;
|
||||
AUDIO_ERROR_INVALPARAM = $0002;
|
||||
AUDIO_ERROR_NOTSUPPORTED = $0003;
|
||||
AUDIO_ERROR_BADDEVICEID = $0004;
|
||||
AUDIO_ERROR_NODEVICE = $0005;
|
||||
AUDIO_ERROR_DEVICEBUSY = $0006;
|
||||
AUDIO_ERROR_BADFORMAT = $0007;
|
||||
AUDIO_ERROR_NOMEMORY = $0008;
|
||||
AUDIO_ERROR_NODRAMMEMORY = $0009;
|
||||
AUDIO_ERROR_FILENOTFOUND = $000A;
|
||||
AUDIO_ERROR_BADFILEFORMAT = $000B;
|
||||
AUDIO_LAST_ERROR = $000B;
|
||||
|
||||
{ audio device identifiers }
|
||||
AUDIO_DEVICE_NONE = $0000;
|
||||
AUDIO_DEVICE_MAPPER = $FFFF;
|
||||
|
||||
{ audio product identifiers }
|
||||
AUDIO_PRODUCT_NONE = $0000;
|
||||
AUDIO_PRODUCT_SB = $0001;
|
||||
AUDIO_PRODUCT_SB15 = $0002;
|
||||
AUDIO_PRODUCT_SB20 = $0003;
|
||||
AUDIO_PRODUCT_SBPRO = $0004;
|
||||
AUDIO_PRODUCT_SB16 = $0005;
|
||||
AUDIO_PRODUCT_AWE32 = $0006;
|
||||
AUDIO_PRODUCT_WSS = $0007;
|
||||
AUDIO_PRODUCT_ESS = $0008;
|
||||
AUDIO_PRODUCT_GUS = $0009;
|
||||
AUDIO_PRODUCT_GUSDB = $000A;
|
||||
AUDIO_PRODUCT_GUSMAX = $000B;
|
||||
AUDIO_PRODUCT_IWAVE = $000C;
|
||||
AUDIO_PRODUCT_PAS = $000D;
|
||||
AUDIO_PRODUCT_PAS16 = $000E;
|
||||
AUDIO_PRODUCT_ARIA = $000F;
|
||||
AUDIO_PRODUCT_WINDOWS = $0100;
|
||||
AUDIO_PRODUCT_LINUX = $0101;
|
||||
AUDIO_PRODUCT_SPARC = $0102;
|
||||
AUDIO_PRODUCT_SGI = $0103;
|
||||
AUDIO_PRODUCT_DSOUND = $0104;
|
||||
|
||||
{ audio envelope bit fields }
|
||||
AUDIO_ENVELOPE_ON = $0001;
|
||||
AUDIO_ENVELOPE_SUSTAIN = $0002;
|
||||
AUDIO_ENVELOPE_LOOP = $0004;
|
||||
|
||||
{ audio pattern bit fields }
|
||||
AUDIO_PATTERN_PACKED = $0080;
|
||||
AUDIO_PATTERN_NOTE = $0001;
|
||||
AUDIO_PATTERN_SAMPLE = $0002;
|
||||
AUDIO_PATTERN_VOLUME = $0004;
|
||||
AUDIO_PATTERN_COMMAND = $0008;
|
||||
AUDIO_PATTERN_PARAMS = $0010;
|
||||
|
||||
{ audio module bit fields }
|
||||
AUDIO_MODULE_AMIGA = $0000;
|
||||
AUDIO_MODULE_LINEAR = $0001;
|
||||
AUDIO_MODULE_PANNING = $8000;
|
||||
|
||||
type
|
||||
{ audio capabilities structure }
|
||||
PAudioCaps = ^TAudioCaps;
|
||||
TAudioCaps = record
|
||||
wProductId : Word; { product identifier }
|
||||
szProductName : Array [0..29] of Char; { product name }
|
||||
dwFormats : Longint; { formats supported }
|
||||
end;
|
||||
|
||||
{ audio format structure }
|
||||
PAudioInfo = ^TAudioInfo;
|
||||
TAudioInfo = record
|
||||
nDeviceId : Integer; { device identifier }
|
||||
wFormat : Word; { playback format }
|
||||
nSampleRate : Word; { sampling rate }
|
||||
end;
|
||||
|
||||
{ audio waveform structure }
|
||||
PAudioWave = ^TAudioWave;
|
||||
TAudioWave = record
|
||||
pData : Pointer; { data pointer }
|
||||
dwHandle : Longint; { waveform handle }
|
||||
dwLength : Longint; { waveform length }
|
||||
dwLoopStart : Longint; { loop start point }
|
||||
dwLoopEnd : Longint; { loop end point }
|
||||
nSampleRate : Word; { sampling rate }
|
||||
wFormat : Word; { format bits }
|
||||
end;
|
||||
|
||||
|
||||
{ audio envelope point structure }
|
||||
PAudioPoint = ^TAudioPoint;
|
||||
TAudioPoint = record
|
||||
nFrame : Word; { envelope frame }
|
||||
nValue : Word; { envelope value }
|
||||
end;
|
||||
|
||||
{ audio envelope structure }
|
||||
PAudioEnvelope = ^TAudioEnvelope;
|
||||
TAudioEnvelope = record
|
||||
aEnvelope : Array [1..AUDIO_MAX_POINTS] of TAudioPoint; { envelope points }
|
||||
nPoints : Byte; { number of points }
|
||||
nSustain : Byte; { sustain point }
|
||||
nLoopStart : Byte; { loop start point }
|
||||
nLoopEnd : Byte; { loop end point }
|
||||
wFlags : Word; { envelope flags }
|
||||
nSpeed : Word; { envelope speed }
|
||||
end;
|
||||
|
||||
{ audio sample structure }
|
||||
PAudioSample = ^TAudioSample;
|
||||
TAudioSample = record
|
||||
szSampleName : Array [0..31] of Char; { sample name }
|
||||
nVolume : Byte; { default volume }
|
||||
nPanning : Byte; { default panning }
|
||||
nRelativeNote : Byte; { relative note }
|
||||
nFinetune : Byte; { finetune }
|
||||
Wave : TAudioWave; { waveform handle }
|
||||
end;
|
||||
|
||||
{ audio patch structure }
|
||||
PAudioPatch = ^TAudioPatch;
|
||||
TAudioPatch = record
|
||||
szPatchName : Array [0..31] of Char; { patch name }
|
||||
aSampleNumber : Array [1..AUDIO_MAX_NOTES] of Byte; { multi-sample table }
|
||||
nSamples : Word; { number of samples }
|
||||
nVibratoType : Byte; { vibrato type }
|
||||
nVibratoSweep : Byte; { vibrato sweep }
|
||||
nVibratoDepth : Byte; { vibrato depth }
|
||||
nVibratoRate : Byte; { vibrato rate }
|
||||
nVolumeFadeout : Word; { volume fadeout }
|
||||
Volume : TAudioEnvelope; { volume envelope }
|
||||
Panning : TAudioEnvelope; { panning envelope }
|
||||
aSampleTable : PAudioSample; { sample table }
|
||||
end;
|
||||
|
||||
{ audio pattern structure }
|
||||
PAudioPattern = ^TAudioPattern;
|
||||
TAudioPattern = record
|
||||
nPacking : Word; { packing type }
|
||||
nTracks : Word; { number of tracks }
|
||||
nRows : Word; { number of rows }
|
||||
nSize : Word; { data size }
|
||||
pData : Pointer; { data pointer }
|
||||
end;
|
||||
|
||||
{ audio module structure }
|
||||
PAudioModule = ^TAudioModule;
|
||||
TAudioModule = record
|
||||
szModuleName : Array [0..31] of Char; { module name }
|
||||
wFlags : Word; { module flags }
|
||||
nOrders : Word; { number of orders }
|
||||
nRestart : Word; { restart position }
|
||||
nTracks : Word; { number of tracks }
|
||||
nPatterns : Word; { number of patterns }
|
||||
nPatches : Word; { number of patches }
|
||||
nTempo : Word; { initial tempo }
|
||||
nBPM : Word; { initial BPM }
|
||||
aOrderTable : Array [1..AUDIO_MAX_ORDERS] of Byte; { order table }
|
||||
aPanningTable : Array [1..AUDIO_MAX_VOICES] of Byte; { panning table }
|
||||
aPatternTable : PAudioPattern; { pattern table }
|
||||
aPatchTable : PAudioPatch; { patch table }
|
||||
end;
|
||||
|
||||
{ audio callback function defines }
|
||||
TAudioWaveProc = procedure (pData: Pointer; nCount: Integer); stdcall;
|
||||
TAudioTimerProc = procedure; stdcall;
|
||||
TAudioCallback = procedure(nSyncMark: Byte; nOrder, nRow: Integer); stdcall;
|
||||
|
||||
{ audio handle defines }
|
||||
PHAC = ^HAC;
|
||||
HAC = Integer;
|
||||
|
||||
|
||||
{ audio interface API prototypes }
|
||||
function AInitialize: Integer; stdcall;
|
||||
function AGetVersion: Integer; stdcall;
|
||||
function AGetAudioNumDevs: Integer; stdcall;
|
||||
function AGetAudioDevCaps(nDeviceId: Integer; var pCaps: TAudioCaps): Integer; stdcall;
|
||||
function AGetErrorText(nErrorCode: Integer; pText: PChar; nSize: Integer): Integer; stdcall;
|
||||
|
||||
function APingAudio(var pnDeviceId: Integer): Integer; stdcall;
|
||||
function AOpenAudio(var pInfo: TAudioInfo): Integer; stdcall;
|
||||
function ACloseAudio: Integer; stdcall;
|
||||
function AUpdateAudio: Integer; stdcall;
|
||||
|
||||
function AOpenVoices(nVoices: Integer): Integer; stdcall;
|
||||
function ACloseVoices: Integer; stdcall;
|
||||
|
||||
function ASetAudioCallback(pfnWaveProc: TAudioWaveProc): Integer; stdcall;
|
||||
function ASetAudioTimerProc(pfnTimerProc: TAudioTimerProc): Integer; stdcall;
|
||||
function ASetAudioTimerRate(nTimerRate: Integer): Integer; stdcall;
|
||||
|
||||
function AGetAudioDataAvail: Longint; stdcall;
|
||||
function ACreateAudioData(pWave: PAudioWave): Integer; stdcall;
|
||||
function ADestroyAudioData(pWave: PAudioWave): Integer; stdcall;
|
||||
function AWriteAudioData(pWave: PAudioWave; dwOffset: Longint; nCount: Integer): Integer; stdcall;
|
||||
|
||||
function ACreateAudioVoice(var phVoice: HAC): Integer; stdcall;
|
||||
function ADestroyAudioVoice(hVoice: HAC): Integer; stdcall;
|
||||
|
||||
function APlayVoice(hVoice: HAC; pWave: PAudioWave): Integer; stdcall;
|
||||
function APrimeVoice(hVoice: HAC; pWave: PAudioWave): Integer; stdcall;
|
||||
function AStartVoice(hVoice: HAC): Integer; stdcall;
|
||||
function AStopVoice(hVoice: HAC): Integer; stdcall;
|
||||
|
||||
function ASetVoicePosition(hVoice: HAC; dwPosition: Longint): Integer; stdcall;
|
||||
function ASetVoiceFrequency(hVoice: HAC; dwFrequency: Longint): Integer; stdcall;
|
||||
function ASetVoiceVolume(hVoice: HAC; nVolume: Integer): Integer; stdcall;
|
||||
function ASetVoicePanning(hVoice: HAC; nPanning: Integer): Integer; stdcall;
|
||||
|
||||
function AGetVoicePosition(hVoice: HAC; var pdwPosition: Longint): Integer; stdcall;
|
||||
function AGetVoiceFrequency(hVoice: HAC; var pdwFrequency: Longint): Integer; stdcall;
|
||||
function AGetVoiceVolume(hVoice: HAC; var pnVolume: Integer): Integer; stdcall;
|
||||
function AGetVoicePanning(hVoice: HAC; var pnPanning: Integer): Integer; stdcall;
|
||||
function AGetVoiceStatus(hVoice: HAC; var pnStatus: Integer): Integer; stdcall;
|
||||
|
||||
function APlayModule(pModule: PAudioModule): Integer; stdcall;
|
||||
function AStopModule: Integer; stdcall;
|
||||
function APauseModule: Integer; stdcall;
|
||||
function AResumeModule: Integer; stdcall;
|
||||
function ASetModuleVolume(nVolume: Integer): Integer; stdcall;
|
||||
function ASetModulePosition(nOrder, nRow: Integer): Integer; stdcall;
|
||||
function AGetModuleVolume(var pnVolume: Integer): Integer; stdcall;
|
||||
function AGetModulePosition(var pnOrder, pnRow: Integer): Integer; stdcall;
|
||||
function AGetModuleStatus(var pnStatus: Integer): Integer; stdcall;
|
||||
function ASetModuleCallback(pfnAudioCallback: TAudioCallback): Integer; stdcall;
|
||||
|
||||
function ALoadModuleFile(pszFileName: PChar; var ppModule: PAudioModule; FileOffset: Longint): Integer; stdcall;
|
||||
function AFreeModuleFile(pModule: PAudioModule): Integer; stdcall;
|
||||
|
||||
function ALoadWaveFile(pszFileName: PChar; var ppWave: PAudioWave; FileOffset: Longint): Integer; stdcall;
|
||||
function AFreeWaveFile(pWave: PAudioWave): Integer; stdcall;
|
||||
|
||||
|
||||
type
|
||||
TAudio = class(TObject)
|
||||
constructor Create(Format: Word; SampleRate: Word);
|
||||
destructor Destroy; override;
|
||||
procedure Update;
|
||||
private
|
||||
FInfo: TAudioInfo;
|
||||
function GetProductId: Integer;
|
||||
function GetProductName: String;
|
||||
public
|
||||
property DeviceId: Integer read FInfo.nDeviceId;
|
||||
property ProductId: Integer read GetProductId;
|
||||
property ProductName: String read GetProductName;
|
||||
property Format: Word read FInfo.wFormat;
|
||||
property SampleRate: Word read FInfo.nSampleRate;
|
||||
end;
|
||||
|
||||
TWaveform = class(TObject)
|
||||
constructor Create(Format: Word; SampleRate: Word;
|
||||
Length, LoopStart, LoopEnd: Longint);
|
||||
constructor LoadFromFile(FileName: String);
|
||||
destructor Destroy; override;
|
||||
procedure Write(var Buffer; Count: Integer);
|
||||
private
|
||||
FHandle: TAudioWave;
|
||||
PHandle: PAudioWave;
|
||||
FVolume: Integer;
|
||||
FPanning: Integer;
|
||||
FPosition: Longint;
|
||||
function GetHandle: PAudioWave;
|
||||
procedure SetSampleRate(Value: Word);
|
||||
procedure SetVolume(Value: Integer);
|
||||
procedure SetPanning(Value: Integer);
|
||||
procedure SetPosition(Value: LongInt);
|
||||
public
|
||||
property Handle: PAudioWave read GetHandle;
|
||||
property Format: Word read FHandle.wFormat;
|
||||
property Length: Longint read FHandle.dwLength;
|
||||
property LoopStart: Longint read FHandle.dwLoopStart;
|
||||
property LoopEnd: Longint read FHandle.dwLoopEnd;
|
||||
property SampleRate: Word read FHandle.nSampleRate write SetSampleRate;
|
||||
property Volume: Integer read FVolume write SetVolume;
|
||||
property Panning: Integer read FPanning write SetPanning;
|
||||
property Position: Longint read FPosition write SetPosition;
|
||||
end;
|
||||
|
||||
TVoice = class(TObject)
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Prime(Wave: TWaveform);
|
||||
procedure Play(Wave: TWaveform);
|
||||
procedure Start;
|
||||
procedure Stop;
|
||||
private
|
||||
FHandle: HAC;
|
||||
FWave: TWaveform;
|
||||
function GetHandle: HAC;
|
||||
function GetWaveform: TWaveform;
|
||||
function GetPosition: Longint;
|
||||
procedure SetPosition(Value: Longint);
|
||||
function GetFrequency: Longint;
|
||||
procedure SetFrequency(Value: Longint);
|
||||
function GetVolume: Integer;
|
||||
procedure SetVolume(Value: Integer);
|
||||
function GetPanning: Integer;
|
||||
procedure SetPanning(Value: Integer);
|
||||
function GetStopped: Boolean;
|
||||
public
|
||||
property Handle: HAC read GetHandle;
|
||||
property Waveform: TWaveform read GetWaveform;
|
||||
property Position: Longint read GetPosition write SetPosition;
|
||||
property Frequency: Longint read GetFrequency write SetFrequency;
|
||||
property Volume: Integer read GetVolume write SetVolume;
|
||||
property Panning: Integer read GetPanning write SetPanning;
|
||||
property Stopped: Boolean read GetStopped;
|
||||
end;
|
||||
|
||||
TModule = class(TObject)
|
||||
constructor LoadFromFile(FileName: String);
|
||||
destructor Destroy; override;
|
||||
procedure Play;
|
||||
procedure Stop;
|
||||
procedure Pause;
|
||||
procedure Resume;
|
||||
private
|
||||
FHandle: PAudioModule;
|
||||
FCallback: TAudioCallback;
|
||||
function GetVolume: Integer;
|
||||
procedure SetVolume(Value: Integer);
|
||||
function GetOrder: Integer;
|
||||
procedure SetOrder(Value: Integer);
|
||||
function GetRow: Integer;
|
||||
procedure SetRow(Value: Integer);
|
||||
function GetStopped: Boolean;
|
||||
procedure SetCallback(Value: TAudioCallback);
|
||||
public
|
||||
property Handle: PAudioModule read FHandle;
|
||||
property Volume: Integer read GetVolume write SetVolume;
|
||||
property Order: Integer read GetOrder write SetOrder;
|
||||
property Row: Integer read GetRow write SetRow;
|
||||
property Stopped: Boolean read GetStopped;
|
||||
property OnSync: TAudioCallback read FCallback write SetCallback;
|
||||
private
|
||||
function GetName: String;
|
||||
function GetNumOrders: Integer;
|
||||
function GetNumTracks: Integer;
|
||||
function GetNumPatterns: Integer;
|
||||
function GetNumPatches: Integer;
|
||||
function GetPatch(Index: Integer): PAudioPatch;
|
||||
public
|
||||
property Name: String read GetName;
|
||||
property NumOrders: Integer read GetNumOrders;
|
||||
property NumTracks: Integer read GetNumTracks;
|
||||
property NumPatterns: Integer read GetNumPatterns;
|
||||
property NumPatches: Integer read GetNumPatches;
|
||||
property Patch[Index: Integer]: PAudioPatch read GetPatch;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
function AInitialize: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetVersion: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetAudioNumDevs: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetAudioDevCaps(nDeviceId: Integer; var pCaps: TAudioCaps): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetErrorText(nErrorCode: Integer; pText: PChar; nSize: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function APingAudio(var pnDeviceId: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AOpenAudio(var pInfo: TAudioInfo): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ACloseAudio: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AUpdateAudio: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function AOpenVoices(nVoices: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ACloseVoices: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function ASetAudioCallback(pfnWaveProc: TAudioWaveProc): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ASetAudioTimerProc(pfnTimerProc: TAudioTimerProc): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ASetAudioTimerRate(nTimerRate: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function AGetAudioDataAvail: Longint; stdcall; external 'AUDIOW32.DLL';
|
||||
function ACreateAudioData(pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ADestroyAudioData(pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AWriteAudioData(pWave: PAudioWave; dwOffset: Longint; nCount: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function ACreateAudioVoice(var phVoice: HAC): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ADestroyAudioVoice(hVoice: HAC): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function APlayVoice(hVoice: HAC; pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function APrimeVoice(hVoice: HAC; pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AStartVoice(hVoice: HAC): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AStopVoice(hVoice: HAC): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function ASetVoicePosition(hVoice: HAC; dwPosition: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ASetVoiceFrequency(hVoice: HAC; dwFrequency: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ASetVoiceVolume(hVoice: HAC; nVolume: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ASetVoicePanning(hVoice: HAC; nPanning: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function AGetVoicePosition(hVoice: HAC; var pdwPosition: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetVoiceFrequency(hVoice: HAC; var pdwFrequency: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetVoiceVolume(hVoice: HAC; var pnVolume: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetVoicePanning(hVoice: HAC; var pnPanning: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetVoiceStatus(hVoice: HAC; var pnStatus: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function APlayModule(pModule: PAudioModule): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AStopModule: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function APauseModule: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AResumeModule: Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ASetModuleVolume(nVolume: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ASetModulePosition(nOrder, nRow: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetModuleVolume(var pnVolume: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetModulePosition(var pnOrder, pnRow: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AGetModuleStatus(var pnStatus: Integer): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function ASetModuleCallback(pfnAudioCallback: TAudioCallback): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function ALoadModuleFile(pszFileName: PChar; var ppModule: PAudioModule; FileOffset: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AFreeModuleFile(pModule: PAudioModule): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
function ALoadWaveFile(pszFileName: PChar; var ppWave: PAudioWave; FileOffset: Longint): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
function AFreeWaveFile(pWave: PAudioWave): Integer; stdcall; external 'AUDIOW32.DLL';
|
||||
|
||||
|
||||
const
|
||||
Semaphore: LongBool = False;
|
||||
PlayingModule: PAudioModule = nil;
|
||||
|
||||
function SetPlayingModule(Value: PAudioModule): Boolean; pascal; assembler;
|
||||
asm
|
||||
mov eax,True
|
||||
xchg eax,Semaphore
|
||||
cmp eax,False
|
||||
jne @@1
|
||||
mov eax,PlayingModule
|
||||
test eax,eax
|
||||
jne @@0
|
||||
mov eax,Value
|
||||
mov PlayingModule,eax
|
||||
@@0:
|
||||
mov Semaphore,False
|
||||
@@1:
|
||||
push edx
|
||||
xor eax,eax
|
||||
mov edx,PlayingModule
|
||||
cmp edx,Value
|
||||
sete al
|
||||
pop edx
|
||||
end;
|
||||
|
||||
procedure Assert(Header: String; ErrorCode: Integer);
|
||||
var
|
||||
szText: Array [0..255] of Char;
|
||||
begin
|
||||
if ErrorCode <> AUDIO_ERROR_NONE then
|
||||
begin
|
||||
AGetErrorText(ErrorCode, szText, sizeof(szText) - 1);
|
||||
raise Exception.Create(Header + ': ' + StrPas(szText));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TAudio }
|
||||
constructor TAudio.Create(Format: Word; SampleRate: Word);
|
||||
begin
|
||||
inherited Create;
|
||||
FInfo.nDeviceId := AUDIO_DEVICE_MAPPER;
|
||||
FInfo.wFormat := Format;
|
||||
FInfo.nSampleRate := SampleRate;
|
||||
Assert('AOpenAudio', AOpenAudio(FInfo));
|
||||
Assert('AOpenVoices', AOpenVoices(32));
|
||||
end;
|
||||
|
||||
destructor TAudio.Destroy;
|
||||
begin
|
||||
Assert('ACloseVoices', ACloseVoices);
|
||||
Assert('ACloseAudio', ACloseAudio);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TAudio.Update;
|
||||
begin
|
||||
Assert('AUpdateAudio', AUpdateAudio);
|
||||
end;
|
||||
|
||||
function TAudio.GetProductId: Integer;
|
||||
var
|
||||
Caps: TAudioCaps;
|
||||
begin
|
||||
Assert('AGetAudioDevCaps', AGetAudioDevCaps(FInfo.nDeviceId, Caps));
|
||||
Result := Caps.wProductId;
|
||||
end;
|
||||
|
||||
function TAudio.GetProductName: String;
|
||||
var
|
||||
Caps: TAudioCaps;
|
||||
begin
|
||||
Assert('AGetAudioDevCaps', AGetAudioDevCaps(FInfo.nDeviceId, Caps));
|
||||
Result := StrPas(Caps.szProductName);
|
||||
end;
|
||||
|
||||
|
||||
{ TWaveform }
|
||||
constructor TWaveform.Create(Format: Word; SampleRate: Word;
|
||||
Length, LoopStart, LoopEnd: Longint);
|
||||
begin
|
||||
inherited Create;
|
||||
FPosition := 0;
|
||||
FVolume := 64;
|
||||
FPanning := 128;
|
||||
FHandle.wFormat := Format;
|
||||
FHandle.dwLength := Length;
|
||||
FHandle.dwLoopStart := LoopStart;
|
||||
FHandle.dwLoopEnd := LoopEnd;
|
||||
FHandle.nSampleRate := SampleRate;
|
||||
PHandle := nil;
|
||||
Assert('ACreateAudioData', ACreateAudioData(@FHandle));
|
||||
end;
|
||||
|
||||
constructor TWaveform.LoadFromFile(FileName: String);
|
||||
var
|
||||
szFileName: Array [0..255] of Char;
|
||||
begin
|
||||
inherited Create;
|
||||
FPosition := 0;
|
||||
FVolume := 64;
|
||||
FPanning := 128;
|
||||
FHandle.pData := nil;
|
||||
FHandle.wFormat := AUDIO_FORMAT_8BITS or AUDIO_FORMAT_MONO;
|
||||
FHandle.dwLength := 0;
|
||||
FHandle.dwLoopStart := 0;
|
||||
FHandle.dwLoopEnd := 0;
|
||||
FHandle.nSampleRate := 22050;
|
||||
Assert('ALoadWaveFile', ALoadWaveFile(StrPCopy(szFileName, FileName), PHandle, 0));
|
||||
if Assigned(PHandle) then
|
||||
FHandle := PHandle^;
|
||||
end;
|
||||
|
||||
destructor TWaveform.Destroy;
|
||||
begin
|
||||
if Assigned(PHandle) then
|
||||
begin
|
||||
Assert('AFreeWaveFile', AFreeWaveFile(PHandle));
|
||||
end
|
||||
else if Assigned(FHandle.pData) then
|
||||
begin
|
||||
Assert('ADestroyAudioData', ADestroyAudioData(@FHandle));
|
||||
end;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TWaveform.Write(var Buffer; Count: Integer);
|
||||
var
|
||||
Size: Integer;
|
||||
begin
|
||||
if Assigned(FHandle.pData) then
|
||||
begin
|
||||
while (Count > 0) and (FHandle.dwLength > 0) do
|
||||
begin
|
||||
Size := Count;
|
||||
if FPosition + Size > FHandle.dwLength then
|
||||
Size := FHandle.dwLength - FPosition;
|
||||
Move(Buffer, PChar(FHandle.pData)[FPosition], Size);
|
||||
Assert('AWriteAudioData', AWriteAudioData(@FHandle, FPosition, Size));
|
||||
Inc(FPosition, Size);
|
||||
if FPosition >= FHandle.dwLength then
|
||||
Dec(FPosition, FHandle.dwLength);
|
||||
Dec(Count, Size);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TWaveform.GetHandle: PAudioWave;
|
||||
begin
|
||||
Result := @FHandle;
|
||||
end;
|
||||
|
||||
procedure TWaveform.SetSampleRate(Value: Word);
|
||||
begin
|
||||
if (Value >= AUDIO_MIN_FREQUENCY) and (Value <= AUDIO_MAX_FREQUENCY) then
|
||||
FHandle.nSampleRate := Value;
|
||||
end;
|
||||
|
||||
procedure TWaveform.SetVolume(Value: Integer);
|
||||
begin
|
||||
if (Value >= AUDIO_MIN_VOLUME) and (Value <= AUDIO_MAX_VOLUME) then
|
||||
FVolume := Value;
|
||||
end;
|
||||
|
||||
procedure TWaveform.SetPanning(Value: Integer);
|
||||
begin
|
||||
if (Value >= AUDIO_MIN_PANNING) and (Value <= AUDIO_MAX_PANNING) then
|
||||
FPanning := Value;
|
||||
end;
|
||||
|
||||
procedure TWaveform.SetPosition(Value: LongInt);
|
||||
begin
|
||||
if (Value >= 0) and (Value < FHandle.dwLength) then
|
||||
FPosition := Value;
|
||||
end;
|
||||
|
||||
|
||||
{ TVoice}
|
||||
constructor TVoice.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FWave := nil;
|
||||
Assert('ACreateAudioVoice', ACreateAudioVoice(FHandle));
|
||||
end;
|
||||
|
||||
destructor TVoice.Destroy;
|
||||
begin
|
||||
if FHandle <> 0 then
|
||||
Assert('ADestroyAudioVoice', ADestroyAudioVoice(FHandle));
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TVoice.Prime(Wave: TWaveform);
|
||||
begin
|
||||
if Assigned(Wave) then
|
||||
begin
|
||||
FWave := Wave;
|
||||
Assert('APrimeVoice', APrimeVoice(FHandle, FWave.Handle));
|
||||
Assert('ASetVoiceFrequency', ASetVoiceFrequency(FHandle, FWave.SampleRate));
|
||||
Assert('ASetVoiceVolume', ASetVoiceVolume(FHandle, FWave.Volume));
|
||||
Assert('ASetVoicePanning', ASetVoicePanning(FHandle, FWave.Panning));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVoice.Play(Wave: TWaveform);
|
||||
begin
|
||||
if Assigned(Wave) then
|
||||
begin
|
||||
FWave := Wave;
|
||||
Assert('APrimeVoice', APrimeVoice(FHandle, FWave.Handle));
|
||||
Assert('ASetVoiceFrequency', ASetVoiceFrequency(FHandle, FWave.SampleRate));
|
||||
Assert('ASetVoiceVolume', ASetVoiceVolume(FHandle, FWave.Volume));
|
||||
Assert('ASetVoicePanning', ASetVoicePanning(FHandle, FWave.Panning));
|
||||
Assert('AStartVoice', AStartVoice(FHandle));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVoice.Start;
|
||||
begin
|
||||
Assert('AStartVoice', AStartVoice(FHandle));
|
||||
end;
|
||||
|
||||
procedure TVoice.Stop;
|
||||
begin
|
||||
Assert('AStopVoice', AStopVoice(FHandle));
|
||||
end;
|
||||
|
||||
function TVoice.GetHandle: HAC;
|
||||
begin
|
||||
Result := FHandle;
|
||||
end;
|
||||
|
||||
function TVoice.GetWaveform: TWaveform;
|
||||
begin
|
||||
Result := FWave;
|
||||
end;
|
||||
|
||||
function TVoice.GetPosition: Longint;
|
||||
var
|
||||
Value: Longint;
|
||||
begin
|
||||
Assert('AGetVoicePosition', AGetVoicePosition(FHandle, Value));
|
||||
Result := Value;
|
||||
end;
|
||||
|
||||
procedure TVoice.SetPosition(Value: Longint);
|
||||
begin
|
||||
Assert('ASetVoicePosition', ASetVoicePosition(FHandle, Value));
|
||||
end;
|
||||
|
||||
function TVoice.GetFrequency: Longint;
|
||||
var
|
||||
Value: Longint;
|
||||
begin
|
||||
Assert('AGetVoiceFrequency', AGetVoiceFrequency(FHandle, Value));
|
||||
Result := Value;
|
||||
end;
|
||||
|
||||
procedure TVoice.SetFrequency(Value: Longint);
|
||||
begin
|
||||
Assert('ASetVoiceFrequency', ASetVoiceFrequency(FHandle, Value));
|
||||
end;
|
||||
|
||||
function TVoice.GetVolume: Integer;
|
||||
var
|
||||
Value: Integer;
|
||||
begin
|
||||
Assert('AGetVoiceVolume', AGetVoiceVolume(FHandle, Value));
|
||||
Result := Value;
|
||||
end;
|
||||
|
||||
procedure TVoice.SetVolume(Value: Integer);
|
||||
begin
|
||||
Assert('ASetVoiceVolume', ASetVoiceVolume(FHandle, Value));
|
||||
end;
|
||||
|
||||
function TVoice.GetPanning: Integer;
|
||||
var
|
||||
Value: Integer;
|
||||
begin
|
||||
Assert('AGetVoicePanning', AGetVoicePanning(FHandle, Value));
|
||||
Result := Value;
|
||||
end;
|
||||
|
||||
procedure TVoice.SetPanning(Value: Integer);
|
||||
begin
|
||||
Assert('ASetVoicePanning', ASetVoicePanning(FHandle, Value));
|
||||
end;
|
||||
|
||||
function TVoice.GetStopped: Boolean;
|
||||
var
|
||||
Value: Integer;
|
||||
begin
|
||||
Assert('AGetVoiceStatus', AGetVoiceStatus(FHandle, Value));
|
||||
Result := Value <> 0;
|
||||
end;
|
||||
|
||||
|
||||
{ TModule }
|
||||
constructor TModule.LoadFromFile(FileName: String);
|
||||
var
|
||||
szFileName: Array [0..255] of Char;
|
||||
begin
|
||||
inherited Create;
|
||||
FHandle := nil;
|
||||
FCallback := nil;
|
||||
Assert('ALoadModuleFile', ALoadModuleFile(StrPCopy(szFileName, FileName), FHandle, 0));
|
||||
end;
|
||||
|
||||
destructor TModule.Destroy;
|
||||
begin
|
||||
if Assigned(FHandle) then
|
||||
begin
|
||||
if not Stopped then Stop;
|
||||
Assert('AFreeModuleFile', AFreeModuleFile(FHandle));
|
||||
end;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TModule.Play;
|
||||
begin
|
||||
if Assigned(FHandle) and SetPlayingModule(FHandle) then
|
||||
Assert('APlayModule', APlayModule(FHandle));
|
||||
end;
|
||||
|
||||
procedure TModule.Stop;
|
||||
begin
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
begin
|
||||
Assert('AStopModule', AStopModule);
|
||||
PlayingModule := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TModule.Pause;
|
||||
begin
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
Assert('APauseModule', APauseModule);
|
||||
end;
|
||||
|
||||
procedure TModule.Resume;
|
||||
begin
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
Assert('AResumeModule', AResumeModule);
|
||||
end;
|
||||
|
||||
function TModule.GetVolume: Integer;
|
||||
var
|
||||
Value: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
begin
|
||||
Assert('AGetModuleVolume', AGetModuleVolume(Value));
|
||||
Result := Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TModule.SetVolume(Value: Integer);
|
||||
begin
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
Assert('ASetModuleVolume', ASetModuleVolume(Value));
|
||||
end;
|
||||
|
||||
function TModule.GetOrder: Integer;
|
||||
var
|
||||
Order, Row: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
begin
|
||||
Assert('AGetModulePosition', AGetModulePosition(Order, Row));
|
||||
Result := Order;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TModule.SetOrder(Value: Integer);
|
||||
begin
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
Assert('ASetModulePosition', ASetModulePosition(Value, Row));
|
||||
end;
|
||||
|
||||
function TModule.GetRow: Integer;
|
||||
var
|
||||
Order, Row: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
begin
|
||||
Assert('AGetModulePosition', AGetModulePosition(Order, Row));
|
||||
Result := Row;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TModule.SetRow(Value: Integer);
|
||||
begin
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
Assert('ASetModulePosition', ASetModulePosition(Order, Value));
|
||||
end;
|
||||
|
||||
function TModule.GetStopped: Boolean;
|
||||
var
|
||||
Value: Integer;
|
||||
begin
|
||||
Result := True;
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
begin
|
||||
Assert('AGetModuleStatus', AGetModuleStatus(Value));
|
||||
Result := Value <> 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TModule.SetCallback(Value: TAudioCallback);
|
||||
begin
|
||||
if Assigned(FHandle) and (PlayingModule = FHandle) then
|
||||
begin
|
||||
FCallback := Value;
|
||||
Assert('ASetModuleCallback', ASetModuleCallback(Value));
|
||||
end;
|
||||
end;
|
||||
|
||||
function TModule.GetName: String;
|
||||
begin
|
||||
Result := '';
|
||||
if Assigned(FHandle) then
|
||||
Result := StrPas(FHandle^.szModuleName);
|
||||
end;
|
||||
|
||||
function TModule.GetNumOrders: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(FHandle) then
|
||||
Result := FHandle^.nOrders;
|
||||
end;
|
||||
|
||||
function TModule.GetNumTracks: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(FHandle) then
|
||||
Result := FHandle^.nTracks;
|
||||
end;
|
||||
|
||||
function TModule.GetNumPatterns: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(FHandle) then
|
||||
Result := FHandle^.nPatterns;
|
||||
end;
|
||||
|
||||
function TModule.GetNumPatches: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(FHandle) then
|
||||
Result := FHandle^.nPatches;
|
||||
end;
|
||||
|
||||
function TModule.GetPatch(Index: Integer): PAudioPatch;
|
||||
begin
|
||||
Result := nil;
|
||||
if Assigned(FHandle) then
|
||||
begin
|
||||
if (Index >= 1) and (Index <= FHandle^.nPatches) then
|
||||
Result := PAudioPatch(@PChar(FHandle^.aPatchTable)[sizeof(TAudioPatch) * Pred(Index)]);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@ -1,36 +0,0 @@
|
||||
# Makefile for BeOS Release 4 operating systems
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
AS = nasm
|
||||
CFLAGS = -c -O3 -Wall -Wno-multichar -D__ASM__ -D__FLAT__
|
||||
ARFLAGS = cr
|
||||
LIBS = -L../lib/BeOS/ -laudio -lroot -lbe -lmedia
|
||||
|
||||
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
iofile.o modeng.o nondrv.o mixdrv.o _mixdrv.o be3drv.o bedrv.o
|
||||
|
||||
LIB = ../lib/BeOS/libaudio.a
|
||||
|
||||
all : mp clean
|
||||
@echo done.
|
||||
|
||||
mp : mp.o $(LIB)
|
||||
$(CC) -o mp mp.o $(LIBS)
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
$(AR) $(ARFLAGS) $(LIB) $(OBJS)
|
||||
|
||||
.SUFFIXES: .c .cpp .h .obj
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.cpp.o:
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.o:
|
||||
$(AS) $<
|
||||
|
||||
clean :
|
||||
@rm -rf *.o
|
||||
@ -1,45 +0,0 @@
|
||||
/* audio_driver.h */
|
||||
/* Jon Watte 19971223 */
|
||||
/* Interface to drivers found in /dev/audio */
|
||||
/* Devices found in /dev/old follow a different API! */
|
||||
|
||||
#if !defined(_AUDIO_DRIVER_H)
|
||||
#define _AUDIO_DRIVER_H
|
||||
|
||||
#if !defined(_SUPPORT_DEFS_H)
|
||||
#include <SupportDefs.h>
|
||||
#endif /* _SUPPORT_DEFS_H */
|
||||
#if !defined(_DRIVERS_H)
|
||||
#include <Drivers.h>
|
||||
#endif /* _DRIVERS_H */
|
||||
|
||||
enum {
|
||||
/* arg = ptr to struct audio_format */
|
||||
B_AUDIO_GET_AUDIO_FORMAT = B_AUDIO_DRIVER_BASE,
|
||||
B_AUDIO_SET_AUDIO_FORMAT,
|
||||
/* arg = ptr to float[4] */
|
||||
B_AUDIO_GET_PREFERRED_SAMPLE_RATES
|
||||
};
|
||||
|
||||
/* this is the definition of what the audio driver can do for you */
|
||||
typedef struct audio_format {
|
||||
float sample_rate; /* ~4000 - ~48000, maybe more */
|
||||
int32 channels; /* 1 or 2 */
|
||||
int32 format; /* 0x11 (uchar), 0x2 (short) or 0x24 (float) */
|
||||
int32 big_endian; /* 0 for little endian, 1 for big endian */
|
||||
size_t buf_header; /* typically 0 or 16 */
|
||||
size_t play_buf_size; /* size of playback buffer (latency) */
|
||||
size_t rec_buf_size; /* size of record buffer (latency) */
|
||||
} audio_format;
|
||||
|
||||
/* when buffer header is in effect, this is what gets read before data */
|
||||
typedef struct audio_buf_header {
|
||||
bigtime_t capture_time;
|
||||
uint32 capture_size;
|
||||
float sample_rate;
|
||||
} audio_buf_header;
|
||||
|
||||
|
||||
|
||||
#endif /* _AUDIO_DRIVER_H */
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
/* audio_driver.h - BeOS Release 3 interface to sound drivers */
|
||||
|
||||
#ifndef _AUDIO_DRIVER_H_
|
||||
#define _AUDIO_DRIVER_H_
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
enum {
|
||||
B_AUDIO_GET_PARAMS = B_DEVICE_OP_CODES_END,
|
||||
B_AUDIO_SET_PARAMS,
|
||||
B_AUDIO_SET_PLAYBACK_COMPLETION_SEM,
|
||||
B_AUDIO_SET_CAPTURE_COMPLETION_SEM,
|
||||
B_AUDIO_RESERVED_1, /* unused */
|
||||
B_AUDIO_RESERVED_2, /* unused */
|
||||
B_AUDIO_DEBUG_ON, /* unused */
|
||||
B_AUDIO_DEBUG_OFF, /* unused */
|
||||
B_AUDIO_WRITE_BUFFER,
|
||||
B_AUDIO_READ_BUFFER,
|
||||
B_AUDIO_LOCK_FOR_DMA
|
||||
};
|
||||
|
||||
enum {
|
||||
B_AUDIO_ADC_SOURCE_LINE = 0,
|
||||
B_AUDIO_ADC_SOURCE_CDROM,
|
||||
B_AUDIO_ADC_SOURCE_MIC,
|
||||
B_AUDIO_ADC_SOURCE_LOOPBACK
|
||||
};
|
||||
|
||||
enum {
|
||||
B_AUDIO_SAMPLE_RATE_8000 = 0,
|
||||
B_AUDIO_SAMPLE_RATE_5510 = 1,
|
||||
B_AUDIO_SAMPLE_RATE_16000 = 2,
|
||||
B_AUDIO_SAMPLE_RATE_11025 = 3,
|
||||
B_AUDIO_SAMPLE_RATE_27420 = 4,
|
||||
B_AUDIO_SAMPLE_RATE_18900 = 5,
|
||||
B_AUDIO_SAMPLE_RATE_32000 = 6,
|
||||
B_AUDIO_SAMPLE_RATE_22050 = 7,
|
||||
B_AUDIO_SAMPLE_RATE_37800 = 9,
|
||||
B_AUDIO_SAMPLE_RATE_44100 = 11,
|
||||
B_AUDIO_SAMPLE_RATE_48000 = 12,
|
||||
B_AUDIO_SAMPLE_RATE_33075 = 13,
|
||||
B_AUDIO_SAMPLE_RATE_9600 = 14,
|
||||
B_AUDIO_SAMPLE_RATE_6620 = 15
|
||||
};
|
||||
|
||||
struct audio_channel {
|
||||
uint32 adc_source; /* adc input source */
|
||||
char adc_gain; /* 0-15 adc gain, in 1.5 dB steps */
|
||||
char mic_gain_enable; /* non-zero enables 20 dB MIC input gain */
|
||||
char cd_mix_gain; /* 0-31 cd mix to output gain in -1.5dB steps */
|
||||
char cd_mix_mute; /* non-zero mutes cd mix */
|
||||
char aux2_mix_gain; /* unused */
|
||||
char aux2_mix_mute; /* unused */
|
||||
char line_mix_gain; /* 0-31 line mix to out gain in -1.5dB steps */
|
||||
char line_mix_mute; /* non-zero mutes line mix */
|
||||
char dac_attn; /* 0-61 dac attenuation, in -1.5 dB steps */
|
||||
char dac_mute; /* non-zero mutes dac output */
|
||||
char reserved_1;
|
||||
char reserved_2;
|
||||
};
|
||||
|
||||
typedef struct audio_params {
|
||||
struct audio_channel left; /* left channel setup */
|
||||
struct audio_channel right; /* right channel setup */
|
||||
uint32 sample_rate; /* sample rate */
|
||||
uint32 playback_format; /* ignore (always 16bit-linear) */
|
||||
uint32 capture_format; /* ignore (always 16bit-linear) */
|
||||
char dither_enable; /* non-zero enables dither on 16 => 8 bit */
|
||||
char mic_attn; /* 0..64 mic input level */
|
||||
char mic_enable; /* non-zero enables mic input */
|
||||
char output_boost; /* ignore (always on) */
|
||||
char highpass_enable; /* ignore (always on) */
|
||||
char mono_gain; /* 0..64 mono speaker gain */
|
||||
char mono_mute; /* non-zero mutes speaker */
|
||||
} audio_params;
|
||||
|
||||
typedef struct audio_buffer_header {
|
||||
int32 buffer_number;
|
||||
int32 subscriber_count;
|
||||
bigtime_t time;
|
||||
int32 reserved_1;
|
||||
int32 reserved_2;
|
||||
bigtime_t sample_clock;
|
||||
} audio_buffer_header;
|
||||
|
||||
#endif
|
||||
@ -1,33 +0,0 @@
|
||||
# Makefile for Borland C++ 4.5 (DPMI16 protected mode, large memory model)
|
||||
|
||||
CC = bcc
|
||||
AS = tasm
|
||||
AR = tlib
|
||||
CFLAGS = -ml -WX -c -w9 -3 -O2 -D__DPMI__ -D__16BIT__
|
||||
AFLAGS = -t -m -q -zi
|
||||
LFLAGS = -ml -WX
|
||||
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj msdos.obj \
|
||||
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
|
||||
|
||||
LIB = ..\lib\DOS\audiobcx.lib
|
||||
|
||||
all : mp.exe $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(CC) $(LFLAGS) mp.obj $(LIB)
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
@if exist $(LIB) del $(LIB) > nul
|
||||
$(AR) $(LIB) @DOS\DPMI16\Borland\audiobcx.lnk
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean :
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1 +0,0 @@
|
||||
+audio.obj +wavfile.obj +xmfile.obj +s3mfile.obj +modfile.obj +iofile.obj +modeng.obj +nondrv.obj +mixdrv.obj +msdos.obj +sbdrv.obj +awedrv.obj +pasdrv.obj +wssdrv.obj +gusdrv.obj +ariadrv.obj
|
||||
@ -1,33 +0,0 @@
|
||||
# Makefile for Borland C++ 4.5 (DPMI32 protected mode, flat memory model)
|
||||
|
||||
CC = bcc32a
|
||||
AS = tasm
|
||||
AR = tlib
|
||||
CFLAGS = -WX -c -w9 -5 -O2 -D__DPMI__ -D__ASM__
|
||||
AFLAGS = -t -m -q -ml -zi
|
||||
LFLAGS = -WX
|
||||
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj _mixdrv.obj msdos.obj \
|
||||
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
|
||||
|
||||
LIB = ..\lib\DOS\audiobcf.lib
|
||||
|
||||
all : mp.exe $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(CC) $(LFLAGS) mp.obj $(LIB)
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
@if exist $(LIB) del $(LIB) > nul
|
||||
$(AR) $(LIB) @DOS\DPMI32\Borland\audiobcf.lnk
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean :
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1 +0,0 @@
|
||||
+audio.obj +wavfile.obj +xmfile.obj +s3mfile.obj +modfile.obj +iofile.obj +modeng.obj +nondrv.obj +mixdrv.obj +_mixdrv.obj +msdos.obj +sbdrv.obj +awedrv.obj +pasdrv.obj +wssdrv.obj +gusdrv.obj +ariadrv.obj
|
||||
@ -1,39 +0,0 @@
|
||||
# Makefile for DJGPP V2.0 (GO32/DPMI32 protected mode, flat memory model)
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
COFF2EXE = stubify
|
||||
CFLAGS = -c -Wall -mpentium -O2 -D__DPMI__ -D__ASM__
|
||||
LFLAGS =
|
||||
|
||||
#OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
# iofile.o modeng.o nondrv.o mixdrv.o _mixdrv.o msdos.o \
|
||||
# sbdrv.o awedrv.o pasdrv.o wssdrv.o gusdrv.o ariadrv.o
|
||||
|
||||
OBJS = audiodj.o _mixdrv.o
|
||||
|
||||
LIB = ../lib/DOS/libaudio.a
|
||||
|
||||
all : mp.exe $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.o $(LIB)
|
||||
$(CC) -o mp mp.o $(LIB) $(LFLAGS)
|
||||
$(STRIP) mp
|
||||
$(COFF2EXE) mp
|
||||
@del mp > nul
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
@$(AR) rc $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
.c.o :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.s.o :
|
||||
$(CC) $(CFLAGS) $*.S
|
||||
|
||||
clean :
|
||||
@if exist *.o del *.o > nul
|
||||
@ -1,40 +0,0 @@
|
||||
# Makefile for WATCOM C/C++32 10.0 (DOS4GW protected mode, flat memory model)
|
||||
|
||||
CC = wcc386
|
||||
LD = wcl386
|
||||
AS = tasm
|
||||
AR = wlib -s -t -q -n
|
||||
CFLAGS = -zq -zu -w9 -we -5r -s -oxt -D__DPMI__ -D__ASM__
|
||||
AFLAGS = -t -m -q -ml -zi
|
||||
LFLAGS = -l=dos4g -zq
|
||||
|
||||
#AS = wasm
|
||||
#AFLAGS = -zq -w9 -we -5r
|
||||
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj _mixdrv.obj msdos.obj \
|
||||
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
|
||||
|
||||
LIB = "..\lib\DOS\audiowcf.lib"
|
||||
|
||||
all : mp.exe $(LIB) clean .SYMBOLIC
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(LD) mp.obj $(LIB) $(LFLAGS)
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
@echo $(OBJS) > audiowcf.lnk
|
||||
$(AR) $(LIB) @audiowcf.lnk
|
||||
@del audiowcf.lnk
|
||||
|
||||
.SUFFIXES: .c .asm .obj
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean : .SYMBOLIC
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1,33 +0,0 @@
|
||||
# Makefile for Borland C++ 4.5 (DOS real mode, large memory model)
|
||||
|
||||
CC = bcc
|
||||
AS = tasm
|
||||
AR = tlib
|
||||
CFLAGS = -ml -c -w9 -3 -O2 -D__DOS16__ -D__16BIT__
|
||||
AFLAGS = -t -m -q -zi
|
||||
LFLAGS = -ml
|
||||
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj msdos.obj \
|
||||
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
|
||||
|
||||
LIB = ..\lib\DOS\audiobcl.lib
|
||||
|
||||
all : mp.exe $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(CC) $(LFLAGS) mp.obj $(LIB)
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
@if exist $(LIB) del $(LIB) > nul
|
||||
$(AR) $(LIB) @DOS\Large\Borland\audiobcl.lnk
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean :
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1 +0,0 @@
|
||||
+audio.obj +wavfile.obj +xmfile.obj +s3mfile.obj +modfile.obj +iofile.obj +modeng.obj +nondrv.obj +mixdrv.obj +msdos.obj +sbdrv.obj +awedrv.obj +pasdrv.obj +wssdrv.obj +gusdrv.obj +ariadrv.obj
|
||||
@ -1,32 +0,0 @@
|
||||
# Makefile for Watcom C/C++16 (DOS real mode, large memory model)
|
||||
|
||||
CC = wcl
|
||||
AS = tasm
|
||||
AR = wlib -n -b -q
|
||||
CFLAGS = -zq -zu -ml -c -w9 -we -5 -s -oxt -D__DOS16__ -D__16BIT__
|
||||
AFLAGS = -t -m -q -zi
|
||||
LFLAGS = -zq -ml
|
||||
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj &
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj msdos.obj &
|
||||
sbdrv.obj awedrv.obj pasdrv.obj wssdrv.obj gusdrv.obj ariadrv.obj
|
||||
|
||||
LIB = ..\lib\DOS\audiowcl.lib
|
||||
|
||||
all : mp.exe $(LIB) clean .SYMBOLIC
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(CC) $(LFLAGS) mp.obj $(LIB)
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
*$(AR) $(LIB) $(OBJS)
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean : .SYMBOLIC
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1,30 +0,0 @@
|
||||
# Makefile for FreeBSD/386 and VoxWare 2.90 or later
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
CFLAGS = -c -Wall -O2 -fomit-frame-pointer -D__FREEBSD__ -D__ASM__
|
||||
LFLAGS = -L../lib/FreeBSD -laudio
|
||||
|
||||
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
iofile.o modeng.o nondrv.o mixdrv.o _mixdrv.o lnxdrv.o
|
||||
|
||||
LIB = ../lib/FreeBSD/libaudio.a
|
||||
|
||||
all : mp $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp : mp.o $(LIB)
|
||||
$(CC) -o mp mp.o $(LFLAGS)
|
||||
$(STRIP) mp
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
$(AR) rc $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
.c.o .s.o .S.o :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
clean :
|
||||
@for f in *.o; do rm -f $$f; done
|
||||
@ -1,30 +0,0 @@
|
||||
# Makefile for Silicon Graphics Indigo IRIX 4.x with audio ports
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
CFLAGS = -c -Wall -O2 -D__SILICON__ -D__BIGENDIAN__
|
||||
LFLAGS = -laudio -L../lib/Indigo -laudio
|
||||
|
||||
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
iofile.o modeng.o nondrv.o mixdrv.o sgidrv.o
|
||||
|
||||
LIB = ../lib/Indigo/libaudio.a
|
||||
|
||||
all : mp $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp : mp.o $(LIB)
|
||||
$(CC) -o mp mp.o $(LFLAGS)
|
||||
$(STRIP) mp
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
$(AR) rc $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
.c.o .s.o .S.o :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
clean :
|
||||
@for f in *.o; do rm -f $$f; done
|
||||
@ -1,34 +0,0 @@
|
||||
# Makefile for MacOS X using SDL
|
||||
|
||||
CC = clang
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
CFLAGS = -c -Wall -O2 -fomit-frame-pointer -D__OSX__ `allegro-config --cflags` -arch i386
|
||||
LFLAGS = -L../lib/MacOSX -laudio `allegro-config --libs` -arch i386
|
||||
|
||||
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
iofile.o modeng.o nondrv.o mixdrv.o allegdrv.o
|
||||
#osxdrv.c
|
||||
# Not supported on x86_64 platforms
|
||||
#_mixdrv.o
|
||||
|
||||
LIB = ../lib/MacOSX/libaudio.a
|
||||
|
||||
all : mp $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp : mp.o $(LIB)
|
||||
$(CC) -o mp mp.o $(LFLAGS)
|
||||
$(STRIP) mp
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
$(AR) rc $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
.c.o .s.o .S.o :
|
||||
@echo CC $<
|
||||
@$(CC) $(CFLAGS) $<
|
||||
|
||||
clean :
|
||||
@for f in *.o; do rm -f $$f; done
|
||||
@ -1,34 +0,0 @@
|
||||
# Makefile for Linux and SDL wrapper driver...
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
CFLAGS = -g -c -Wall -O2 -D__SDL__ `sdl-config --cflags` -Wall -Werror
|
||||
LFLAGS = -L../lib/SDL -laudio `sdl-config --libs`
|
||||
|
||||
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
iofile.o modeng.o nondrv.o mixdrv.o sdldrv.o
|
||||
#_mixdrv.o
|
||||
|
||||
LIB = ../lib/SDL/libaudio.a
|
||||
|
||||
all: mp $(LIB)
|
||||
@echo done.
|
||||
|
||||
mp : mp.o $(LIB)
|
||||
$(CC) -o mp mp.o $(LFLAGS)
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
$(AR) rc $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.s.o .S.o :
|
||||
$(CC) $(CFLAGS) $< -D__LINUX__
|
||||
|
||||
clean:
|
||||
-rm -rf *.o
|
||||
-rm mp
|
||||
@ -1,53 +0,0 @@
|
||||
# Makefile for OS/2 MMPM with EMX and GCC
|
||||
#
|
||||
# To build an OS/2 DLL and the ModPlayer executable,
|
||||
# just set the MMBASE environment variable to point to
|
||||
# your MMOS2 base directory, change to the src directory
|
||||
# and type make -f os2/Makefile. That's all there is
|
||||
# to it!
|
||||
|
||||
MMBASE=f:\mmos2
|
||||
|
||||
CC = gcc
|
||||
CPP = cpp
|
||||
IMPLIB = implib
|
||||
CFLAGS = -c -Wall -O3 -Zsys -Zmts -fomit-frame-pointer -D__OS2__ -D__ASM__ -D __32BIT__ -D __FLAT__
|
||||
|
||||
DLL = audio.dll
|
||||
LIB = ../lib/OS2/audio.lib
|
||||
|
||||
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
iofile.o modeng.o nondrv.o _mixdrv.o mixdrv.o os2drv.o
|
||||
|
||||
OMFOBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj \
|
||||
mtmfile.obj iofile.obj modeng.obj nondrv.obj _mixdrv.obj \
|
||||
mixdrv.obj os2drv.obj
|
||||
|
||||
all : mp.exe
|
||||
@echo done.
|
||||
|
||||
$(DLL) : $(OBJS) mdm.lib
|
||||
$(CC) -Zsys -Zomf -Zmts -Zso -Zdll -o $(DLL) os2/audio.def -L. -lmdm $(OMFOBJS)
|
||||
|
||||
mdm.lib: $(MMBASE)/dll/mdm.dll
|
||||
$(IMPLIB) mdm.lib $(MMBASE)/dll/mdm.dll
|
||||
|
||||
$(LIB): $(DLL)
|
||||
$(IMPLIB) $(LIB) $(DLL)
|
||||
|
||||
mp.exe : $(OBJS) mp.o $(LIB)
|
||||
emxomf mp.o
|
||||
$(CC) -Zsys -Zomf -Zmts -Zlinker /STACK:32768 -Zlinker /PMTYPE:VIO -o mp mp.obj -L../lib/OS2 -laudio -lmdm
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $<
|
||||
emxomf $*.o
|
||||
|
||||
_mixdrv.o: _mixdrv.S
|
||||
$(CPP) _mixdrv.S | $(AS) -o _mixdrv.o
|
||||
emxomf _mixdrv.o
|
||||
|
||||
clean :
|
||||
@rm -rf *.obj *.o
|
||||
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
LIBRARY audio INITINSTANCE TERMINSTANCE
|
||||
DESCRIPTION 'SEAL Audio Library 1.07 for OS/2'
|
||||
EXPORTS AInitialize
|
||||
AGetVersion
|
||||
AGetAudioNumDevs
|
||||
AGetAudioDevCaps
|
||||
AGetErrorText
|
||||
APingAudio
|
||||
AOpenAudio
|
||||
ACloseAudio
|
||||
AUpdateAudio
|
||||
AOpenVoices
|
||||
ACloseVoices
|
||||
ASetAudioCallback
|
||||
ASetAudioTimerProc
|
||||
ASetAudioTimerRate
|
||||
AGetAudioDataAvail
|
||||
ACreateAudioData
|
||||
ADestroyAudioData
|
||||
AWriteAudioData
|
||||
ACreateAudioVoice
|
||||
ADestroyAudioVoice
|
||||
APlayVoice
|
||||
APrimeVoice
|
||||
AStartVoice
|
||||
AStopVoice
|
||||
ASetVoicePosition
|
||||
ASetVoiceFrequency
|
||||
ASetVoiceVolume
|
||||
ASetVoicePanning
|
||||
AGetVoicePosition
|
||||
AGetVoiceFrequency
|
||||
AGetVoiceVolume
|
||||
AGetVoicePanning
|
||||
AGetVoiceStatus
|
||||
APlayModule
|
||||
AStopModule
|
||||
APauseModule
|
||||
AResumeModule
|
||||
ASetModuleVolume
|
||||
ASetModulePosition
|
||||
AGetModuleVolume
|
||||
AGetModulePosition
|
||||
AGetModuleStatus
|
||||
ASetModuleCallback
|
||||
ALoadModuleFile
|
||||
AFreeModuleFile
|
||||
ALoadWaveFile
|
||||
AFreeWaveFile
|
||||
AGetModuleTrack
|
||||
ASetAudioMixerValue
|
||||
AUpdateAudioEx
|
||||
@ -1,30 +0,0 @@
|
||||
# Makefile for SPARC 10 Solaris 2.x with dbri or AMD ulaw audio device
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
CFLAGS = -c -Wall -O2 -D__SOLARIS__ -D__BIGENDIAN__
|
||||
LFLAGS = -L../lib/Solaris -laudio
|
||||
|
||||
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
iofile.o modeng.o nondrv.o mixdrv.o sundrv.o
|
||||
|
||||
LIB = ../lib/Solaris/libaudio.a
|
||||
|
||||
all : mp $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp : mp.o $(LIB)
|
||||
$(CC) -o mp mp.o $(LFLAGS)
|
||||
$(STRIP) mp
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
$(AR) rc $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
.c.o .s.o .S.o :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
clean :
|
||||
@rm -rf *.o
|
||||
@ -1,30 +0,0 @@
|
||||
# Makefile for SPARC 1/2/IPX/... SunOS 4.1.x with AMD ulaw audio device
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip
|
||||
CFLAGS = -c -Wall -O2 -D__SPARC__ -D__BIGENDIAN__
|
||||
LFLAGS = -L../lib/SunOS -laudio
|
||||
|
||||
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
|
||||
iofile.o modeng.o nondrv.o mixdrv.o sundrv.o
|
||||
|
||||
LIB = ../lib/SunOS/libaudio.a
|
||||
|
||||
all : mp $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp : mp.o $(LIB)
|
||||
$(CC) -o mp mp.o $(LFLAGS)
|
||||
$(STRIP) mp
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
$(AR) rc $(LIB) $(OBJS)
|
||||
$(RANLIB) $(LIB)
|
||||
|
||||
.c.o .s.o .S.o :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
clean :
|
||||
@rm -rf *.o
|
||||
@ -1,32 +0,0 @@
|
||||
# Makefile for Borland C++ 4.5 (Win16 protected mode, large memory model)
|
||||
|
||||
CC = bcc
|
||||
AS = tasm
|
||||
AR = tlib
|
||||
CFLAGS = -ml -W -c -w9 -3 -O2 -D__WINDOWS__ -D__16BIT__
|
||||
AFLAGS = -t -m -q -zi
|
||||
LFLAGS = -ml -W
|
||||
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj windrv.obj
|
||||
|
||||
LIB = ..\lib\Win16\audw16bc.lib
|
||||
|
||||
all : mp.exe $(LIB) clean
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(CC) $(LFLAGS) mp.obj $(LIB)
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
@if exist $(LIB) del $(LIB) > nul
|
||||
$(AR) $(LIB) @Windows\Win16\Borland\audw16bc.lnk
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean :
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1 +0,0 @@
|
||||
+audio.obj +wavfile.obj +xmfile.obj +s3mfile.obj +modfile.obj +iofile.obj +modeng.obj +nondrv.obj +mixdrv.obj +windrv.obj
|
||||
@ -1,31 +0,0 @@
|
||||
# Makefile for WATCOM C/C++16 10.0 (Win16 protected mode, large memory model)
|
||||
|
||||
CC = wcl
|
||||
AS = tasm
|
||||
AR = wlib -b -n -q
|
||||
CFLAGS = -zq -zw -ml -c -w9 -we -5 -s -oxt -D__WINDOWS__ -D__16BIT__
|
||||
AFLAGS = -t -m -q -ml -zi
|
||||
LFLAGS = -zq -zw -ml
|
||||
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj &
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj windrv.obj
|
||||
|
||||
LIB = ..\lib\Win16\audw16wc.lib
|
||||
|
||||
all : mp.exe $(LIB) clean .SYMBOLIC
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(CC) $(LFLAGS) mp.obj $(LIB) mmsystem.lib
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
*$(AR) $(LIB) $(OBJS)
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean : .SYMBOLIC
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1,37 +0,0 @@
|
||||
# Makefile for Borland C++ 4.5 (Win32 protected mode, flat memory model)
|
||||
|
||||
CC = bcc32a
|
||||
LD = tlink32
|
||||
IMPLIB = implib
|
||||
AS = tasm
|
||||
AR = tlib
|
||||
CFLAGS = -WC -c -w9 -5 -O2 -DWIN32 -D__WINDOWS__ -D__ASM__
|
||||
AFLAGS = -t -m -q -ml -zi
|
||||
LFLAGS = -WD
|
||||
LDFLAGS = -x -Tpd
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj \
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj _mixdrv.obj windrv.obj \
|
||||
drdrv.obj audiow32.obj
|
||||
|
||||
DLL = audiow32.dll
|
||||
LIB = ..\lib\Win32\audw32bc.lib
|
||||
|
||||
all : mp.exe $(DLL) $(LIB) clean
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(CC) -WC mp.obj $(LIB)
|
||||
|
||||
$(DLL): $(OBJS)
|
||||
$(LD) $(LDFLAGS) @Windows\Win32\Borland\audiow32.lnk
|
||||
|
||||
$(LIB) : $(DLL)
|
||||
$(IMPLIB) $(LIB) $(DLL)
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean :
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1,54 +0,0 @@
|
||||
LIBRARY audiow32
|
||||
DESCRIPTION 'Audio Library 1.07 for Win32'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE
|
||||
EXPORTS AInitialize @100
|
||||
AGetVersion @101
|
||||
AGetAudioNumDevs @102
|
||||
AGetAudioDevCaps @103
|
||||
AGetErrorText @104
|
||||
APingAudio @105
|
||||
AOpenAudio @106
|
||||
ACloseAudio @107
|
||||
AUpdateAudio @108
|
||||
AOpenVoices @109
|
||||
ACloseVoices @110
|
||||
ASetAudioCallback @111
|
||||
ASetAudioTimerProc @112
|
||||
ASetAudioTimerRate @113
|
||||
AGetAudioDataAvail @114
|
||||
ACreateAudioData @115
|
||||
ADestroyAudioData @116
|
||||
AWriteAudioData @117
|
||||
ACreateAudioVoice @118
|
||||
ADestroyAudioVoice @119
|
||||
APlayVoice @120
|
||||
APrimeVoice @121
|
||||
AStartVoice @122
|
||||
AStopVoice @123
|
||||
ASetVoicePosition @124
|
||||
ASetVoiceFrequency @125
|
||||
ASetVoiceVolume @126
|
||||
ASetVoicePanning @127
|
||||
AGetVoicePosition @128
|
||||
AGetVoiceFrequency @129
|
||||
AGetVoiceVolume @130
|
||||
AGetVoicePanning @131
|
||||
AGetVoiceStatus @132
|
||||
APlayModule @133
|
||||
AStopModule @134
|
||||
APauseModule @135
|
||||
AResumeModule @136
|
||||
ASetModuleVolume @137
|
||||
ASetModulePosition @138
|
||||
AGetModuleVolume @139
|
||||
AGetModulePosition @140
|
||||
AGetModuleStatus @141
|
||||
ASetModuleCallback @146
|
||||
ALoadModuleFile @142
|
||||
AFreeModuleFile @143
|
||||
ALoadWaveFile @144
|
||||
AFreeWaveFile @145
|
||||
AGetModuleTrack @147
|
||||
ASetAudioMixerValue @148
|
||||
AUpdateAudioEx @149
|
||||
@ -1,7 +0,0 @@
|
||||
c0d32.obj +
|
||||
audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj iofile.obj +
|
||||
modeng.obj nondrv.obj mixdrv.obj _mixdrv.obj windrv.obj audiow32.obj
|
||||
audiow32.dll
|
||||
audiow32.map
|
||||
cw32.lib import32.lib
|
||||
Windows\Win32\Borland\audiow32.def
|
||||
@ -1,48 +0,0 @@
|
||||
# Makefile for Visual C++ 4.1 - 5.2 (Win32 protected mode, flat memory model)
|
||||
|
||||
!if "$(MSVCDIR)"==""
|
||||
MSVCDIR = C:\VC
|
||||
!endif
|
||||
|
||||
!if "$(DXSDKROOT)"==""
|
||||
DXSDKROOT = $(MSVCDIR)
|
||||
!endif
|
||||
|
||||
CC = cl
|
||||
LD = link
|
||||
AS = tasm
|
||||
AR = lib
|
||||
CFLAGS = -nologo -G5 -Gr -MD -LD -W2 -GD -Ox -Zp4 -c -DWIN32 -D__WINDOWS__ -D__FLAT__ -D__ASM__ -D__MSC__ -I"$(DXSDKROOT)\INCLUDE" -I"$(MSVCDIR)\INCLUDE"
|
||||
AFLAGS = -t -m -q -ml -zi
|
||||
OBJS = audiow32.obj audio.obj wavfile.obj xmfile.obj s3mfile.obj mtmfile.obj \
|
||||
modfile.obj iofile.obj modeng.obj nondrv.obj mixdrv.obj \
|
||||
_mixdrv.obj windrv.obj dsdrv.obj dsdrv2.obj
|
||||
|
||||
DLL = audiow32.dll
|
||||
LIB = ..\lib\Win32\audw32vc.lib
|
||||
|
||||
LIBS = "$(MSVCDIR)\LIB\msvcrt.lib" \
|
||||
"$(MSVCDIR)\LIB\kernel32.lib" "$(MSVCDIR)\LIB\winmm.lib" \
|
||||
"$(MSVCDIR)\LIB\ole32.lib" "$(MSVCDIR)\LIB\user32.lib" \
|
||||
"$(DXSDKROOT)\LIB\dsound.lib"
|
||||
|
||||
LFLAGS = -NOLOGO -DLL -MACHINE:I386 -VERSION:1.07 \
|
||||
-DEF:Windows\Win32\VisualC\audiow32.def -OUT:$(DLL) -IMPLIB:$(LIB)
|
||||
|
||||
all : mp.exe $(DLL) $(LIB) clean
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
@$(LD) $(LIBS) -NOLOGO -SUBSYSTEM:CONSOLE -MACHINE:I386 -OUT:mp.exe mp.obj $(LIB)
|
||||
|
||||
$(DLL) $(LIB) : $(OBJS)
|
||||
$(LD) $(LIBS) $(LFLAGS) $(OBJS)
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean :
|
||||
@if exist *.obj del *.obj > nul
|
||||
@if exist *.exp del *.exp > nul
|
||||
@ -1,54 +0,0 @@
|
||||
LIBRARY audiow32
|
||||
DESCRIPTION 'Audio Library 1.07 for Win32'
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE
|
||||
EXPORTS AInitialize @100
|
||||
AGetVersion @101
|
||||
AGetAudioNumDevs @102
|
||||
AGetAudioDevCaps @103
|
||||
AGetErrorText @104
|
||||
APingAudio @105
|
||||
AOpenAudio @106
|
||||
ACloseAudio @107
|
||||
AUpdateAudio @108
|
||||
AOpenVoices @109
|
||||
ACloseVoices @110
|
||||
ASetAudioCallback @111
|
||||
ASetAudioTimerProc @112
|
||||
ASetAudioTimerRate @113
|
||||
AGetAudioDataAvail @114
|
||||
ACreateAudioData @115
|
||||
ADestroyAudioData @116
|
||||
AWriteAudioData @117
|
||||
ACreateAudioVoice @118
|
||||
ADestroyAudioVoice @119
|
||||
APlayVoice @120
|
||||
APrimeVoice @121
|
||||
AStartVoice @122
|
||||
AStopVoice @123
|
||||
ASetVoicePosition @124
|
||||
ASetVoiceFrequency @125
|
||||
ASetVoiceVolume @126
|
||||
ASetVoicePanning @127
|
||||
AGetVoicePosition @128
|
||||
AGetVoiceFrequency @129
|
||||
AGetVoiceVolume @130
|
||||
AGetVoicePanning @131
|
||||
AGetVoiceStatus @132
|
||||
APlayModule @133
|
||||
AStopModule @134
|
||||
APauseModule @135
|
||||
AResumeModule @136
|
||||
ASetModuleVolume @137
|
||||
ASetModulePosition @138
|
||||
AGetModuleVolume @139
|
||||
AGetModulePosition @140
|
||||
AGetModuleStatus @141
|
||||
ASetModuleCallback @146
|
||||
ALoadModuleFile @142
|
||||
AFreeModuleFile @143
|
||||
ALoadWaveFile @144
|
||||
AFreeWaveFile @145
|
||||
AGetModuleTrack @147
|
||||
ASetAudioMixerValue @148
|
||||
AUpdateAudioEx @149
|
||||
@ -1,39 +0,0 @@
|
||||
# Makefile for WATCOM C/C++32 10.0 (Win32 protected mode, flat memory model)
|
||||
|
||||
CC = wcl386
|
||||
LD = wlink
|
||||
AS = tasm
|
||||
AR = wlib -b -n -q
|
||||
CFLAGS = -zq -c -w9 -5r -s -oxt -DWIN32 -D__WINDOWS__ -D__ASM__
|
||||
AFLAGS = -q -t -m -ml -zi
|
||||
LFLAGS = -zq -l=nt
|
||||
|
||||
#AS = wasm
|
||||
#AFLAGS = -zq -w9 -we -5r
|
||||
|
||||
OBJS = audio.obj wavfile.obj xmfile.obj s3mfile.obj modfile.obj mtmfile.obj &
|
||||
iofile.obj modeng.obj nondrv.obj mixdrv.obj _mixdrv.obj windrv.obj dsdrv.obj
|
||||
|
||||
DLL = audiow32.dll
|
||||
LIB = ..\lib\Win32\audw32wc.lib
|
||||
|
||||
all : mp.exe $(DLL) clean .SYMBOLIC
|
||||
@echo done.
|
||||
|
||||
mp.exe : mp.obj $(LIB)
|
||||
$(CC) mp.obj $(LIB) $(LFLAGS)
|
||||
|
||||
$(LIB) : $(DLL)
|
||||
$(AR) $(LIB) @Windows\Win32\Watcom\audiow32.lbc
|
||||
|
||||
$(DLL) : $(OBJS)
|
||||
$(LD) @Windows\Win32\Watcom\audiow32.lnk
|
||||
|
||||
.c.obj :
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
||||
.asm.obj :
|
||||
$(AS) $(AFLAGS) $<
|
||||
|
||||
clean : .SYMBOLIC
|
||||
@if exist *.obj del *.obj > nul
|
||||
@ -1,49 +0,0 @@
|
||||
++'_AInitialize@0'.'AUDIOW32.DLL'..AInitialize
|
||||
++'_AGetVersion@0'.'AUDIOW32.DLL'..AGetVersion
|
||||
++'_AGetAudioNumDevs@0'.'AUDIOW32.DLL'..AGetAudioNumDevs
|
||||
++'_AGetAudioDevCaps@8'.'AUDIOW32.DLL'..AGetAudioDevCaps
|
||||
++'_AGetErrorText@12'.'AUDIOW32.DLL'..AGetErrorText
|
||||
++'_APingAudio@4'.'AUDIOW32.DLL'..APingAudio
|
||||
++'_AOpenAudio@4'.'AUDIOW32.DLL'..AOpenAudio
|
||||
++'_ACloseAudio@0'.'AUDIOW32.DLL'..ACloseAudio
|
||||
++'_AUpdateAudio@0'.'AUDIOW32.DLL'..AUpdateAudio
|
||||
++'_AOpenVoices@4'.'AUDIOW32.DLL'..AOpenVoices
|
||||
++'_ACloseVoices@0'.'AUDIOW32.DLL'..ACloseVoices
|
||||
++'_ASetAudioCallback@4'.'AUDIOW32.DLL'..ASetAudioCallback
|
||||
++'_ASetAudioTimerProc@4'.'AUDIOW32.DLL'..ASetAudioTimerProc
|
||||
++'_ASetAudioTimerRate@4'.'AUDIOW32.DLL'..ASetAudioTimerRate
|
||||
++'_AGetAudioDataAvail@0'.'AUDIOW32.DLL'..AGetAudioDataAvail
|
||||
++'_ACreateAudioData@4'.'AUDIOW32.DLL'..ACreateAudioData
|
||||
++'_ADestroyAudioData@4'.'AUDIOW32.DLL'..ADestroyAudioData
|
||||
++'_AWriteAudioData@12'.'AUDIOW32.DLL'..AWriteAudioData
|
||||
++'_ACreateAudioVoice@4'.'AUDIOW32.DLL'..ACreateAudioVoice
|
||||
++'_ADestroyAudioVoice@4'.'AUDIOW32.DLL'..ADestroyAudioVoice
|
||||
++'_APlayVoice@8'.'AUDIOW32.DLL'..APlayVoice
|
||||
++'_APrimeVoice@8'.'AUDIOW32.DLL'..APrimeVoice
|
||||
++'_AStartVoice@4'.'AUDIOW32.DLL'..AStartVoice
|
||||
++'_AStopVoice@4'.'AUDIOW32.DLL'..AStopVoice
|
||||
++'_ASetVoicePosition@8'.'AUDIOW32.DLL'..ASetVoicePosition
|
||||
++'_ASetVoiceFrequency@8'.'AUDIOW32.DLL'..ASetVoiceFrequency
|
||||
++'_ASetVoiceVolume@8'.'AUDIOW32.DLL'..ASetVoiceVolume
|
||||
++'_ASetVoicePanning@8'.'AUDIOW32.DLL'..ASetVoicePanning
|
||||
++'_AGetVoicePosition@8'.'AUDIOW32.DLL'..AGetVoicePosition
|
||||
++'_AGetVoiceFrequency@8'.'AUDIOW32.DLL'..AGetVoiceFrequency
|
||||
++'_AGetVoiceVolume@8'.'AUDIOW32.DLL'..AGetVoiceVolume
|
||||
++'_AGetVoicePanning@8'.'AUDIOW32.DLL'..AGetVoicePanning
|
||||
++'_AGetVoiceStatus@8'.'AUDIOW32.DLL'..AGetVoiceStatus
|
||||
++'_APlayModule@4'.'AUDIOW32.DLL'..APlayModule
|
||||
++'_AStopModule@0'.'AUDIOW32.DLL'..AStopModule
|
||||
++'_APauseModule@0'.'AUDIOW32.DLL'..APauseModule
|
||||
++'_AResumeModule@0'.'AUDIOW32.DLL'..AResumeModule
|
||||
++'_ASetModuleVolume@4'.'AUDIOW32.DLL'..ASetModuleVolume
|
||||
++'_ASetModulePosition@8'.'AUDIOW32.DLL'..ASetModulePosition
|
||||
++'_AGetModuleVolume@4'.'AUDIOW32.DLL'..AGetModuleVolume
|
||||
++'_AGetModulePosition@8'.'AUDIOW32.DLL'..AGetModulePosition
|
||||
++'_AGetModuleStatus@4'.'AUDIOW32.DLL'..AGetModuleStatus
|
||||
++'_ASetModuleCallback@4'.'AUDIOW32.DLL'..ASetModuleCallback
|
||||
++'_ALoadModuleFile@12'.'AUDIOW32.DLL'..ALoadModuleFile
|
||||
++'_AFreeModuleFile@4'.'AUDIOW32.DLL'..AFreeModuleFile
|
||||
++'_ALoadWaveFile@12'.'AUDIOW32.DLL'..ALoadWaveFile
|
||||
++'_AFreeWaveFile@4'.'AUDIOW32.DLL'..AFreeWaveFile
|
||||
++'_ASetAudioMixerValue@8'.'AUDIOW32.DLL'..ASetAudioMixerValue
|
||||
++'_AUpdateAudioEx@4".'AUDIOW32.DLL'..AUpdateAudioEx
|
||||
@ -1,57 +0,0 @@
|
||||
NAME AUDIOW32.DLL
|
||||
SYSTEM nt_dll
|
||||
OPTION MODNAME='AudioW32', VERSION=1.07
|
||||
OPTION DESCRIPTION 'Audio Library 1.07 for Win32'
|
||||
FILE AUDIO.OBJ, WAVFILE.OBJ, XMFILE.OBJ, S3MFILE.OBJ,
|
||||
MODFILE.OBJ, IOFILE.OBJ, MODENG.OBJ, NONDRV.OBJ,
|
||||
MIXDRV.OBJ, _MIXDRV.OBJ, WINDRV.OBJ
|
||||
EXPORT AInitialize.100,
|
||||
AGetVersion.101,
|
||||
AGetAudioNumDevs.102,
|
||||
AGetAudioDevCaps.103,
|
||||
AGetErrorText.104,
|
||||
APingAudio.105,
|
||||
AOpenAudio.106,
|
||||
ACloseAudio.107,
|
||||
AUpdateAudio.108,
|
||||
AOpenVoices.109,
|
||||
ACloseVoices.110,
|
||||
ASetAudioCallback.111,
|
||||
ASetAudioTimerProc.112,
|
||||
ASetAudioTimerRate.113,
|
||||
AGetAudioDataAvail.114,
|
||||
ACreateAudioData.115,
|
||||
ADestroyAudioData.116,
|
||||
AWriteAudioData.117,
|
||||
ACreateAudioVoice.118,
|
||||
ADestroyAudioVoice.119,
|
||||
APlayVoice.120,
|
||||
APrimeVoice.121,
|
||||
AStartVoice.122,
|
||||
AStopVoice.123,
|
||||
ASetVoicePosition.124,
|
||||
ASetVoiceFrequency.125,
|
||||
ASetVoiceVolume.126,
|
||||
ASetVoicePanning.127,
|
||||
AGetVoicePosition.128,
|
||||
AGetVoiceFrequency.129,
|
||||
AGetVoiceVolume.130,
|
||||
AGetVoicePanning.131,
|
||||
AGetVoiceStatus.132,
|
||||
APlayModule.133,
|
||||
AStopModule.134,
|
||||
APauseModule.135,
|
||||
AResumeModule.136,
|
||||
ASetModuleVolume.137,
|
||||
ASetModulePosition.138,
|
||||
AGetModuleVolume.139,
|
||||
AGetModulePosition.140,
|
||||
AGetModuleStatus.141,
|
||||
ASetModuleCallback.146,
|
||||
ALoadModuleFile.142,
|
||||
AFreeModuleFile.143,
|
||||
ALoadWaveFile.144,
|
||||
AFreeWaveFile.145,
|
||||
AGetModuleTrack.147
|
||||
ASetAudioMixerValue.148
|
||||
AUpdateAudioEx.149
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,172 +0,0 @@
|
||||
/*
|
||||
* $Id: lnxdrv.c 1.5 1996/08/05 18:51:19 chasan released $
|
||||
*
|
||||
* SDL audio driver. Turns SEAL into a mixer on top of SDL.
|
||||
*
|
||||
* Copyright 2002 Greg Velichansky (hmaon@bumba.net)
|
||||
*
|
||||
* Based in part on the Linux Voxware driver,
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define USE_CONSOLE
|
||||
#include <Allegro/allegro.h>
|
||||
#else
|
||||
#define USE_CONSOLE
|
||||
#include <allegro.h>
|
||||
#endif
|
||||
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
|
||||
/*
|
||||
* fragments defines
|
||||
*/
|
||||
#define NUMFRAGS 16
|
||||
#define FRAGSIZE 11
|
||||
#define BUFFERSIZE (1 << FRAGSIZE)
|
||||
|
||||
/*
|
||||
* configuration structure
|
||||
*/
|
||||
static struct AudioStruct {
|
||||
AUDIOSTREAM *stream;
|
||||
BYTE aBuffer[BUFFERSIZE*4];
|
||||
LPFNAUDIOWAVE lpfnAudioWave;
|
||||
WORD wFormat;
|
||||
} Audio;
|
||||
|
||||
|
||||
/*
|
||||
* Linux driver API interface
|
||||
*/
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
static AUDIOCAPS Caps =
|
||||
{
|
||||
AUDIO_PRODUCT_LINUX, "Allegro",
|
||||
AUDIO_FORMAT_1M08 | AUDIO_FORMAT_1S08 |
|
||||
AUDIO_FORMAT_1M16 | AUDIO_FORMAT_1S16 |
|
||||
AUDIO_FORMAT_2M08 | AUDIO_FORMAT_2S08 |
|
||||
AUDIO_FORMAT_2M16 | AUDIO_FORMAT_2S16 |
|
||||
AUDIO_FORMAT_4M08 | AUDIO_FORMAT_4S08 |
|
||||
AUDIO_FORMAT_4M16 | AUDIO_FORMAT_4S16
|
||||
};
|
||||
|
||||
memcpy(lpCaps, &Caps, sizeof(AUDIOCAPS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
return 0;
|
||||
/* return (SDL_INIT_AUDIO == SDL_WasInit(SDL_INIT_AUDIO)); */
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
int nBitsPerSample, nStereoOn, nSampleRate, nFrags;
|
||||
|
||||
memset(&Audio, 0, sizeof(Audio));
|
||||
|
||||
allegro_init();
|
||||
|
||||
if (install_sound(DIGI_AUTODETECT, MIDI_NONE, "") != 0)
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
|
||||
//nBitsPerSample = lpInfo->wFormat & AUDIO_FORMAT_16BITS ? 16 : 8;
|
||||
//nStereoOn = lpInfo->wFormat & AUDIO_FORMAT_STEREO ? 1 : 0;
|
||||
/*nSampleRate = lpInfo->nSampleRate;*/
|
||||
|
||||
/* Audio.desired.freq = lpInfo->nSampleRate;
|
||||
Audio.desired.samples = 512;
|
||||
Audio.desired.channels = nStereoOn ? 2 : 1;
|
||||
|
||||
Audio.desired.format = (lpInfo->wFormat & AUDIO_FORMAT_16BITS) ? AUDIO_U16SYS : AUDIO_U8;
|
||||
|
||||
Audio.desired.userdata = (void*)&Audio;
|
||||
|
||||
Audio.desired.callback = updatecallback;*/
|
||||
|
||||
//SDL_OpenAudio(&(Audio.desired), &(Audio.spec));
|
||||
Audio.stream = play_audio_stream(BUFFERSIZE, 16, TRUE, lpInfo->nSampleRate, 255, 128);
|
||||
voice_start(Audio.stream->voice);
|
||||
|
||||
/* we should probably do something here... blah... whatever :/ */
|
||||
|
||||
/* setup number and size of buffer fragments */
|
||||
/*nFrags = (NUMFRAGS << 16) + (FRAGSIZE);
|
||||
ioctl(Audio.nHandle, SNDCTL_DSP_SETFRAGMENT, &nFrags);*/
|
||||
|
||||
/* setup audio playback encoding format and sampling frequency */
|
||||
/*if (ioctl(Audio.nHandle, SNDCTL_DSP_SAMPLESIZE, &nBitsPerSample) < 0 ||
|
||||
ioctl(Audio.nHandle, SNDCTL_DSP_STEREO, &nStereoOn) < 0 ||
|
||||
ioctl(Audio.nHandle, SNDCTL_DSP_SPEED, &nSampleRate) < 0) {
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_BADFORMAT;
|
||||
}*/
|
||||
|
||||
/*Audio.wFormat = lpInfo->wFormat;*/
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
//SDL_CloseAudio();
|
||||
voice_stop(Audio.stream);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(UINT nFrames)
|
||||
{
|
||||
unsigned char *Buf;
|
||||
Buf = get_audio_stream_buffer(Audio.stream);
|
||||
/* compute frame size */
|
||||
if (Audio.wFormat & AUDIO_FORMAT_16BITS) nFrames <<= 1;
|
||||
if (Audio.wFormat & AUDIO_FORMAT_STEREO) nFrames <<= 1;
|
||||
if (nFrames <= 0 || nFrames > sizeof(Audio.aBuffer))
|
||||
nFrames = sizeof(Audio.aBuffer);
|
||||
|
||||
/* send PCM samples to the DSP audio device */
|
||||
if (Audio.lpfnAudioWave != NULL) {
|
||||
Audio.lpfnAudioWave(Buf, nFrames);
|
||||
}
|
||||
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
/* set up DSP audio device user's callback function */
|
||||
Audio.lpfnAudioWave = lpfnAudioWave;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Linux driver public interface
|
||||
*/
|
||||
AUDIOWAVEDRIVER AllegWaveDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, SetAudioCallback
|
||||
};
|
||||
|
||||
AUDIODRIVER AllegDriver =
|
||||
{
|
||||
&AllegWaveDriver, NULL
|
||||
};
|
||||
@ -1,370 +0,0 @@
|
||||
/*
|
||||
* $Id: ariadrv.c 1.6 1996/08/05 18:51:19 chasan released $
|
||||
*
|
||||
* Sierra Semiconductors' Aria soundcard audio driver.
|
||||
*
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
#include "msdos.h"
|
||||
|
||||
/*
|
||||
* Aria DSP chip register offsets
|
||||
*/
|
||||
#define ARIA_CMD 0x000 /* Aria DSP command port */
|
||||
#define ARIA_STAT 0x002 /* Aria DSP write status */
|
||||
#define ARIA_ADDR 0x004 /* Aria DSP memory address */
|
||||
#define ARIA_DATA 0x006 /* Aria DSP indexed memory data */
|
||||
|
||||
/*
|
||||
* Aria DSP playback mode defines
|
||||
*/
|
||||
#define ARIA_MODE_0 0x0000 /* 4 mono or 2 stereo PCM channels */
|
||||
#define ARIA_MODE_1 0x0001 /* 2 mono or 1 stereo PCM channels */
|
||||
#define ARIA_MODE_2 0x0002 /* 2 mono or 1 stereo PCM channels */
|
||||
|
||||
/*
|
||||
* Aria DSP playback format defines
|
||||
*/
|
||||
#define ARIA_FMT_11025 0x0000 /* select 11025 Hz sampling rate */
|
||||
#define ARIA_FMT_22050 0x0010 /* select 22050 Hz sampling rate */
|
||||
#define ARIA_FMT_44100 0x0020 /* select 44100 Hz sampling rate */
|
||||
#define ARIA_FMT_MONO 0x0000 /* select mono output */
|
||||
#define ARIA_FMT_STEREO 0x0001 /* select stereo output */
|
||||
#define ARIA_FMT_8BIT 0x0000 /* select 8-bit PCM encoding */
|
||||
#define ARIA_FMT_16BIT 0x0002 /* select 16-bit PCM encoding */
|
||||
#define ARIA_FMT_ADPCM 0x0004 /* select ADPCM encoding */
|
||||
|
||||
#define BUFFERSIZE 50 /* buffer length in milliseconds */
|
||||
#define PACKETSIZE 1024 /* packet size in bytes */
|
||||
#define TIMEOUT 60000 /* timeout counter for DSP writes */
|
||||
|
||||
|
||||
/*
|
||||
* Aria DSP configuration structure
|
||||
*/
|
||||
static struct {
|
||||
WORD wFormat; /* playback encoding format */
|
||||
WORD nSampleRate; /* sampling frequency */
|
||||
WORD wFmt; /* Aria DSP format command */
|
||||
WORD wPort; /* base I/O port address */
|
||||
BYTE nIrqLine; /* interrupt request line */
|
||||
BYTE nDmaChannel; /* direct memory access channel */
|
||||
LPBYTE lpBuffer; /* DMA buffer address */
|
||||
UINT nBufferSize; /* DMA buffer length in bytes */
|
||||
UINT nPosition; /* DMA buffer playing position */
|
||||
UINT nWritePosition; /* DMA buffer DSP write position */
|
||||
LPFNAUDIOWAVE lpfnAudioWave; /* user wave callback function */
|
||||
} Aria;
|
||||
|
||||
|
||||
/*
|
||||
* Aria DSP low level programming routines
|
||||
*/
|
||||
static VOID ARPortW(WORD wCmd)
|
||||
{
|
||||
UINT n;
|
||||
|
||||
/* wait until the Aria DSP is ready to receive a command */
|
||||
for (n = 0; n < TIMEOUT; n++) {
|
||||
if (!(INW(Aria.wPort + ARIA_STAT) & 0x8000))
|
||||
break;
|
||||
}
|
||||
/* send the command to the Aria DSP chip */
|
||||
OUTW(Aria.wPort + ARIA_CMD, wCmd);
|
||||
}
|
||||
|
||||
static VOID ARPokeW(WORD nIndex, WORD wData)
|
||||
{
|
||||
OUTB(Aria.wPort + ARIA_ADDR, nIndex);
|
||||
OUTB(Aria.wPort + ARIA_DATA, wData);
|
||||
}
|
||||
|
||||
static WORD ARPeekW(WORD nIndex)
|
||||
{
|
||||
OUTW(Aria.wPort + ARIA_ADDR, nIndex);
|
||||
return INW(Aria.wPort + ARIA_DATA);
|
||||
}
|
||||
|
||||
static VOID ARSetPlaybackMode(WORD nMode)
|
||||
{
|
||||
/*
|
||||
* Setup Aria's playback mode to one of the following:
|
||||
*
|
||||
* ARIA_MODE_0 4 mono or 2 stereo PCM channels, no synth operators
|
||||
* ARIA_MODE_1 2 mono or 1 stereo PCM channels, 20 synth operators
|
||||
* ARIA_MODE_2 2 mono or 1 stereo PCM channels, 32 synth operators
|
||||
*
|
||||
*/
|
||||
ARPortW(0x0006);
|
||||
ARPortW(nMode);
|
||||
ARPortW(0xFFFF);
|
||||
}
|
||||
|
||||
static VOID ARStartPlayback(VOID)
|
||||
{
|
||||
ARPortW(0x0011);
|
||||
ARPortW(0x0000);
|
||||
ARPortW(0xFFFF);
|
||||
}
|
||||
|
||||
static VOID ARStopPlayback(VOID)
|
||||
{
|
||||
ARPortW(0x0012);
|
||||
ARPortW(0x0000);
|
||||
ARPortW(0xFFFF);
|
||||
}
|
||||
|
||||
static VOID ARSetFormat(WORD wFmt)
|
||||
{
|
||||
/* we have to set some parameters to play at 44100 Hz */
|
||||
if (wFmt & ARIA_FMT_44100) {
|
||||
ARSetPlaybackMode(ARIA_MODE_0);
|
||||
OUTW(Aria.wPort + ARIA_STAT, 0x008A);
|
||||
}
|
||||
ARPortW(0x0003);
|
||||
ARPortW(wFmt);
|
||||
ARPortW(0xFFFF);
|
||||
}
|
||||
|
||||
static VOID ARInit(VOID)
|
||||
{
|
||||
UINT n;
|
||||
|
||||
/*
|
||||
* Set up Aria in native mode (disable SB emulation mode),
|
||||
* first initialize the chip and then clear the init flag.
|
||||
*/
|
||||
OUTW(Aria.wPort + ARIA_STAT, 0x00C8);
|
||||
ARPokeW(0x6102, 0x0000);
|
||||
|
||||
/* Aria DSP initialization */
|
||||
ARPortW(0x0000);
|
||||
ARPortW(0x0000);
|
||||
ARPortW(0x0000);
|
||||
ARPortW(0x0000);
|
||||
ARPortW(0xFFFF);
|
||||
|
||||
/* wait until Aria DSP initialization finishes */
|
||||
for (n = 0; n < TIMEOUT; n++) {
|
||||
if (ARPeekW(0x6102) == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
/* complete Aria initialization */
|
||||
OUTW(Aria.wPort + ARIA_CMD, 0x00CA);
|
||||
}
|
||||
|
||||
static VOID ARReset(WORD wFmt)
|
||||
{
|
||||
/*
|
||||
* We need to reset the Aria chip back to 22050 Hz
|
||||
* when it was programmed to play at 44100 Hz.
|
||||
*/
|
||||
if (wFmt & ARIA_FMT_44100) {
|
||||
ARSetPlaybackMode(ARIA_MODE_2);
|
||||
OUTW(Aria.wPort + ARIA_STAT, 0x00CA);
|
||||
}
|
||||
|
||||
/* switch back to SB emulation mode */
|
||||
OUTW(Aria.wPort + ARIA_STAT, 0x0040);
|
||||
}
|
||||
|
||||
static VOID AIAPI ARInterruptHandler(VOID)
|
||||
{
|
||||
LPWORD lpPacket;
|
||||
WORD wAddress;
|
||||
UINT n;
|
||||
|
||||
/* check interrupt type and exit if not generated by Aria */
|
||||
if (INW(Aria.wPort + ARIA_CMD) == 1) {
|
||||
/* play a packet of samples from our buffer */
|
||||
wAddress = 0x8000 - PACKETSIZE + ARPeekW(0x6100);
|
||||
OUTW(Aria.wPort + ARIA_ADDR, wAddress);
|
||||
lpPacket = (LPWORD) (Aria.lpBuffer + Aria.nWritePosition);
|
||||
for (n = 0; n < PACKETSIZE/2; n++) {
|
||||
OUTW(Aria.wPort + ARIA_DATA, *lpPacket++);
|
||||
}
|
||||
if ((Aria.nWritePosition += PACKETSIZE) >= Aria.nBufferSize)
|
||||
Aria.nWritePosition -= Aria.nBufferSize;
|
||||
ARPortW(0x0010);
|
||||
ARPortW(0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Aria audio driver API interface
|
||||
*/
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
LPSTR lpszAria;
|
||||
UINT nChar;
|
||||
|
||||
if ((lpszAria = DosGetEnvironment("ARIA")) != NULL) {
|
||||
Aria.wPort = 0x290;
|
||||
Aria.nIrqLine = 10;
|
||||
Aria.nDmaChannel = 5;
|
||||
nChar = DosParseString(lpszAria, TOKEN_CHAR);
|
||||
while (nChar != 0) {
|
||||
switch (nChar) {
|
||||
case 'A':
|
||||
case 'a':
|
||||
Aria.wPort = DosParseString(NULL, TOKEN_HEX);
|
||||
break;
|
||||
case 'I':
|
||||
case 'i':
|
||||
Aria.nIrqLine = DosParseString(NULL, TOKEN_DEC);
|
||||
break;
|
||||
case 'D':
|
||||
case 'd':
|
||||
Aria.nDmaChannel = DosParseString(NULL, TOKEN_DEC);
|
||||
break;
|
||||
}
|
||||
nChar = DosParseString(NULL, TOKEN_CHAR);
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
static AUDIOCAPS Caps =
|
||||
{
|
||||
AUDIO_PRODUCT_ARIA, "Aria sound card",
|
||||
AUDIO_FORMAT_1M08 | AUDIO_FORMAT_1S08 |
|
||||
AUDIO_FORMAT_1M16 | AUDIO_FORMAT_1S16 |
|
||||
AUDIO_FORMAT_2M08 | AUDIO_FORMAT_2S08 |
|
||||
AUDIO_FORMAT_2M16 | AUDIO_FORMAT_2S16 |
|
||||
AUDIO_FORMAT_4M08 | AUDIO_FORMAT_4S08 |
|
||||
AUDIO_FORMAT_4M16 | AUDIO_FORMAT_4S16
|
||||
};
|
||||
|
||||
memcpy(lpCaps, &Caps, sizeof(AUDIOCAPS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
DWORD dwBytesPerSecond;
|
||||
|
||||
memset(&Aria, 0, sizeof(Aria));
|
||||
|
||||
/*
|
||||
* Initialize the Aria DSP configuration parameters
|
||||
*/
|
||||
Aria.wFormat = lpInfo->wFormat;
|
||||
Aria.nSampleRate = lpInfo->nSampleRate < 16357 ? 11025 :
|
||||
(lpInfo->nSampleRate < 33075 ? 22050 : 44100);
|
||||
if (PingAudio())
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
|
||||
/*
|
||||
* Allocate and clean DMA buffer used for playback
|
||||
*/
|
||||
dwBytesPerSecond = Aria.nSampleRate;
|
||||
if (Aria.wFormat & AUDIO_FORMAT_16BITS)
|
||||
dwBytesPerSecond <<= 1;
|
||||
if (Aria.wFormat & AUDIO_FORMAT_STEREO)
|
||||
dwBytesPerSecond <<= 1;
|
||||
Aria.nBufferSize = dwBytesPerSecond / (1000 / (BUFFERSIZE >> 1));
|
||||
Aria.nBufferSize = (Aria.nBufferSize + PACKETSIZE) & -PACKETSIZE;
|
||||
Aria.nBufferSize <<= 1;
|
||||
if ((Aria.lpBuffer = malloc(Aria.nBufferSize)) == NULL)
|
||||
return AUDIO_ERROR_NOMEMORY;
|
||||
memset(Aria.lpBuffer, Aria.wFormat & AUDIO_FORMAT_16BITS ?
|
||||
0x00 : 0x80, Aria.nBufferSize);
|
||||
|
||||
/*
|
||||
* Initialize the Aria DSP chip, set playback format,
|
||||
* sampling frequency and start the DAC transfer.
|
||||
*/
|
||||
ARInit();
|
||||
DosSetVectorHandler(Aria.nIrqLine, ARInterruptHandler);
|
||||
Aria.wFmt = Aria.wFormat & AUDIO_FORMAT_16BITS ?
|
||||
ARIA_FMT_16BIT : ARIA_FMT_8BIT;
|
||||
Aria.wFmt |= Aria.wFormat & AUDIO_FORMAT_STEREO ?
|
||||
ARIA_FMT_STEREO : ARIA_FMT_MONO;
|
||||
Aria.wFmt |= (Aria.nSampleRate <= 11025 ? ARIA_FMT_11025 :
|
||||
(Aria.nSampleRate <= 22050 ? ARIA_FMT_22050 : ARIA_FMT_44100));
|
||||
ARSetFormat(Aria.wFmt);
|
||||
ARStartPlayback();
|
||||
|
||||
/* refresh caller's format and sampling frequency */
|
||||
lpInfo->wFormat = Aria.wFormat;
|
||||
lpInfo->nSampleRate = Aria.nSampleRate;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
ARStopPlayback();
|
||||
ARReset(Aria.wFmt);
|
||||
DosSetVectorHandler(Aria.nIrqLine, NULL);
|
||||
if (Aria.lpBuffer != NULL)
|
||||
free(Aria.lpBuffer);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(UINT nFrames)
|
||||
{
|
||||
int nBlockSize, nSize;
|
||||
|
||||
if (Aria.wFormat & AUDIO_FORMAT_16BITS) nFrames <<= 1;
|
||||
if (Aria.wFormat & AUDIO_FORMAT_STEREO) nFrames <<= 1;
|
||||
if (nFrames <= 0 || nFrames > Aria.nBufferSize)
|
||||
nFrames = Aria.nBufferSize;
|
||||
|
||||
if ((nBlockSize = Aria.nWritePosition - Aria.nPosition) < 0)
|
||||
nBlockSize += Aria.nBufferSize;
|
||||
|
||||
if (nBlockSize > nFrames)
|
||||
nBlockSize = nFrames;
|
||||
|
||||
while (nBlockSize != 0) {
|
||||
if ((nSize = Aria.nBufferSize - Aria.nPosition) > nBlockSize)
|
||||
nSize = nBlockSize;
|
||||
if (Aria.lpfnAudioWave != NULL) {
|
||||
Aria.lpfnAudioWave(&Aria.lpBuffer[Aria.nPosition], nSize);
|
||||
}
|
||||
else {
|
||||
memset(&Aria.lpBuffer[Aria.nPosition],
|
||||
Aria.wFormat & AUDIO_FORMAT_16BITS ? 0x00 : 0x80, nSize);
|
||||
}
|
||||
if ((Aria.nPosition += nSize) >= Aria.nBufferSize)
|
||||
Aria.nPosition -= Aria.nBufferSize;
|
||||
nBlockSize -= nSize;
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
Aria.lpfnAudioWave = lpfnAudioWave;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Aria DSP audio driver public interface
|
||||
*/
|
||||
AUDIOWAVEDRIVER AriaWaveDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, SetAudioCallback
|
||||
};
|
||||
|
||||
AUDIODRIVER AriaDriver =
|
||||
{
|
||||
&AriaWaveDriver, NULL
|
||||
};
|
||||
@ -1,559 +0,0 @@
|
||||
/*
|
||||
* $Id: audio.c 1.13 1996/12/12 16:32:06 chasan Exp $
|
||||
* 1.14 1998/10/18 14:59:21 chasan (BeOS and OS/2 driver)
|
||||
* 1.15 1998/11/30 18:20:26 chasan (Mixer and UpdateAudioEx API)
|
||||
*
|
||||
* Audio device drivers API interface
|
||||
*
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
|
||||
/*
|
||||
* Copyright information hard-coded into the library
|
||||
*/
|
||||
CHAR szAudioCopyright[] =
|
||||
"SEAL Synthetic Audio Library 1.07 (Build " __DATE__ ")\n"
|
||||
"Copyright (C) 1995, 1996, 1997, 1998, 1999 Carlos Hasan\n";
|
||||
#ifdef __OS2__
|
||||
CHAR szMartyCopyright[] =
|
||||
"OS/2 Audio Driver Copyright (C) 1998 by Martin Amodeo";
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Audio device drivers resource limits
|
||||
*/
|
||||
#define MAXDRIVERS 8
|
||||
#define MAXVOICES 32
|
||||
|
||||
/*
|
||||
* Macros to work with audio channels handles
|
||||
*/
|
||||
#define VOICENUM(handle) ((UINT)handle-1)
|
||||
|
||||
/*
|
||||
* Table of registered audio device drivers and channels.
|
||||
*/
|
||||
static LPAUDIODRIVER aDriverTable[MAXDRIVERS];
|
||||
static HAC aVoiceTable[MAXVOICES];
|
||||
static UINT nNumVoices;
|
||||
|
||||
/*
|
||||
* Currently active audio device driver virtual method tables
|
||||
*/
|
||||
static UINT nDriverId = AUDIO_DEVICE_MAPPER;
|
||||
static AUDIOWAVEDRIVER WaveDriver;
|
||||
static AUDIOSYNTHDRIVER SynthDriver;
|
||||
|
||||
|
||||
/*
|
||||
* Audio device drivers API interface
|
||||
*/
|
||||
UINT AIAPI AAudioFatalError(UINT nErrorCode)
|
||||
{
|
||||
nNumVoices = 0;
|
||||
nDriverId = AUDIO_DEVICE_MAPPER;
|
||||
memset(aVoiceTable, 0, sizeof(aVoiceTable));
|
||||
memcpy(&WaveDriver, &NoneWaveDriver, sizeof(AUDIOWAVEDRIVER));
|
||||
memcpy(&SynthDriver, &NoneSynthDriver, sizeof(AUDIOSYNTHDRIVER));
|
||||
return nErrorCode;
|
||||
}
|
||||
|
||||
UINT AIAPI AGetErrorText(UINT nErrorCode, LPSTR lpText, UINT nSize)
|
||||
{
|
||||
static LPSTR aErrorTable[] =
|
||||
{
|
||||
"Unknown audio system error",
|
||||
"Bad channel or sample handle",
|
||||
"Invalid parameter passed",
|
||||
"Invalid audio system call",
|
||||
"Bad audio device identifier",
|
||||
"No audio device found",
|
||||
"Audio device is busy",
|
||||
"Bad audio data format",
|
||||
"Not enough memory",
|
||||
"Not enough device memory",
|
||||
"File not found",
|
||||
"Bad file format"
|
||||
};
|
||||
|
||||
if (lpText != NULL) {
|
||||
if (nErrorCode <= AUDIO_LAST_ERROR) {
|
||||
strncpy(lpText, aErrorTable[nErrorCode], nSize);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
strncpy(lpText, aErrorTable[AUDIO_ERROR_NONE], nSize);
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
UINT AIAPI ARegisterAudioDriver(LPAUDIODRIVER lpDriver)
|
||||
{
|
||||
UINT nDeviceId;
|
||||
|
||||
for (nDeviceId = 0; nDeviceId < MAXDRIVERS; nDeviceId++) {
|
||||
if (aDriverTable[nDeviceId] == NULL ||
|
||||
aDriverTable[nDeviceId] == lpDriver) {
|
||||
aDriverTable[nDeviceId] = lpDriver;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
return AUDIO_ERROR_NOMEMORY;
|
||||
}
|
||||
|
||||
UINT AIAPI AGetAudioNumDevs(VOID)
|
||||
{
|
||||
UINT nDeviceId, nNumDevs;
|
||||
|
||||
nNumDevs = 0;
|
||||
for (nDeviceId = 0; nDeviceId < MAXDRIVERS; nDeviceId++) {
|
||||
if (aDriverTable[nDeviceId] != NULL)
|
||||
nNumDevs++;
|
||||
}
|
||||
return nNumDevs;
|
||||
}
|
||||
|
||||
UINT AIAPI AGetAudioDevCaps(UINT nDeviceId, LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
LPAUDIODRIVER lpDriver;
|
||||
|
||||
if (lpCaps != NULL) {
|
||||
memset(lpCaps, 0, sizeof(AUDIOCAPS));
|
||||
if (nDeviceId < MAXDRIVERS) {
|
||||
if ((lpDriver = aDriverTable[nDeviceId]) != NULL) {
|
||||
if (lpDriver->lpWaveDriver != NULL) {
|
||||
return lpDriver->lpWaveDriver->GetAudioCaps(lpCaps);
|
||||
}
|
||||
else if (lpDriver->lpSynthDriver != NULL) {
|
||||
return lpDriver->lpSynthDriver->GetAudioCaps(lpCaps);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AUDIO_ERROR_BADDEVICEID;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
UINT AIAPI APingAudio(LPUINT lpnDeviceId)
|
||||
{
|
||||
LPAUDIODRIVER lpDriver;
|
||||
UINT nDeviceId;
|
||||
|
||||
if (lpnDeviceId != NULL) {
|
||||
*lpnDeviceId = AUDIO_DEVICE_NONE;
|
||||
if (nDriverId == AUDIO_DEVICE_MAPPER) {
|
||||
for (nDeviceId = MAXDRIVERS - 1; nDeviceId != 0; nDeviceId--) {
|
||||
if ((lpDriver = aDriverTable[nDeviceId]) != NULL) {
|
||||
if (lpDriver->lpWaveDriver != NULL &&
|
||||
!lpDriver->lpWaveDriver->PingAudio()) {
|
||||
*lpnDeviceId = nDeviceId;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
else if (lpDriver->lpSynthDriver != NULL &&
|
||||
!lpDriver->lpSynthDriver->PingAudio()) {
|
||||
*lpnDeviceId = nDeviceId;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
return AUDIO_ERROR_NOTSUPPORTED;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
UINT AIAPI AOpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
LPAUDIODRIVER lpDriver;
|
||||
LPAUDIOWAVEDRIVER lpWaveDriver;
|
||||
LPAUDIOSYNTHDRIVER lpSynthDriver;
|
||||
UINT nErrorCode;
|
||||
|
||||
if (nDriverId == AUDIO_DEVICE_MAPPER) {
|
||||
if (lpInfo != NULL && lpInfo->nDeviceId == AUDIO_DEVICE_MAPPER) {
|
||||
nErrorCode = APingAudio(&lpInfo->nDeviceId);
|
||||
if (nErrorCode != AUDIO_ERROR_NONE)
|
||||
return AAudioFatalError(nErrorCode);
|
||||
}
|
||||
if (lpInfo != NULL && lpInfo->nDeviceId < MAXDRIVERS) {
|
||||
if ((lpDriver = aDriverTable[lpInfo->nDeviceId]) != NULL) {
|
||||
if ((lpWaveDriver = lpDriver->lpWaveDriver) == NULL)
|
||||
lpWaveDriver = &NoneWaveDriver;
|
||||
if ((lpSynthDriver = lpDriver->lpSynthDriver) == NULL)
|
||||
lpSynthDriver = &EmuSynthDriver;
|
||||
memcpy(&WaveDriver, lpWaveDriver, sizeof(AUDIOWAVEDRIVER));
|
||||
memcpy(&SynthDriver, lpSynthDriver, sizeof(AUDIOSYNTHDRIVER));
|
||||
nErrorCode = WaveDriver.OpenAudio(lpInfo);
|
||||
if (nErrorCode != AUDIO_ERROR_NONE)
|
||||
return AAudioFatalError(nErrorCode);
|
||||
nErrorCode = SynthDriver.OpenAudio(lpInfo);
|
||||
if (nErrorCode != AUDIO_ERROR_NONE) {
|
||||
WaveDriver.CloseAudio();
|
||||
return AAudioFatalError(nErrorCode);
|
||||
}
|
||||
memset(aVoiceTable, 0, sizeof(aVoiceTable));
|
||||
nNumVoices = 0;
|
||||
nDriverId = lpInfo->nDeviceId;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
return AAudioFatalError(lpInfo != NULL ? AUDIO_ERROR_BADDEVICEID :
|
||||
AUDIO_ERROR_INVALPARAM);
|
||||
}
|
||||
return AUDIO_ERROR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
UINT AIAPI ACloseAudio(VOID)
|
||||
{
|
||||
UINT nErrorCode;
|
||||
|
||||
nDriverId = AUDIO_DEVICE_MAPPER;
|
||||
if ((nErrorCode = SynthDriver.CloseAudio()) != AUDIO_ERROR_NONE)
|
||||
return AAudioFatalError(nErrorCode);
|
||||
if ((nErrorCode = WaveDriver.CloseAudio()) != AUDIO_ERROR_NONE)
|
||||
return AAudioFatalError(nErrorCode);
|
||||
return AAudioFatalError(AUDIO_ERROR_NONE);
|
||||
}
|
||||
|
||||
UINT AIAPI AUpdateAudio(VOID)
|
||||
{
|
||||
return AUpdateAudioEx(0);
|
||||
}
|
||||
|
||||
UINT AIAPI AUpdateAudioEx(UINT nFrames)
|
||||
{
|
||||
static UINT nSemalphore = 0;
|
||||
UINT nErrorCode = AUDIO_ERROR_NONE;
|
||||
|
||||
/* TODO: This is not a real semalphore, may fail sometimes. */
|
||||
if (nDriverId != AUDIO_DEVICE_MAPPER) {
|
||||
if (!nSemalphore++) nErrorCode = WaveDriver.UpdateAudio(nFrames);
|
||||
nSemalphore--;
|
||||
}
|
||||
return nErrorCode;
|
||||
}
|
||||
|
||||
UINT AIAPI AOpenVoices(UINT nVoices)
|
||||
{
|
||||
UINT nErrorCode;
|
||||
|
||||
memset(aVoiceTable, 0, sizeof(aVoiceTable));
|
||||
if ((nErrorCode = SynthDriver.OpenVoices(nVoices)) == AUDIO_ERROR_NONE)
|
||||
nNumVoices = nVoices;
|
||||
return nErrorCode;
|
||||
}
|
||||
|
||||
UINT AIAPI ACloseVoices(VOID)
|
||||
{
|
||||
UINT nVoice;
|
||||
|
||||
for (nVoice = 0; nVoice < nNumVoices; nVoice++) {
|
||||
if (aVoiceTable[nVoice] != (HAC) NULL)
|
||||
return AUDIO_ERROR_NOTSUPPORTED;
|
||||
}
|
||||
nNumVoices = 0;
|
||||
memset(aVoiceTable, 0, sizeof(aVoiceTable));
|
||||
return SynthDriver.CloseVoices();
|
||||
}
|
||||
|
||||
UINT AIAPI ASetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
return WaveDriver.SetAudioCallback(lpfnAudioWave);
|
||||
}
|
||||
|
||||
UINT AIAPI ASetAudioTimerProc(LPFNAUDIOTIMER lpfnAudioTimer)
|
||||
{
|
||||
return SynthDriver.SetAudioTimerProc(lpfnAudioTimer);
|
||||
}
|
||||
|
||||
UINT AIAPI ASetAudioTimerRate(UINT nTimerRate)
|
||||
{
|
||||
return SynthDriver.SetAudioTimerRate(nTimerRate);
|
||||
}
|
||||
|
||||
UINT AIAPI ASetAudioMixerValue(UINT nChannel, UINT nValue)
|
||||
{
|
||||
return SynthDriver.SetAudioMixerValue(nChannel, nValue);
|
||||
}
|
||||
|
||||
LONG AIAPI AGetAudioDataAvail(VOID)
|
||||
{
|
||||
return SynthDriver.GetAudioDataAvail();
|
||||
}
|
||||
|
||||
UINT AIAPI ACreateAudioData(LPAUDIOWAVE lpWave)
|
||||
{
|
||||
UINT nErrorCode;
|
||||
|
||||
if (lpWave != NULL) {
|
||||
if ((lpWave->lpData = malloc(lpWave->dwLength + 4)) != NULL) {
|
||||
nErrorCode = SynthDriver.CreateAudioData(lpWave);
|
||||
if (nErrorCode != AUDIO_ERROR_NONE) {
|
||||
free(lpWave->lpData);
|
||||
lpWave->lpData = NULL;
|
||||
}
|
||||
return nErrorCode;
|
||||
}
|
||||
return AUDIO_ERROR_NOMEMORY;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
UINT AIAPI ADestroyAudioData(LPAUDIOWAVE lpWave)
|
||||
{
|
||||
UINT nErrorCode;
|
||||
|
||||
if (lpWave != NULL) {
|
||||
nErrorCode = SynthDriver.DestroyAudioData(lpWave);
|
||||
if (lpWave->lpData != NULL)
|
||||
free(lpWave->lpData);
|
||||
return nErrorCode;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
UINT AIAPI AWriteAudioData(LPAUDIOWAVE lpWave, DWORD dwOffset, UINT nCount)
|
||||
{
|
||||
if (lpWave != NULL && lpWave->lpData != NULL) {
|
||||
if (nCount != 0) {
|
||||
return SynthDriver.WriteAudioData(lpWave, dwOffset, nCount);
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
UINT AIAPI ACreateAudioVoice(LPHAC lphVoice)
|
||||
{
|
||||
UINT nVoice;
|
||||
|
||||
if (lphVoice != NULL) {
|
||||
for (nVoice = 0; nVoice < nNumVoices; nVoice++) {
|
||||
if (!aVoiceTable[nVoice]) {
|
||||
*lphVoice = aVoiceTable[nVoice] = (HAC) (nVoice + 1);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
return AUDIO_ERROR_NOMEMORY;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
UINT AIAPI ADestroyAudioVoice(HAC hVoice)
|
||||
{
|
||||
UINT nVoice;
|
||||
|
||||
if ((nVoice = VOICENUM(hVoice)) < nNumVoices) {
|
||||
aVoiceTable[nVoice] = (HAC) NULL;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
UINT AIAPI APlayVoice(HAC hVoice, LPAUDIOWAVE lpWave)
|
||||
{
|
||||
UINT nErrorCode;
|
||||
|
||||
if (lpWave != NULL) {
|
||||
if (!(nErrorCode = APrimeVoice(hVoice, lpWave)) &&
|
||||
!(nErrorCode = ASetVoiceFrequency(hVoice, lpWave->nSampleRate)))
|
||||
return AStartVoice(hVoice);
|
||||
return nErrorCode;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
UINT AIAPI APrimeVoice(HAC hVoice, LPAUDIOWAVE lpWave)
|
||||
{
|
||||
return SynthDriver.PrimeVoice(VOICENUM(hVoice), lpWave);
|
||||
}
|
||||
|
||||
UINT AIAPI AStartVoice(HAC hVoice)
|
||||
{
|
||||
return SynthDriver.StartVoice(VOICENUM(hVoice));
|
||||
}
|
||||
|
||||
UINT AIAPI AStopVoice(HAC hVoice)
|
||||
{
|
||||
return SynthDriver.StopVoice(VOICENUM(hVoice));
|
||||
}
|
||||
|
||||
UINT AIAPI ASetVoicePosition(HAC hVoice, LONG dwPosition)
|
||||
{
|
||||
return SynthDriver.SetVoicePosition(VOICENUM(hVoice), dwPosition);
|
||||
}
|
||||
|
||||
UINT AIAPI ASetVoiceFrequency(HAC hVoice, LONG dwFrequency)
|
||||
{
|
||||
return SynthDriver.SetVoiceFrequency(VOICENUM(hVoice), dwFrequency);
|
||||
}
|
||||
|
||||
UINT AIAPI ASetVoiceVolume(HAC hVoice, UINT nVolume)
|
||||
{
|
||||
return SynthDriver.SetVoiceVolume(VOICENUM(hVoice), nVolume);
|
||||
}
|
||||
|
||||
UINT AIAPI ASetVoicePanning(HAC hVoice, UINT nPanning)
|
||||
{
|
||||
return SynthDriver.SetVoicePanning(VOICENUM(hVoice), nPanning);
|
||||
}
|
||||
|
||||
UINT AIAPI AGetVoicePosition(HAC hVoice, LPLONG lpdwPosition)
|
||||
{
|
||||
return SynthDriver.GetVoicePosition(VOICENUM(hVoice), lpdwPosition);
|
||||
}
|
||||
|
||||
UINT AIAPI AGetVoiceFrequency(HAC hVoice, LPLONG lpdwFrequency)
|
||||
{
|
||||
return SynthDriver.GetVoiceFrequency(VOICENUM(hVoice), lpdwFrequency);
|
||||
}
|
||||
|
||||
UINT AIAPI AGetVoiceVolume(HAC hVoice, LPUINT lpnVolume)
|
||||
{
|
||||
return SynthDriver.GetVoiceVolume(VOICENUM(hVoice), lpnVolume);
|
||||
}
|
||||
|
||||
UINT AIAPI AGetVoicePanning(HAC hVoice, LPUINT lpnPanning)
|
||||
{
|
||||
return SynthDriver.GetVoicePanning(VOICENUM(hVoice), lpnPanning);
|
||||
}
|
||||
|
||||
UINT AIAPI AGetVoiceStatus(HAC hVoice, LPBOOL lpnStatus)
|
||||
{
|
||||
return SynthDriver.GetVoiceStatus(VOICENUM(hVoice), lpnStatus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* External system-dependant audio device drivers
|
||||
*/
|
||||
#ifdef __BEOS__
|
||||
extern AUDIODRIVER BeOSR3Driver;
|
||||
extern AUDIODRIVER BeOSDriver;
|
||||
#endif
|
||||
#ifdef __OS2__
|
||||
extern AUDIODRIVER OS2MMPMDriver;
|
||||
#endif
|
||||
#ifdef __LINUX__
|
||||
extern AUDIODRIVER LinuxDriver;
|
||||
#endif
|
||||
#ifdef __OSX__
|
||||
//extern AUDIODRIVER MacOSXDriver;
|
||||
extern AUDIODRIVER AllegDriver;
|
||||
#endif
|
||||
#ifdef __FREEBSD__
|
||||
extern AUDIODRIVER LinuxDriver;
|
||||
#endif
|
||||
#ifdef __SPARC__
|
||||
extern AUDIODRIVER SparcDriver;
|
||||
#endif
|
||||
#ifdef __SOLARIS__
|
||||
extern AUDIODRIVER SparcDriver;
|
||||
#endif
|
||||
#ifdef __SILICON__
|
||||
extern AUDIODRIVER SiliconDriver;
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
extern AUDIODRIVER WindowsDriver;
|
||||
extern AUDIODRIVER DirectSoundDriver;
|
||||
extern AUDIODRIVER DirectSoundAccelDriver;
|
||||
#endif
|
||||
#if defined(__DOS16__) || defined(__DPMI__)
|
||||
extern AUDIODRIVER SoundBlasterDriver;
|
||||
extern AUDIODRIVER SoundBlaster32Driver;
|
||||
extern AUDIODRIVER ProAudioSpectrumDriver;
|
||||
extern AUDIODRIVER UltraSoundDriver;
|
||||
extern AUDIODRIVER UltraSoundMaxDriver;
|
||||
extern AUDIODRIVER WinSndSystemDriver;
|
||||
extern AUDIODRIVER SoundscapeDriver;
|
||||
extern AUDIODRIVER AriaDriver;
|
||||
#endif
|
||||
#ifdef __SDL__
|
||||
extern AUDIODRIVER SDLDriver;
|
||||
#endif
|
||||
|
||||
|
||||
UINT AIAPI AGetVersion(VOID)
|
||||
{
|
||||
/* return the current hard-coded audio system version */
|
||||
return AUDIO_SYSTEM_VERSION;
|
||||
}
|
||||
|
||||
UINT AIAPI AInitialize(VOID)
|
||||
{
|
||||
#ifdef __DJGPP__
|
||||
/* 1998/12/20 lock code and data memory */
|
||||
SEAL_LOCK_MEMORY();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize all the audio system state variables,
|
||||
* and registers all the built-in audio drivers.
|
||||
*/
|
||||
if (nDriverId != AUDIO_DEVICE_MAPPER)
|
||||
return AUDIO_ERROR_NOTSUPPORTED;
|
||||
|
||||
ARegisterAudioDriver(&NoneDriver);
|
||||
#ifdef __BEOS__
|
||||
ARegisterAudioDriver(&BeOSR3Driver);
|
||||
ARegisterAudioDriver(&BeOSDriver);
|
||||
#endif
|
||||
#ifdef __OS2__
|
||||
ARegisterAudioDriver(&OS2MMPMDriver);
|
||||
#endif
|
||||
#ifdef __LINUX__
|
||||
ARegisterAudioDriver(&LinuxDriver);
|
||||
#endif
|
||||
#ifdef __OSX__
|
||||
// ARegisterAudioDriver(&MacOSXDriver);
|
||||
ARegisterAudioDriver(&AllegDriver);
|
||||
#endif
|
||||
#ifdef __FREEBSD__
|
||||
ARegisterAudioDriver(&LinuxDriver);
|
||||
#endif
|
||||
#ifdef __SPARC__
|
||||
ARegisterAudioDriver(&SparcDriver);
|
||||
#endif
|
||||
#ifdef __SOLARIS__
|
||||
ARegisterAudioDriver(&SparcDriver);
|
||||
#endif
|
||||
#ifdef __SILICON__
|
||||
ARegisterAudioDriver(&SiliconDriver);
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
ARegisterAudioDriver(&WindowsDriver);
|
||||
ARegisterAudioDriver(&DirectSoundAccelDriver);
|
||||
ARegisterAudioDriver(&DirectSoundDriver);
|
||||
#endif
|
||||
#if defined(__DOS16__) || defined(__DPMI__)
|
||||
ARegisterAudioDriver(&SoundBlasterDriver);
|
||||
ARegisterAudioDriver(&SoundBlaster32Driver);
|
||||
ARegisterAudioDriver(&ProAudioSpectrumDriver);
|
||||
ARegisterAudioDriver(&UltraSoundMaxDriver);
|
||||
ARegisterAudioDriver(&UltraSoundDriver);
|
||||
ARegisterAudioDriver(&WinSndSystemDriver);
|
||||
ARegisterAudioDriver(&SoundscapeDriver);
|
||||
ARegisterAudioDriver(&AriaDriver);
|
||||
#endif
|
||||
#ifdef __SDL__
|
||||
ARegisterAudioDriver(&SDLDriver);
|
||||
#endif
|
||||
|
||||
return AAudioFatalError(AUDIO_ERROR_NONE);
|
||||
}
|
||||
@ -1,391 +0,0 @@
|
||||
/*
|
||||
* $Id: audio.h 1.17 1996/09/25 17:13:02 chasan released $
|
||||
* 1.18 1998/10/12 23:54:08 chasan released
|
||||
* 1.19 1998/10/24 18:20:52 chasan released
|
||||
* 1.20 1999/06/27 17:49:49 chasan released
|
||||
*
|
||||
* SEAL Synthetic Audio Library API Interface
|
||||
*
|
||||
* Copyright (C) 1995, 1996, 1997, 1998, 1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __AUDIO_H
|
||||
#define __AUDIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#define AIAPI
|
||||
#else
|
||||
#define AIAPI __stdcall
|
||||
#endif
|
||||
|
||||
#ifndef WINAPI
|
||||
|
||||
/* atomic data types definitions */
|
||||
#if 0
|
||||
typedef void VOID;
|
||||
typedef char CHAR;
|
||||
typedef int INT;
|
||||
typedef long LONG;
|
||||
typedef int BOOL;
|
||||
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned long DWORD;
|
||||
#else
|
||||
typedef void VOID;
|
||||
typedef char CHAR;
|
||||
typedef int32_t INT;
|
||||
typedef int32_t LONG;
|
||||
typedef int8_t BOOL;
|
||||
|
||||
typedef uint8_t BYTE;
|
||||
typedef uint16_t WORD;
|
||||
typedef uint16_t UINT;
|
||||
typedef uint32_t DWORD;
|
||||
#endif
|
||||
typedef VOID* LPVOID;
|
||||
typedef CHAR* LPCHAR;
|
||||
typedef INT* LPINT;
|
||||
typedef LONG* LPLONG;
|
||||
typedef BOOL* LPBOOL;
|
||||
typedef BYTE* LPBYTE;
|
||||
typedef WORD* LPWORD;
|
||||
typedef UINT* LPUINT;
|
||||
typedef DWORD* LPDWORD;
|
||||
typedef char* LPSTR;
|
||||
typedef uintptr_t HANDLE;
|
||||
|
||||
/* helper macros */
|
||||
#define LOBYTE(s) ((BYTE)(s))
|
||||
#define HIBYTE(s) ((BYTE)((WORD)(s)>>8))
|
||||
#define LOWORD(l) ((WORD)(l))
|
||||
#define HIWORD(l) ((WORD)((DWORD)(l)>>16))
|
||||
#define MAKEWORD(l,h) ((WORD)(((BYTE)(l))|(((WORD)((BYTE)(h)))<<8)))
|
||||
#define MAKELONG(l,h) ((DWORD)(((WORD)(l))|(((DWORD)((WORD)(h)))<<16)))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* audio system version number */
|
||||
#define AUDIO_SYSTEM_VERSION 0x0106
|
||||
|
||||
/* audio capabilities bit fields definitions */
|
||||
#define AUDIO_FORMAT_1M08 0x00000001
|
||||
#define AUDIO_FORMAT_1S08 0x00000002
|
||||
#define AUDIO_FORMAT_1M16 0x00000004
|
||||
#define AUDIO_FORMAT_1S16 0x00000008
|
||||
#define AUDIO_FORMAT_2M08 0x00000010
|
||||
#define AUDIO_FORMAT_2S08 0x00000020
|
||||
#define AUDIO_FORMAT_2M16 0x00000040
|
||||
#define AUDIO_FORMAT_2S16 0x00000080
|
||||
#define AUDIO_FORMAT_4M08 0x00000100
|
||||
#define AUDIO_FORMAT_4S08 0x00000200
|
||||
#define AUDIO_FORMAT_4M16 0x00000400
|
||||
#define AUDIO_FORMAT_4S16 0x00000800
|
||||
|
||||
/* audio format bit fields defines for devices and waveforms */
|
||||
#define AUDIO_FORMAT_8BITS 0x0000
|
||||
#define AUDIO_FORMAT_16BITS 0x0001
|
||||
#define AUDIO_FORMAT_LOOP 0x0010
|
||||
#define AUDIO_FORMAT_BIDILOOP 0x0020
|
||||
#define AUDIO_FORMAT_REVERSE 0x0080
|
||||
#define AUDIO_FORMAT_MONO 0x0000
|
||||
#define AUDIO_FORMAT_STEREO 0x0100
|
||||
#define AUDIO_FORMAT_FILTER 0x8000
|
||||
|
||||
/* audio resource limits defines */
|
||||
#define AUDIO_MAX_VOICES 32
|
||||
#define AUDIO_MAX_SAMPLES 16
|
||||
#define AUDIO_MAX_PATCHES 128
|
||||
#define AUDIO_MAX_PATTERNS 256
|
||||
#define AUDIO_MAX_ORDERS 256
|
||||
#define AUDIO_MAX_NOTES 96
|
||||
#define AUDIO_MAX_POINTS 12
|
||||
#define AUDIO_MIN_PERIOD 1
|
||||
#define AUDIO_MAX_PERIOD 31999
|
||||
#define AUDIO_MIN_VOLUME 0x00
|
||||
#define AUDIO_MAX_VOLUME 0x40
|
||||
#define AUDIO_MIN_PANNING 0x00
|
||||
#define AUDIO_MAX_PANNING 0xFF
|
||||
#define AUDIO_MIN_POSITION 0x00000000L
|
||||
#define AUDIO_MAX_POSITION 0x00100000L
|
||||
#define AUDIO_MIN_FREQUENCY 0x00000200L
|
||||
#define AUDIO_MAX_FREQUENCY 0x00080000L
|
||||
|
||||
/* audio error code defines */
|
||||
#define AUDIO_ERROR_NONE 0x0000
|
||||
#define AUDIO_ERROR_INVALHANDLE 0x0001
|
||||
#define AUDIO_ERROR_INVALPARAM 0x0002
|
||||
#define AUDIO_ERROR_NOTSUPPORTED 0x0003
|
||||
#define AUDIO_ERROR_BADDEVICEID 0x0004
|
||||
#define AUDIO_ERROR_NODEVICE 0x0005
|
||||
#define AUDIO_ERROR_DEVICEBUSY 0x0006
|
||||
#define AUDIO_ERROR_BADFORMAT 0x0007
|
||||
#define AUDIO_ERROR_NOMEMORY 0x0008
|
||||
#define AUDIO_ERROR_NODRAMMEMORY 0x0009
|
||||
#define AUDIO_ERROR_FILENOTFOUND 0x000A
|
||||
#define AUDIO_ERROR_BADFILEFORMAT 0x000B
|
||||
#define AUDIO_LAST_ERROR 0x000B
|
||||
|
||||
/* audio device identifiers */
|
||||
#define AUDIO_DEVICE_NONE 0x0000
|
||||
#define AUDIO_DEVICE_MAPPER 0xFFFF
|
||||
|
||||
/* audio product identifiers */
|
||||
#define AUDIO_PRODUCT_NONE 0x0000
|
||||
#define AUDIO_PRODUCT_SB 0x0001
|
||||
#define AUDIO_PRODUCT_SB15 0x0002
|
||||
#define AUDIO_PRODUCT_SB20 0x0003
|
||||
#define AUDIO_PRODUCT_SBPRO 0x0004
|
||||
#define AUDIO_PRODUCT_SB16 0x0005
|
||||
#define AUDIO_PRODUCT_AWE32 0x0006
|
||||
#define AUDIO_PRODUCT_WSS 0x0007
|
||||
#define AUDIO_PRODUCT_ESS 0x0008
|
||||
#define AUDIO_PRODUCT_GUS 0x0009
|
||||
#define AUDIO_PRODUCT_GUSDB 0x000A
|
||||
#define AUDIO_PRODUCT_GUSMAX 0x000B
|
||||
#define AUDIO_PRODUCT_IWAVE 0x000C
|
||||
#define AUDIO_PRODUCT_PAS 0x000D
|
||||
#define AUDIO_PRODUCT_PAS16 0x000E
|
||||
#define AUDIO_PRODUCT_ARIA 0x000F
|
||||
#define AUDIO_PRODUCT_WINDOWS 0x0100
|
||||
#define AUDIO_PRODUCT_LINUX 0x0101
|
||||
#define AUDIO_PRODUCT_SPARC 0x0102
|
||||
#define AUDIO_PRODUCT_SGI 0x0103
|
||||
#define AUDIO_PRODUCT_DSOUND 0x0104
|
||||
#define AUDIO_PRODUCT_OS2MMPM 0x0105
|
||||
#define AUDIO_PRODUCT_OS2DART 0x0106
|
||||
#define AUDIO_PRODUCT_BEOSR3 0x0107
|
||||
#define AUDIO_PRODUCT_BEOS 0x0108
|
||||
#define AUDIO_PRODUCT_QNX 0x0109
|
||||
|
||||
/* audio mixer channels */
|
||||
#define AUDIO_MIXER_MASTER_VOLUME 0x0001
|
||||
#define AUDIO_MIXER_TREBLE 0x0002
|
||||
#define AUDIO_MIXER_BASS 0x0003
|
||||
#define AUDIO_MIXER_CHORUS 0x0004
|
||||
#define AUDIO_MIXER_REVERB 0x0005
|
||||
|
||||
/* audio envelope bit fields */
|
||||
#define AUDIO_ENVELOPE_ON 0x0001
|
||||
#define AUDIO_ENVELOPE_SUSTAIN 0x0002
|
||||
#define AUDIO_ENVELOPE_LOOP 0x0004
|
||||
|
||||
/* audio pattern bit fields */
|
||||
#define AUDIO_PATTERN_PACKED 0x0080
|
||||
#define AUDIO_PATTERN_NOTE 0x0001
|
||||
#define AUDIO_PATTERN_SAMPLE 0x0002
|
||||
#define AUDIO_PATTERN_VOLUME 0x0004
|
||||
#define AUDIO_PATTERN_COMMAND 0x0008
|
||||
#define AUDIO_PATTERN_PARAMS 0x0010
|
||||
|
||||
/* audio module bit fields */
|
||||
#define AUDIO_MODULE_AMIGA 0x0000
|
||||
#define AUDIO_MODULE_LINEAR 0x0001
|
||||
#define AUDIO_MODULE_PANNING 0x8000
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* audio capabilities structure */
|
||||
typedef struct {
|
||||
WORD wProductId; /* product identifier */
|
||||
CHAR szProductName[30]; /* product name */
|
||||
DWORD dwFormats; /* formats supported */
|
||||
} AUDIOCAPS, *LPAUDIOCAPS;
|
||||
|
||||
/* audio format structure */
|
||||
typedef struct {
|
||||
UINT nDeviceId; /* device identifier */
|
||||
WORD wFormat; /* playback format */
|
||||
WORD nSampleRate; /* sampling frequency */
|
||||
} AUDIOINFO, *LPAUDIOINFO;
|
||||
|
||||
/* audio waveform structure */
|
||||
typedef struct {
|
||||
LPBYTE lpData; /* data pointer */
|
||||
uintptr_t dwHandle; /* waveform handle */
|
||||
DWORD dwLength; /* waveform length */
|
||||
DWORD dwLoopStart; /* loop start point */
|
||||
DWORD dwLoopEnd; /* loop end point */
|
||||
WORD nSampleRate; /* sampling rate */
|
||||
WORD wFormat; /* format bits */
|
||||
} AUDIOWAVE, *LPAUDIOWAVE;
|
||||
|
||||
|
||||
/* audio envelope point structure */
|
||||
typedef struct {
|
||||
WORD nFrame; /* envelope frame */
|
||||
WORD nValue; /* envelope value */
|
||||
} AUDIOPOINT, *LPAUDIOPOINT;
|
||||
|
||||
/* audio envelope structure */
|
||||
typedef struct {
|
||||
AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */
|
||||
BYTE nPoints; /* number of points */
|
||||
BYTE nSustain; /* sustain point */
|
||||
BYTE nLoopStart; /* loop start point */
|
||||
BYTE nLoopEnd; /* loop end point */
|
||||
WORD wFlags; /* envelope flags */
|
||||
WORD nSpeed; /* envelope speed */
|
||||
} AUDIOENVELOPE, *LPAUDIOENVELOPE;
|
||||
|
||||
/* audio sample structure */
|
||||
typedef struct {
|
||||
CHAR szSampleName[32]; /* sample name */
|
||||
BYTE nVolume; /* default volume */
|
||||
BYTE nPanning; /* default panning */
|
||||
BYTE nRelativeNote; /* relative note */
|
||||
BYTE nFinetune; /* finetune */
|
||||
AUDIOWAVE Wave; /* waveform handle */
|
||||
} AUDIOSAMPLE, *LPAUDIOSAMPLE;
|
||||
|
||||
/* audio patch structure */
|
||||
typedef struct {
|
||||
CHAR szPatchName[32]; /* patch name */
|
||||
BYTE aSampleNumber[AUDIO_MAX_NOTES]; /* multi-sample table */
|
||||
WORD nSamples; /* number of samples */
|
||||
BYTE nVibratoType; /* vibrato type */
|
||||
BYTE nVibratoSweep; /* vibrato sweep */
|
||||
BYTE nVibratoDepth; /* vibrato depth */
|
||||
BYTE nVibratoRate; /* vibrato rate */
|
||||
WORD nVolumeFadeout; /* volume fadeout */
|
||||
AUDIOENVELOPE Volume; /* volume envelope */
|
||||
AUDIOENVELOPE Panning; /* panning envelope */
|
||||
LPAUDIOSAMPLE aSampleTable; /* sample table */
|
||||
} AUDIOPATCH, *LPAUDIOPATCH;
|
||||
|
||||
/* audio pattern structure */
|
||||
typedef struct {
|
||||
WORD nPacking; /* packing type */
|
||||
WORD nTracks; /* number of tracks */
|
||||
WORD nRows; /* number of rows */
|
||||
WORD nSize; /* data size */
|
||||
LPBYTE lpData; /* data pointer */
|
||||
} AUDIOPATTERN, *LPAUDIOPATTERN;
|
||||
|
||||
/* audio module structure */
|
||||
typedef struct {
|
||||
char szModuleName[32]; /* module name */
|
||||
WORD wFlags; /* module flags */
|
||||
WORD nOrders; /* number of orders */
|
||||
WORD nRestart; /* restart position */
|
||||
WORD nTracks; /* number of tracks */
|
||||
WORD nPatterns; /* number of patterns */
|
||||
WORD nPatches; /* number of patches */
|
||||
WORD nTempo; /* initial tempo */
|
||||
WORD nBPM; /* initial BPM */
|
||||
BYTE aOrderTable[AUDIO_MAX_ORDERS]; /* order table */
|
||||
BYTE aPanningTable[AUDIO_MAX_VOICES]; /* panning table */
|
||||
LPAUDIOPATTERN aPatternTable; /* pattern table */
|
||||
LPAUDIOPATCH aPatchTable; /* patch table */
|
||||
} AUDIOMODULE, *LPAUDIOMODULE;
|
||||
|
||||
/* audio music track structure */
|
||||
typedef struct {
|
||||
BYTE nNote; /* note index */
|
||||
BYTE nPatch; /* patch number */
|
||||
BYTE nSample; /* sample number */
|
||||
BYTE nCommand; /* effect command */
|
||||
BYTE bParams; /* effect params */
|
||||
BYTE nVolumeCmd; /* volume command */
|
||||
BYTE nVolume; /* volume level */
|
||||
BYTE nPanning; /* stereo panning */
|
||||
LONG dwFrequency; /* note frequency */
|
||||
WORD wPeriod; /* note period */
|
||||
} AUDIOTRACK, *LPAUDIOTRACK;
|
||||
|
||||
/* audio callback function defines */
|
||||
typedef VOID (AIAPI* LPFNAUDIOWAVE)(LPBYTE, UINT);
|
||||
typedef VOID (AIAPI* LPFNAUDIOTIMER)(VOID);
|
||||
typedef VOID (AIAPI* LPFNAUDIOCALLBACK)(BYTE, UINT, UINT);
|
||||
|
||||
/* audio handle defines */
|
||||
typedef HANDLE HAC;
|
||||
typedef HAC* LPHAC;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* audio interface API prototypes */
|
||||
UINT AIAPI AInitialize(VOID);
|
||||
UINT AIAPI AGetVersion(VOID);
|
||||
UINT AIAPI AGetAudioNumDevs(VOID);
|
||||
UINT AIAPI AGetAudioDevCaps(UINT nDeviceId, LPAUDIOCAPS lpCaps);
|
||||
UINT AIAPI AGetErrorText(UINT nErrorCode, LPSTR lpText, UINT nSize);
|
||||
|
||||
UINT AIAPI APingAudio(LPUINT lpnDeviceId);
|
||||
UINT AIAPI AOpenAudio(LPAUDIOINFO lpInfo);
|
||||
UINT AIAPI ACloseAudio(VOID);
|
||||
UINT AIAPI AUpdateAudio(VOID);
|
||||
UINT AIAPI AUpdateAudioEx(UINT nFrames);
|
||||
|
||||
UINT AIAPI ASetAudioMixerValue(UINT nChannel, UINT nValue);
|
||||
|
||||
UINT AIAPI AOpenVoices(UINT nVoices);
|
||||
UINT AIAPI ACloseVoices(VOID);
|
||||
|
||||
UINT AIAPI ASetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave);
|
||||
UINT AIAPI ASetAudioTimerProc(LPFNAUDIOTIMER lpfnAudioTimer);
|
||||
UINT AIAPI ASetAudioTimerRate(UINT nTimerRate);
|
||||
|
||||
LONG AIAPI AGetAudioDataAvail(VOID);
|
||||
UINT AIAPI ACreateAudioData(LPAUDIOWAVE lpWave);
|
||||
UINT AIAPI ADestroyAudioData(LPAUDIOWAVE lpWave);
|
||||
UINT AIAPI AWriteAudioData(LPAUDIOWAVE lpWave, DWORD dwOffset, UINT nCount);
|
||||
|
||||
UINT AIAPI ACreateAudioVoice(LPHAC lphVoice);
|
||||
UINT AIAPI ADestroyAudioVoice(HAC hVoice);
|
||||
|
||||
UINT AIAPI APlayVoice(HAC hVoice, LPAUDIOWAVE lpWave);
|
||||
UINT AIAPI APrimeVoice(HAC hVoice, LPAUDIOWAVE lpWave);
|
||||
UINT AIAPI AStartVoice(HAC hVoice);
|
||||
UINT AIAPI AStopVoice(HAC hVoice);
|
||||
|
||||
UINT AIAPI ASetVoicePosition(HAC hVoice, LONG dwPosition);
|
||||
UINT AIAPI ASetVoiceFrequency(HAC hVoice, LONG dwFrequency);
|
||||
UINT AIAPI ASetVoiceVolume(HAC hVoice, UINT nVolume);
|
||||
UINT AIAPI ASetVoicePanning(HAC hVoice, UINT nPanning);
|
||||
|
||||
UINT AIAPI AGetVoicePosition(HAC hVoice, LPLONG lpdwPosition);
|
||||
UINT AIAPI AGetVoiceFrequency(HAC hVoice, LPLONG lpdwFrequency);
|
||||
UINT AIAPI AGetVoiceVolume(HAC hVoice, LPUINT lpnVolume);
|
||||
UINT AIAPI AGetVoicePanning(HAC hVoice, LPUINT lpnPanning);
|
||||
UINT AIAPI AGetVoiceStatus(HAC hVoice, LPBOOL lpnStatus);
|
||||
|
||||
UINT AIAPI APlayModule(LPAUDIOMODULE lpModule);
|
||||
UINT AIAPI AStopModule(VOID);
|
||||
UINT AIAPI APauseModule(VOID);
|
||||
UINT AIAPI AResumeModule(VOID);
|
||||
UINT AIAPI ASetModuleVolume(UINT nVolume);
|
||||
UINT AIAPI ASetModulePosition(UINT nOrder, UINT nRow);
|
||||
UINT AIAPI AGetModuleVolume(LPUINT lpnVolume);
|
||||
UINT AIAPI AGetModulePosition(LPUINT pnOrder, LPUINT lpnRow);
|
||||
UINT AIAPI AGetModuleStatus(LPBOOL lpnStatus);
|
||||
UINT AIAPI ASetModuleCallback(LPFNAUDIOCALLBACK lpfnAudioCallback);
|
||||
|
||||
UINT AIAPI ALoadModuleFile(LPSTR lpszFileName,
|
||||
LPAUDIOMODULE* lplpModule, DWORD dwFileOffset);
|
||||
UINT AIAPI AFreeModuleFile(LPAUDIOMODULE lpModule);
|
||||
|
||||
UINT AIAPI ALoadWaveFile(LPSTR lpszFileName,
|
||||
LPAUDIOWAVE* lplpWave, DWORD dwFileOffset);
|
||||
UINT AIAPI AFreeWaveFile(LPAUDIOWAVE lpWave);
|
||||
|
||||
UINT AIAPI AGetModuleTrack(UINT nTrack, LPAUDIOTRACK lpTrack);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,383 +0,0 @@
|
||||
/*
|
||||
* @(#)audiodj.c 0.2 1998/12/20 Carlos Hasan (chasan@dcc.uchile.cl)
|
||||
*
|
||||
* Hack for DJGPP 2.01 to lock code and data into a contiguous memory region.
|
||||
*
|
||||
* Copyright (C) 1998-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <dpmi.h>
|
||||
#include <sys/nearptr.h>
|
||||
|
||||
static int __SEAL_BSS_BEGIN;
|
||||
static int __SEAL_DATA_BEGIN = 0xCafe;
|
||||
static int __SEAL_TEXT_BEGIN(void) { return 0; }
|
||||
|
||||
static void SEAL_LOCK_MEMORY(void);
|
||||
|
||||
#include "audio.c"
|
||||
#include "wavfile.c"
|
||||
#include "xmfile.c"
|
||||
#include "s3mfile.c"
|
||||
#include "modfile.c"
|
||||
#include "mtmfile.c"
|
||||
#include "iofile.c"
|
||||
#include "modeng.c"
|
||||
|
||||
#undef BUFFERSIZE
|
||||
#undef CLIP
|
||||
#undef TIMEOUT
|
||||
#undef DEBUG
|
||||
|
||||
#undef GetAudioCaps
|
||||
#undef PingAudio
|
||||
#undef OpenAudio
|
||||
#undef CloseAudio
|
||||
#undef UpdateAudio
|
||||
#undef SetAudioCallback
|
||||
|
||||
#define GetAudioCaps noneGetAudioCaps
|
||||
#define PingAudio nonePingAudio
|
||||
#define OpenAudio noneOpenAudio
|
||||
#define CloseAudio noneCloseAudio
|
||||
#define UpdateAudio noneUpdateAudio
|
||||
#define SetAudioCallback noneSetAudioCallback
|
||||
|
||||
#include "nondrv.c"
|
||||
|
||||
#undef BUFFERSIZE
|
||||
#undef CLIP
|
||||
#undef TIMEOUT
|
||||
#undef DEBUG
|
||||
|
||||
#undef GetAudioCaps
|
||||
#undef PingAudio
|
||||
#undef OpenAudio
|
||||
#undef CloseAudio
|
||||
#undef UpdateAudio
|
||||
#undef SetAudioCallback
|
||||
|
||||
#define GetAudioCaps sbGetAudioCaps
|
||||
#define PingAudio sbPingAudio
|
||||
#define OpenAudio sbOpenAudio
|
||||
#define CloseAudio sbCloseAudio
|
||||
#define UpdateAudio sbUpdateAudio
|
||||
#define SetAudioCallback sbSetAudioCallback
|
||||
|
||||
#include "sbdrv.c"
|
||||
|
||||
#undef BUFFERSIZE
|
||||
#undef CLIP
|
||||
#undef TIMEOUT
|
||||
#undef DEBUG
|
||||
|
||||
#undef GetAudioCaps
|
||||
#undef PingAudio
|
||||
#undef OpenAudio
|
||||
#undef CloseAudio
|
||||
#undef UpdateAudio
|
||||
#undef SetAudioCallback
|
||||
|
||||
#define GetAudioCaps pasGetAudioCaps
|
||||
#define PingAudio pasPingAudio
|
||||
#define OpenAudio pasOpenAudio
|
||||
#define CloseAudio pasCloseAudio
|
||||
#define UpdateAudio pasUpdateAudio
|
||||
#define SetAudioCallback pasSetAudioCallback
|
||||
|
||||
#include "pasdrv.c"
|
||||
|
||||
#undef BUFFERSIZE
|
||||
#undef CLIP
|
||||
#undef TIMEOUT
|
||||
#undef DEBUG
|
||||
|
||||
#undef GetAudioCaps
|
||||
#undef PingAudio
|
||||
#undef OpenAudio
|
||||
#undef CloseAudio
|
||||
#undef UpdateAudio
|
||||
#undef SetAudioCallback
|
||||
|
||||
#define GetAudioCaps wssGetAudioCaps
|
||||
#define PingAudio wssPingAudio
|
||||
#define OpenAudio wssOpenAudio
|
||||
#define CloseAudio wssCloseAudio
|
||||
#define UpdateAudio wssUpdateAudio
|
||||
#define SetAudioCallback wssSetAudioCallback
|
||||
|
||||
#include "wssdrv.c"
|
||||
|
||||
#undef BUFFERSIZE
|
||||
#undef CLIP
|
||||
#undef TIMEOUT
|
||||
#undef DEBUG
|
||||
|
||||
#undef GetAudioCaps
|
||||
#undef PingAudio
|
||||
#undef OpenAudio
|
||||
#undef CloseAudio
|
||||
#undef UpdateAudio
|
||||
#undef SetAudioCallback
|
||||
|
||||
#define GetAudioCaps ariaGetAudioCaps
|
||||
#define PingAudio ariaPingAudio
|
||||
#define OpenAudio ariaOpenAudio
|
||||
#define CloseAudio ariaCloseAudio
|
||||
#define UpdateAudio ariaUpdateAudio
|
||||
#define SetAudioCallback ariaSetAudioCallback
|
||||
|
||||
#include "ariadrv.c"
|
||||
|
||||
|
||||
#undef BUFFERSIZE
|
||||
#undef CLIP
|
||||
#undef TIMEOUT
|
||||
#undef DEBUG
|
||||
|
||||
#undef VOICE_START
|
||||
#undef VOICE_STOP
|
||||
#undef VOICE_LOOP
|
||||
#undef VOICE_BIDILOOP
|
||||
|
||||
#undef aVolumeTable
|
||||
#undef aFrequencyTable
|
||||
|
||||
#define aVolumeTable mixVolumeTable
|
||||
#define aFrequencyTable mixFrequencyTable
|
||||
|
||||
#undef GetAudioCaps
|
||||
#undef PingAudio
|
||||
#undef OpenAudio
|
||||
#undef CloseAudio
|
||||
#undef UpdateAudio
|
||||
#undef SetAudioCallback
|
||||
#undef SetAudioMixerValue
|
||||
#undef OpenVoices
|
||||
#undef CloseVoices
|
||||
#undef GetAudioDataAvail
|
||||
#undef CreateAudioData
|
||||
#undef DestroyAudioData
|
||||
#undef WriteAudioData
|
||||
#undef PrimeVoice
|
||||
#undef StartVoice
|
||||
#undef StopVoice
|
||||
#undef SetVoicePosition
|
||||
#undef SetVoiceFrequency
|
||||
#undef SetVoiceVolume
|
||||
#undef SetVoicePanning
|
||||
#undef GetVoicePosition
|
||||
#undef GetVoiceFrequency
|
||||
#undef GetVoiceVolume
|
||||
#undef GetVoicePanning
|
||||
#undef GetVoiceStatus
|
||||
#undef SetAudioTimerProc
|
||||
#undef SetAudioTimerRate
|
||||
|
||||
#define GetAudioCaps mixGetAudioCaps
|
||||
#define PingAudio mixPingAudio
|
||||
#define OpenAudio mixOpenAudio
|
||||
#define CloseAudio mixCloseAudio
|
||||
#define UpdateAudio mixUpdateAudio
|
||||
#define SetAudioCallback mixSetAudioCallback
|
||||
#define SetAudioMixerValue mixSetAudioMixerValue
|
||||
#define OpenVoices mixOpenVoices
|
||||
#define CloseVoices mixCloseVoices
|
||||
#define GetAudioDataAvail mixGetAudioDataAvail
|
||||
#define CreateAudioData mixCreateAudioData
|
||||
#define DestroyAudioData mixDestroyAudioData
|
||||
#define WriteAudioData mixWriteAudioData
|
||||
#define PrimeVoice mixPrimeVoice
|
||||
#define StartVoice mixStartVoice
|
||||
#define StopVoice mixStopVoice
|
||||
#define SetVoicePosition mixSetVoicePosition
|
||||
#define SetVoiceFrequency mixSetVoiceFrequency
|
||||
#define SetVoiceVolume mixSetVoiceVolume
|
||||
#define SetVoicePanning mixSetVoicePanning
|
||||
#define GetVoicePosition mixGetVoicePosition
|
||||
#define GetVoiceFrequency mixGetVoiceFrequency
|
||||
#define GetVoiceVolume mixGetVoiceVolume
|
||||
#define GetVoicePanning mixGetVoicePanning
|
||||
#define GetVoiceStatus mixGetVoiceStatus
|
||||
#define SetAudioTimerProc mixSetAudioTimerProc
|
||||
#define SetAudioTimerRate mixSetAudioTimerRate
|
||||
|
||||
#include "mixdrv.c"
|
||||
|
||||
#undef BUFFERSIZE
|
||||
#undef CLIP
|
||||
#undef TIMEOUT
|
||||
#undef DEBUG
|
||||
|
||||
#undef VOICE_START
|
||||
#undef VOICE_STOP
|
||||
#undef VOICE_LOOP
|
||||
#undef VOICE_BIDILOOP
|
||||
|
||||
#undef aVolumeTable
|
||||
#undef aFrequencyTable
|
||||
|
||||
#define aVolumeTable aweVolumeTable
|
||||
#define aFrequencyTable aweFrequencyTable
|
||||
|
||||
#undef GetAudioCaps
|
||||
#undef PingAudio
|
||||
#undef OpenAudio
|
||||
#undef CloseAudio
|
||||
#undef UpdateAudio
|
||||
#undef SetAudioCallback
|
||||
#undef SetAudioMixerValue
|
||||
#undef OpenVoices
|
||||
#undef CloseVoices
|
||||
#undef GetAudioDataAvail
|
||||
#undef CreateAudioData
|
||||
#undef DestroyAudioData
|
||||
#undef WriteAudioData
|
||||
#undef PrimeVoice
|
||||
#undef StartVoice
|
||||
#undef StopVoice
|
||||
#undef SetVoicePosition
|
||||
#undef SetVoiceFrequency
|
||||
#undef SetVoiceVolume
|
||||
#undef SetVoicePanning
|
||||
#undef GetVoicePosition
|
||||
#undef GetVoiceFrequency
|
||||
#undef GetVoiceVolume
|
||||
#undef GetVoicePanning
|
||||
#undef GetVoiceStatus
|
||||
#undef SetAudioTimerProc
|
||||
#undef SetAudioTimerRate
|
||||
|
||||
#define GetAudioCaps aweGetAudioCaps
|
||||
#define PingAudio awePingAudio
|
||||
#define OpenAudio aweOpenAudio
|
||||
#define CloseAudio aweCloseAudio
|
||||
#define UpdateAudio aweUpdateAudio
|
||||
#define SetAudioCallback aweSetAudioCallback
|
||||
#define SetAudioMixerValue aweSetAudioMixerValue
|
||||
#define OpenVoices aweOpenVoices
|
||||
#define CloseVoices aweCloseVoices
|
||||
#define GetAudioDataAvail aweGetAudioDataAvail
|
||||
#define CreateAudioData aweCreateAudioData
|
||||
#define DestroyAudioData aweDestroyAudioData
|
||||
#define WriteAudioData aweWriteAudioData
|
||||
#define PrimeVoice awePrimeVoice
|
||||
#define StartVoice aweStartVoice
|
||||
#define StopVoice aweStopVoice
|
||||
#define SetVoicePosition aweSetVoicePosition
|
||||
#define SetVoiceFrequency aweSetVoiceFrequency
|
||||
#define SetVoiceVolume aweSetVoiceVolume
|
||||
#define SetVoicePanning aweSetVoicePanning
|
||||
#define GetVoicePosition aweGetVoicePosition
|
||||
#define GetVoiceFrequency aweGetVoiceFrequency
|
||||
#define GetVoiceVolume aweGetVoiceVolume
|
||||
#define GetVoicePanning aweGetVoicePanning
|
||||
#define GetVoiceStatus aweGetVoiceStatus
|
||||
#define SetAudioTimerProc aweSetAudioTimerProc
|
||||
#define SetAudioTimerRate aweSetAudioTimerRate
|
||||
|
||||
#include "awedrv.c"
|
||||
|
||||
#undef BUFFERSIZE
|
||||
#undef CLIP
|
||||
#undef TIMEOUT
|
||||
#undef DEBUG
|
||||
|
||||
#undef VOICE_START
|
||||
#undef VOICE_STOP
|
||||
#undef VOICE_LOOP
|
||||
#undef VOICE_BIDILOOP
|
||||
|
||||
#undef aVolumeTable
|
||||
#undef aFrequencyTable
|
||||
|
||||
#define aVolumeTable gusVolumeTable
|
||||
#define aFrequencyTable gusFrequencyTable
|
||||
|
||||
#undef GetAudioCaps
|
||||
#undef PingAudio
|
||||
#undef OpenAudio
|
||||
#undef CloseAudio
|
||||
#undef UpdateAudio
|
||||
#undef SetAudioCallback
|
||||
#undef SetAudioMixerValue
|
||||
#undef OpenVoices
|
||||
#undef CloseVoices
|
||||
#undef GetAudioDataAvail
|
||||
#undef CreateAudioData
|
||||
#undef DestroyAudioData
|
||||
#undef WriteAudioData
|
||||
#undef PrimeVoice
|
||||
#undef StartVoice
|
||||
#undef StopVoice
|
||||
#undef SetVoicePosition
|
||||
#undef SetVoiceFrequency
|
||||
#undef SetVoiceVolume
|
||||
#undef SetVoicePanning
|
||||
#undef GetVoicePosition
|
||||
#undef GetVoiceFrequency
|
||||
#undef GetVoiceVolume
|
||||
#undef GetVoicePanning
|
||||
#undef GetVoiceStatus
|
||||
#undef SetAudioTimerProc
|
||||
#undef SetAudioTimerRate
|
||||
|
||||
#define GetAudioCaps gusGetAudioCaps
|
||||
#define PingAudio gusPingAudio
|
||||
#define OpenAudio gusOpenAudio
|
||||
#define CloseAudio gusCloseAudio
|
||||
#define UpdateAudio gusUpdateAudio
|
||||
#define SetAudioCallback gusSetAudioCallback
|
||||
#define SetAudioMixerValue gusSetAudioMixerValue
|
||||
#define OpenVoices gusOpenVoices
|
||||
#define CloseVoices gusCloseVoices
|
||||
#define GetAudioDataAvail gusGetAudioDataAvail
|
||||
#define CreateAudioData gusCreateAudioData
|
||||
#define DestroyAudioData gusDestroyAudioData
|
||||
#define WriteAudioData gusWriteAudioData
|
||||
#define PrimeVoice gusPrimeVoice
|
||||
#define StartVoice gusStartVoice
|
||||
#define StopVoice gusStopVoice
|
||||
#define SetVoicePosition gusSetVoicePosition
|
||||
#define SetVoiceFrequency gusSetVoiceFrequency
|
||||
#define SetVoiceVolume gusSetVoiceVolume
|
||||
#define SetVoicePanning gusSetVoicePanning
|
||||
#define GetVoicePosition gusGetVoicePosition
|
||||
#define GetVoiceFrequency gusGetVoiceFrequency
|
||||
#define GetVoiceVolume gusGetVoiceVolume
|
||||
#define GetVoicePanning gusGetVoicePanning
|
||||
#define GetVoiceStatus gusGetVoiceStatus
|
||||
#define SetAudioTimerProc gusSetAudioTimerProc
|
||||
#define SetAudioTimerRate gusSetAudioTimerRate
|
||||
|
||||
#include "gusdrv.c"
|
||||
|
||||
|
||||
#include "msdos.c"
|
||||
|
||||
static int __SEAL_BSS_END;
|
||||
static int __SEAL_DATA_END = 0xCafe;
|
||||
static int __SEAL_TEXT_END(void) { return 0; }
|
||||
|
||||
static void SEAL_LOCK_MEMORY(void)
|
||||
{
|
||||
/* lock in host memory the text, data and bss segments */
|
||||
_go32_dpmi_lock_code(__SEAL_TEXT_BEGIN,
|
||||
(long) __SEAL_TEXT_END - (long) __SEAL_TEXT_BEGIN);
|
||||
|
||||
_go32_dpmi_lock_data(&__SEAL_DATA_BEGIN,
|
||||
(long) &__SEAL_DATA_END - (long) &__SEAL_DATA_BEGIN);
|
||||
|
||||
_go32_dpmi_lock_data(&__SEAL_BSS_BEGIN,
|
||||
(long) &__SEAL_BSS_END - (long) &__SEAL_BSS_BEGIN);
|
||||
|
||||
/* lock conventional memory used for DMA buffers and IRQ callbacks */
|
||||
_crt0_startup_flags |= _CRT0_FLAG_NEARPTR;
|
||||
__djgpp_nearptr_enable();
|
||||
_go32_dpmi_lock_data((void *) __djgpp_conventional_base, 640 << 10);
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* $Id: audiow32.c 1.7 1996/09/20 23:55:38 chasan released $
|
||||
* 1.8 1998/12/24 15:07:30 chasan released (NT fix)
|
||||
*
|
||||
* Win32 dynamic-link library entry point routine
|
||||
*
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "audio.h"
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define AUDIO_UPDATE_LATENCY 10 /* audio latency in milliseconds */
|
||||
|
||||
static HANDLE hThread;
|
||||
static DWORD nThreadId;
|
||||
static BOOL bTerminate;
|
||||
|
||||
DWORD WINAPI UpdateAudioThread(LPVOID lpThreadParameter)
|
||||
{
|
||||
LONG dwAudioTime, dwSleepTime;
|
||||
|
||||
dwAudioTime = GetTickCount();
|
||||
while (!bTerminate) {
|
||||
AUpdateAudio();
|
||||
dwAudioTime += AUDIO_UPDATE_LATENCY;
|
||||
if ((dwSleepTime = dwAudioTime - GetTickCount()) > 0)
|
||||
Sleep(dwSleepTime);
|
||||
}
|
||||
return (lpThreadParameter != NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __MSC__
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,
|
||||
DWORD fdwReason, LPVOID lpvReserved)
|
||||
#else
|
||||
BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL,
|
||||
DWORD fdwReason, LPVOID lpvReserved)
|
||||
#endif
|
||||
{
|
||||
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||
AInitialize();
|
||||
#ifdef WIN32
|
||||
bTerminate = FALSE;
|
||||
hThread = CreateThread(NULL, 0, UpdateAudioThread, NULL, 0, &nThreadId);
|
||||
SetPriorityClass(hThread, HIGH_PRIORITY_CLASS);
|
||||
SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
|
||||
}
|
||||
if (fdwReason == DLL_PROCESS_DETACH) {
|
||||
bTerminate = TRUE;
|
||||
WaitForSingleObject(hThread, INFINITE);
|
||||
CloseHandle(hThread);
|
||||
#endif
|
||||
}
|
||||
if (hinstDLL != (HINSTANCE)0 && lpvReserved != (LPVOID)0) {
|
||||
/* avoid compiler warnings */
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,185 +0,0 @@
|
||||
/*
|
||||
* $Id: be3drv.c 1.0 1998/10/12 00:33:08 chasan Exp $
|
||||
*
|
||||
* Intel BeOS Release 3 audio driver.
|
||||
*
|
||||
* Copyright (C) 1998-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "BeOS/old_audio_driver.h"
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
#define BUFFERSIZE (1 << 12)
|
||||
|
||||
/*
|
||||
* BeOS driver configuration structure
|
||||
*/
|
||||
static struct {
|
||||
int nHandle;
|
||||
char szDeviceName[MAXNAMLEN];
|
||||
BYTE aBuffer[sizeof(audio_buffer_header) + BUFFERSIZE];
|
||||
LPFNAUDIOWAVE lpfnAudioWave;
|
||||
} Audio;
|
||||
|
||||
|
||||
/*
|
||||
* BeOS driver API interface
|
||||
*/
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
static AUDIOCAPS Caps =
|
||||
{
|
||||
AUDIO_PRODUCT_BEOSR3, "BeOS R3 Sound Driver",
|
||||
AUDIO_FORMAT_1M08 | AUDIO_FORMAT_1S08 |
|
||||
AUDIO_FORMAT_1M16 | AUDIO_FORMAT_1S16 |
|
||||
AUDIO_FORMAT_2M08 | AUDIO_FORMAT_2S08 |
|
||||
AUDIO_FORMAT_2M16 | AUDIO_FORMAT_2S16 |
|
||||
AUDIO_FORMAT_4M08 | AUDIO_FORMAT_4S08 |
|
||||
AUDIO_FORMAT_4M16 | AUDIO_FORMAT_4S16
|
||||
};
|
||||
|
||||
memcpy(lpCaps, &Caps, sizeof(AUDIOCAPS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
|
||||
/* first try the default sound device */
|
||||
strcpy(Audio.szDeviceName, "/dev/old/sound");
|
||||
if (access(Audio.szDeviceName, W_OK) == 0)
|
||||
return AUDIO_ERROR_NONE;
|
||||
|
||||
/* search an old audio device */
|
||||
if ((dir = opendir("/dev/old")) != 0) {
|
||||
while ((entry = readdir(dir)) != 0) {
|
||||
if (strcmp(entry->d_name, ".") && strcmp(entry->d_name, "..")) {
|
||||
strcat(strcpy(Audio.szDeviceName, "/dev/old/"), entry->d_name);
|
||||
if (access(Audio.szDeviceName, W_OK) == 0) {
|
||||
closedir(dir);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
static int sample_rates[] = {
|
||||
5510, B_AUDIO_SAMPLE_RATE_5510,
|
||||
6620, B_AUDIO_SAMPLE_RATE_6620,
|
||||
8000, B_AUDIO_SAMPLE_RATE_8000,
|
||||
9600, B_AUDIO_SAMPLE_RATE_9600,
|
||||
11025, B_AUDIO_SAMPLE_RATE_11025,
|
||||
16000, B_AUDIO_SAMPLE_RATE_16000,
|
||||
18900, B_AUDIO_SAMPLE_RATE_18900,
|
||||
22050, B_AUDIO_SAMPLE_RATE_22050,
|
||||
27420, B_AUDIO_SAMPLE_RATE_27420,
|
||||
32000, B_AUDIO_SAMPLE_RATE_32000,
|
||||
33075, B_AUDIO_SAMPLE_RATE_33075,
|
||||
37800, B_AUDIO_SAMPLE_RATE_37800,
|
||||
44100, B_AUDIO_SAMPLE_RATE_44100,
|
||||
48000, B_AUDIO_SAMPLE_RATE_48000 };
|
||||
|
||||
struct audio_params params;
|
||||
int index;
|
||||
|
||||
memset(&Audio, 0, sizeof(Audio));
|
||||
|
||||
/* search an old audio device for playback */
|
||||
if (PingAudio() != AUDIO_ERROR_NONE)
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
|
||||
/* try to open audio device for playback */
|
||||
if ((Audio.nHandle = open(Audio.szDeviceName, O_WRONLY)) < 0)
|
||||
return AUDIO_ERROR_DEVICEBUSY;
|
||||
|
||||
/* setup audio playback encoding format and sampling frequency */
|
||||
if (ioctl(Audio.nHandle, B_AUDIO_GET_PARAMS, ¶ms) < 0) {
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
for (index = 0; index < 2*13; index += 2) {
|
||||
if (sample_rates[index] >= lpInfo->nSampleRate)
|
||||
break;
|
||||
}
|
||||
lpInfo->nSampleRate = sample_rates[index];
|
||||
params.sample_rate = sample_rates[index+1];
|
||||
|
||||
lpInfo->wFormat |= AUDIO_FORMAT_STEREO | AUDIO_FORMAT_16BITS;
|
||||
/* params.playback_format = B_AUDIO_FORMAT_16_BIT_STEREO; */
|
||||
|
||||
if (ioctl(Audio.nHandle, B_AUDIO_SET_PARAMS, ¶ms) < 0) {
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_BADFORMAT;
|
||||
}
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
/* close DSP audio device */
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(UINT nFrames)
|
||||
{
|
||||
audio_buffer_header *header = (audio_buffer_header *) Audio.aBuffer;
|
||||
|
||||
/* compute frame size */
|
||||
nFrames <<= 2;
|
||||
if (nFrames <= 0 || nFrames > BUFFERSIZE)
|
||||
nFrames = BUFFERSIZE;
|
||||
|
||||
/* send PCM samples to the DSP audio device */
|
||||
if (Audio.lpfnAudioWave != NULL) {
|
||||
Audio.lpfnAudioWave(Audio.aBuffer + sizeof(*header), nFrames);
|
||||
header->buffer_number = 0;
|
||||
header->subscriber_count = 0;
|
||||
header->reserved_1 = sizeof(*header) + nFrames;
|
||||
ioctl(Audio.nHandle, B_AUDIO_WRITE_BUFFER, header);
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
/* set up DSP audio device user's callback function */
|
||||
Audio.lpfnAudioWave = lpfnAudioWave;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* BeOS driver public interface
|
||||
*/
|
||||
AUDIOWAVEDRIVER BeOSR3WaveDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, SetAudioCallback
|
||||
};
|
||||
|
||||
AUDIODRIVER BeOSR3Driver =
|
||||
{
|
||||
&BeOSR3WaveDriver, NULL
|
||||
};
|
||||
@ -1,185 +0,0 @@
|
||||
/*
|
||||
* $Id: bedrv.c 1.1 1998/10/24 18:24:26 chasan Exp $
|
||||
*
|
||||
* Intel BeOS Release 4 audio driver.
|
||||
*
|
||||
* Copyright (C) 1998-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include "BeOS/audio_driver.h"
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
#define BUFFERSIZE 200 /* 200 ms */
|
||||
|
||||
/*
|
||||
* BeOS driver configuration structure
|
||||
*/
|
||||
static struct {
|
||||
int nHandle;
|
||||
char szDeviceName[MAXNAMLEN];
|
||||
LPBYTE lpBuffer;
|
||||
int nBufferSize;
|
||||
LPFNAUDIOWAVE lpfnAudioWave;
|
||||
WORD wFormat;
|
||||
} Audio;
|
||||
|
||||
|
||||
/*
|
||||
* BeOS driver API interface
|
||||
*/
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
static AUDIOCAPS Caps =
|
||||
{
|
||||
AUDIO_PRODUCT_BEOS, "BeOS Sound Driver",
|
||||
AUDIO_FORMAT_1M08 | AUDIO_FORMAT_1S08 |
|
||||
AUDIO_FORMAT_1M16 | AUDIO_FORMAT_1S16 |
|
||||
AUDIO_FORMAT_2M08 | AUDIO_FORMAT_2S08 |
|
||||
AUDIO_FORMAT_2M16 | AUDIO_FORMAT_2S16 |
|
||||
AUDIO_FORMAT_4M08 | AUDIO_FORMAT_4S08 |
|
||||
AUDIO_FORMAT_4M16 | AUDIO_FORMAT_4S16
|
||||
};
|
||||
|
||||
memcpy(lpCaps, &Caps, sizeof(AUDIOCAPS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
struct stat st;
|
||||
|
||||
/* search an audio device */
|
||||
if ((dir = opendir("/dev/audio")) != 0) {
|
||||
while ((entry = readdir(dir)) != 0) {
|
||||
if (strcmp(entry->d_name, ".") && strcmp(entry->d_name, "..")) {
|
||||
strcat(strcpy(Audio.szDeviceName, "/dev/audio/"), entry->d_name);
|
||||
if (stat(Audio.szDeviceName, &st) < 0 || S_ISDIR(st.st_mode))
|
||||
continue;
|
||||
if (access(Audio.szDeviceName, W_OK) == 0) {
|
||||
closedir(dir);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
struct audio_format config;
|
||||
|
||||
memset(&Audio, 0, sizeof(Audio));
|
||||
|
||||
/* search an old audio device for playback */
|
||||
if (PingAudio() != AUDIO_ERROR_NONE)
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
|
||||
/* try to open audio device for playback */
|
||||
if ((Audio.nHandle = open(Audio.szDeviceName, O_WRONLY)) < 0)
|
||||
return AUDIO_ERROR_DEVICEBUSY;
|
||||
|
||||
/* compute 200 ms latency buffer size */
|
||||
Audio.nBufferSize = lpInfo->nSampleRate;
|
||||
if (lpInfo->wFormat & AUDIO_FORMAT_16BITS)
|
||||
Audio.nBufferSize <<= 1;
|
||||
if (lpInfo->wFormat & AUDIO_FORMAT_STEREO)
|
||||
Audio.nBufferSize <<= 1;
|
||||
Audio.nBufferSize /= (1000 / BUFFERSIZE);
|
||||
Audio.nBufferSize += 15;
|
||||
Audio.nBufferSize &= ~15;
|
||||
|
||||
/* setup audio playback encoding format and sampling frequency */
|
||||
config.sample_rate = lpInfo->nSampleRate;
|
||||
config.channels = (lpInfo->wFormat & AUDIO_FORMAT_STEREO ? 2 : 1);
|
||||
config.format = (lpInfo->wFormat & AUDIO_FORMAT_16BITS ? 0x02 : 0x11);
|
||||
config.big_endian = 0;
|
||||
config.buf_header = 0;
|
||||
config.play_buf_size = Audio.nBufferSize;
|
||||
config.rec_buf_size = Audio.nBufferSize;
|
||||
if (ioctl(Audio.nHandle, B_AUDIO_SET_AUDIO_FORMAT, &config) < 0) {
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
if (ioctl(Audio.nHandle, B_AUDIO_GET_AUDIO_FORMAT, &config) < 0) {
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
lpInfo->nSampleRate = config.sample_rate;
|
||||
lpInfo->wFormat = AUDIO_FORMAT_8BITS | AUDIO_FORMAT_MONO;
|
||||
if (config.format == 0x02)
|
||||
lpInfo->wFormat |= AUDIO_FORMAT_16BITS;
|
||||
if (config.channels == 2)
|
||||
lpInfo->wFormat |= AUDIO_FORMAT_STEREO;
|
||||
|
||||
/* allocate audio buffer area */
|
||||
if ((Audio.lpBuffer = (LPBYTE) malloc(Audio.nBufferSize)) == NULL) {
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_NOMEMORY;
|
||||
}
|
||||
|
||||
Audio.wFormat = lpInfo->wFormat;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
/* close DSP audio device */
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(UINT nFrames)
|
||||
{
|
||||
/* compute frame size */
|
||||
if (Audio.wFormat & AUDIO_FORMAT_16BITS) nFrames <<= 1;
|
||||
if (Audio.wFormat & AUDIO_FORMAT_STEREO) nFrames <<= 1;
|
||||
if (nFrames <= 0 || nFrames > Audio.nBufferSize)
|
||||
nFrames = Audio.nBufferSize;
|
||||
|
||||
/* send PCM samples to the DSP audio device */
|
||||
if (Audio.lpfnAudioWave != NULL) {
|
||||
Audio.lpfnAudioWave(Audio.lpBuffer, nFrames);
|
||||
write(Audio.nHandle, Audio.lpBuffer, nFrames);
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
/* set up DSP audio device user's callback function */
|
||||
Audio.lpfnAudioWave = lpfnAudioWave;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* BeOS driver public interface
|
||||
*/
|
||||
AUDIOWAVEDRIVER BeOSWaveDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, SetAudioCallback
|
||||
};
|
||||
|
||||
AUDIODRIVER BeOSDriver =
|
||||
{
|
||||
&BeOSWaveDriver, NULL
|
||||
};
|
||||
@ -1,174 +0,0 @@
|
||||
/*
|
||||
* $Id: bedrv.c 0.1 1998/12/19 18:24:26 chasan Exp $
|
||||
*
|
||||
* Intel BeOS Release 4 audio driver using the New Media Kit.
|
||||
*
|
||||
* Copyright (C) 1998 Carlos Hasan. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <MediaDefs.h>
|
||||
#include <SoundPlayer.h>
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
/*
|
||||
* BeOS driver configuration structure
|
||||
*/
|
||||
static struct {
|
||||
BSoundPlayer *Player;
|
||||
LPFNAUDIOWAVE lpfnAudioWave;
|
||||
} Audio;
|
||||
|
||||
|
||||
/*
|
||||
* BeOS driver API interface
|
||||
*/
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
static AUDIOCAPS Caps =
|
||||
{
|
||||
AUDIO_PRODUCT_BEOS, "BeOS Sound Player",
|
||||
AUDIO_FORMAT_1M08 | AUDIO_FORMAT_1S08 |
|
||||
AUDIO_FORMAT_1M16 | AUDIO_FORMAT_1S16 |
|
||||
AUDIO_FORMAT_2M08 | AUDIO_FORMAT_2S08 |
|
||||
AUDIO_FORMAT_2M16 | AUDIO_FORMAT_2S16 |
|
||||
AUDIO_FORMAT_4M08 | AUDIO_FORMAT_4S08 |
|
||||
AUDIO_FORMAT_4M16 | AUDIO_FORMAT_4S16
|
||||
};
|
||||
|
||||
memcpy(lpCaps, &Caps, sizeof(AUDIOCAPS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static void PlayAudio(void *cookie, void *buffer, size_t size,
|
||||
const media_raw_audio_format& fmt)
|
||||
{
|
||||
static float hitable[256], lotable[256];
|
||||
static float scale = 0.0f;
|
||||
|
||||
float *float_buffer = (float *) buffer;
|
||||
short *short_buffer = (short *) buffer + (size >> 2);
|
||||
size >>= 2;
|
||||
|
||||
/* lazily build the integer to float translation table */
|
||||
if (scale == 0.0f) {
|
||||
int i;
|
||||
scale = 1.0f / 32768.0f;
|
||||
for (i = -128; i < 128; i++)
|
||||
hitable[i & 255] = scale * 256.0f * i;
|
||||
for (i = 0; i < 255; i++)
|
||||
lotable[i] = scale * i;
|
||||
}
|
||||
|
||||
/* streams of 44100 Hz, stereo, 32bit floats are supported */
|
||||
if (fmt.format != media_raw_audio_format::B_AUDIO_FLOAT ||
|
||||
fmt.channel_count != 2 || fmt.frame_rate != 44100 ||
|
||||
Audio.lpfnAudioWave == NULL) {
|
||||
memset(buffer, 0, size);
|
||||
}
|
||||
else {
|
||||
/* make 44100 Hz, stereo, 16-bit signed integer samples */
|
||||
Audio.lpfnAudioWave((LPBYTE) short_buffer, size << 1);
|
||||
|
||||
/* convert to 32-bit float samples using lookup table */
|
||||
while (size >= 8) {
|
||||
int *sample = (int *) short_buffer;
|
||||
int s;
|
||||
|
||||
/* TODO: channels will be swapped in big-endian machines */
|
||||
s = sample[0];
|
||||
float_buffer[0] = hitable[(s >> 8) & 255] + lotable[s & 255];
|
||||
float_buffer[1] = hitable[(s >> 24) & 255] + lotable[(s >> 16)&255];
|
||||
s = sample[1];
|
||||
float_buffer[2] = hitable[(s >> 8) & 255] + lotable[s & 255];
|
||||
float_buffer[3] = hitable[(s >> 24) & 255] + lotable[(s >> 16)&255];
|
||||
s = sample[2];
|
||||
float_buffer[4] = hitable[(s >> 8) & 255] + lotable[s & 255];
|
||||
float_buffer[5] = hitable[(s >> 24) & 255] + lotable[(s >> 16)&255];
|
||||
s = sample[3];
|
||||
float_buffer[6] = hitable[(s >> 8) & 255] + lotable[s & 255];
|
||||
float_buffer[7] = hitable[(s >> 24) & 255] + lotable[(s >> 16)&255];
|
||||
|
||||
short_buffer += 8;
|
||||
float_buffer += 8;
|
||||
size -= 8;
|
||||
}
|
||||
while (size-- > 0) {
|
||||
short s = *short_buffer++;
|
||||
*float_buffer++ = hitable[(s >> 8) & 255] + lotable[s & 255];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
/* clean up local state structure */
|
||||
memset(&Audio, 0, sizeof(Audio));
|
||||
|
||||
/* create sound player */
|
||||
if ((Audio.Player = new BSoundPlayer("SEAL Player", PlayAudio)) == NULL)
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
|
||||
/* force default settings */
|
||||
lpInfo->nSampleRate = 44100;
|
||||
lpInfo->wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO;
|
||||
|
||||
/* start sound player */
|
||||
Audio.Player->SetHasData(true);
|
||||
Audio.Player->Start();
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
if (Audio.Player != NULL) {
|
||||
/* stop sound player */
|
||||
Audio.Player->Stop();
|
||||
|
||||
/* release sound player */
|
||||
delete Audio.Player;
|
||||
Audio.Player = NULL;
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(UINT nFrames)
|
||||
{
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
/* set up audio device user's callback function */
|
||||
Audio.lpfnAudioWave = lpfnAudioWave;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* BeOS driver public interface
|
||||
*/
|
||||
AUDIOWAVEDRIVER BeOSWaveDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, SetAudioCallback
|
||||
};
|
||||
|
||||
AUDIODRIVER BeOSDriver =
|
||||
{
|
||||
&BeOSWaveDriver, NULL
|
||||
};
|
||||
@ -1,83 +0,0 @@
|
||||
/*
|
||||
* $Id: drivers.h 1.4 1996/08/05 18:51:19 chasan released $
|
||||
*
|
||||
* Audio device drivers interface
|
||||
*
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __DRIVERS_H
|
||||
#define __DRIVERS_H
|
||||
|
||||
#ifndef __AUDIO_H
|
||||
#include "audio.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Audio device driver structures
|
||||
*/
|
||||
typedef struct {
|
||||
UINT (AIAPI* GetAudioCaps)(LPAUDIOCAPS);
|
||||
UINT (AIAPI* PingAudio)(VOID);
|
||||
UINT (AIAPI* OpenAudio)(LPAUDIOINFO);
|
||||
UINT (AIAPI* CloseAudio)(VOID);
|
||||
UINT (AIAPI* UpdateAudio)(UINT);
|
||||
UINT (AIAPI* SetAudioCallback)(LPFNAUDIOWAVE);
|
||||
} AUDIOWAVEDRIVER, *LPAUDIOWAVEDRIVER;
|
||||
|
||||
typedef struct {
|
||||
UINT (AIAPI* GetAudioCaps)(LPAUDIOCAPS);
|
||||
UINT (AIAPI* PingAudio)(VOID);
|
||||
UINT (AIAPI* OpenAudio)(LPAUDIOINFO);
|
||||
UINT (AIAPI* CloseAudio)(VOID);
|
||||
UINT (AIAPI* UpdateAudio)(VOID);
|
||||
UINT (AIAPI* OpenVoices)(UINT);
|
||||
UINT (AIAPI* CloseVoices)(VOID);
|
||||
UINT (AIAPI* SetAudioTimerProc)(LPFNAUDIOTIMER);
|
||||
UINT (AIAPI* SetAudioTimerRate)(UINT);
|
||||
UINT (AIAPI* SetAudioMixerValue)(UINT, UINT); /*NEW:1998/10/24*/
|
||||
LONG (AIAPI* GetAudioDataAvail)(VOID);
|
||||
UINT (AIAPI* CreateAudioData)(LPAUDIOWAVE);
|
||||
UINT (AIAPI* DestroyAudioData)(LPAUDIOWAVE);
|
||||
UINT (AIAPI* WriteAudioData)(LPAUDIOWAVE, DWORD, UINT);
|
||||
UINT (AIAPI* PrimeVoice)(UINT, LPAUDIOWAVE);
|
||||
UINT (AIAPI* StartVoice)(UINT);
|
||||
UINT (AIAPI* StopVoice)(UINT);
|
||||
UINT (AIAPI* SetVoicePosition)(UINT, LONG);
|
||||
UINT (AIAPI* SetVoiceFrequency)(UINT, LONG);
|
||||
UINT (AIAPI* SetVoiceVolume)(UINT, UINT);
|
||||
UINT (AIAPI* SetVoicePanning)(UINT, UINT);
|
||||
UINT (AIAPI* GetVoicePosition)(UINT, LPLONG);
|
||||
UINT (AIAPI* GetVoiceFrequency)(UINT, LPLONG);
|
||||
UINT (AIAPI* GetVoiceVolume)(UINT, LPUINT);
|
||||
UINT (AIAPI* GetVoicePanning)(UINT, LPUINT);
|
||||
UINT (AIAPI* GetVoiceStatus)(UINT, LPBOOL);
|
||||
} AUDIOSYNTHDRIVER, *LPAUDIOSYNTHDRIVER;
|
||||
|
||||
typedef struct {
|
||||
LPAUDIOWAVEDRIVER lpWaveDriver;
|
||||
LPAUDIOSYNTHDRIVER lpSynthDriver;
|
||||
} AUDIODRIVER, *LPAUDIODRIVER;
|
||||
|
||||
/*
|
||||
* External device-independant software drivers
|
||||
*/
|
||||
extern AUDIODRIVER NoneDriver;
|
||||
extern AUDIOWAVEDRIVER NoneWaveDriver;
|
||||
extern AUDIOSYNTHDRIVER NoneSynthDriver;
|
||||
extern AUDIOSYNTHDRIVER EmuSynthDriver;
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,313 +0,0 @@
|
||||
/*
|
||||
* $Id: dsdrv.c 1.5 1997/01/05 16:23:47 chasan Exp $
|
||||
*
|
||||
* Microsoft DirectSound audio driver interface
|
||||
*
|
||||
* Copyright (c) 1996-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#define MSGBOX(text)
|
||||
|
||||
#define INITGUID
|
||||
#include <windows.h>
|
||||
#include <objbase.h>
|
||||
#include <dsound.h>
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
static struct {
|
||||
LPDIRECTSOUND lpDirectSound;
|
||||
LPDIRECTSOUNDBUFFER lpPrimaryBuffer;
|
||||
LPDIRECTSOUNDBUFFER lpSoundBuffer;
|
||||
LPFNAUDIOWAVE lpfnAudioWave;
|
||||
DWORD dwBufferOffset;
|
||||
DWORD dwBufferSize;
|
||||
|
||||
WORD nSampleRate;
|
||||
WORD wFormat;
|
||||
} DS;
|
||||
|
||||
static HRESULT _DirectSoundCreate(GUID FAR * lpGuid,
|
||||
LPDIRECTSOUND *lplpDirectSound, IUnknown FAR * lpUnkOuter)
|
||||
{
|
||||
HRESULT hresult;
|
||||
|
||||
CoInitialize(NULL);
|
||||
hresult = CoCreateInstance(&CLSID_DirectSound, lpUnkOuter,
|
||||
CLSCTX_ALL, &IID_IDirectSound, lplpDirectSound);
|
||||
if (!FAILED(hresult))
|
||||
hresult = IDirectSound_Initialize(*lplpDirectSound, NULL);
|
||||
return hresult;
|
||||
}
|
||||
|
||||
static HRESULT _DirectSoundDestroy(LPDIRECTSOUND lpDirectSound)
|
||||
{
|
||||
HRESULT hresult;
|
||||
|
||||
hresult = IDirectSound_Release(lpDirectSound);
|
||||
CoUninitialize();
|
||||
return hresult;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
strncpy(lpCaps->szProductName, "DirectSound",
|
||||
sizeof(lpCaps->szProductName));
|
||||
lpCaps->wProductId = AUDIO_PRODUCT_DSOUND;
|
||||
lpCaps->dwFormats =
|
||||
AUDIO_FORMAT_1M08 | AUDIO_FORMAT_1S08 |
|
||||
AUDIO_FORMAT_1M16 | AUDIO_FORMAT_1S16 |
|
||||
AUDIO_FORMAT_2M08 | AUDIO_FORMAT_2S08 |
|
||||
AUDIO_FORMAT_2M16 | AUDIO_FORMAT_2S16 |
|
||||
AUDIO_FORMAT_4M08 | AUDIO_FORMAT_4S08 |
|
||||
AUDIO_FORMAT_4M16 | AUDIO_FORMAT_4S16 ;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
LPDIRECTSOUND lpDirectSound;
|
||||
if (_DirectSoundCreate(NULL, &lpDirectSound, NULL) != DS_OK)
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
_DirectSoundDestroy(lpDirectSound);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
DSBUFFERDESC dsbd;
|
||||
DSBCAPS dsbc;
|
||||
DSCAPS dsc;
|
||||
WAVEFORMATEX wfx;
|
||||
|
||||
memset(&DS, 0, sizeof(DS));
|
||||
|
||||
/* create the direct sound object */
|
||||
if (_DirectSoundCreate(NULL, &DS.lpDirectSound, NULL) != DS_OK) {
|
||||
MSGBOX("Failed to create DirectSound COM object");
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
/* set direct sound cooperative level */
|
||||
if (DS.lpDirectSound->lpVtbl->SetCooperativeLevel(
|
||||
DS.lpDirectSound, GetForegroundWindow(), DSSCL_PRIORITY) != DS_OK) {
|
||||
MSGBOX("DirectSound SetCooperativeLevel failed");
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
/* get DirectSound capabilities */
|
||||
dsc.dwSize = sizeof(dsc);
|
||||
if (DS.lpDirectSound->lpVtbl->GetCaps(DS.lpDirectSound, &dsc) != DS_OK) {
|
||||
MSGBOX("Cannot get DirectSound capabilities");
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
if (!(dsc.dwFlags & DSCAPS_PRIMARYSTEREO))
|
||||
lpInfo->wFormat &= ~AUDIO_FORMAT_STEREO;
|
||||
if (!(dsc.dwFlags & DSCAPS_SECONDARY16BIT))
|
||||
lpInfo->wFormat &= ~AUDIO_FORMAT_16BITS;
|
||||
|
||||
/* set up wave format structure */
|
||||
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wfx.nChannels = lpInfo->wFormat & AUDIO_FORMAT_STEREO ? 2 : 1;
|
||||
wfx.wBitsPerSample = lpInfo->wFormat & AUDIO_FORMAT_16BITS ? 16 : 8;
|
||||
wfx.nSamplesPerSec = lpInfo->nSampleRate;
|
||||
wfx.nAvgBytesPerSec = lpInfo->nSampleRate;
|
||||
wfx.nBlockAlign = 1;
|
||||
wfx.cbSize = 0;
|
||||
if (lpInfo->wFormat & AUDIO_FORMAT_STEREO) {
|
||||
wfx.nAvgBytesPerSec <<= 1;
|
||||
wfx.nBlockAlign <<= 1;
|
||||
}
|
||||
if (lpInfo->wFormat & AUDIO_FORMAT_16BITS) {
|
||||
wfx.nAvgBytesPerSec <<= 1;
|
||||
wfx.nBlockAlign <<= 1;
|
||||
}
|
||||
|
||||
/* create primary sound buffer */
|
||||
memset(&dsbd, 0, sizeof(dsbd));
|
||||
dsbd.dwSize = sizeof(dsbd);
|
||||
dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
dsbd.dwBufferBytes = 0;
|
||||
dsbd.lpwfxFormat = NULL;
|
||||
if (DS.lpDirectSound->lpVtbl->CreateSoundBuffer(
|
||||
DS.lpDirectSound, &dsbd, &DS.lpPrimaryBuffer, NULL) != DS_OK) {
|
||||
MSGBOX("Cannot create primary buffer");
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
/* set up primary buffer format */
|
||||
while (DS.lpPrimaryBuffer->lpVtbl->SetFormat(DS.lpPrimaryBuffer, &wfx) != DS_OK) {
|
||||
if (lpInfo->nSampleRate <= 11025) {
|
||||
MSGBOX("Can't change primary buffer format");
|
||||
DS.lpPrimaryBuffer->lpVtbl->Release(DS.lpPrimaryBuffer);
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
wfx.nSamplesPerSec >>= 1;
|
||||
wfx.nAvgBytesPerSec >>= 1;
|
||||
wfx.nBlockAlign >>= 1;
|
||||
lpInfo->nSampleRate >>= 1;
|
||||
}
|
||||
|
||||
/* get primary buffer length */
|
||||
dsbc.dwSize = sizeof(dsbc);
|
||||
if (DS.lpPrimaryBuffer->lpVtbl->GetCaps(DS.lpPrimaryBuffer, &dsbc) != DS_OK) {
|
||||
MSGBOX("Can't get primary buffer capabilities");
|
||||
DS.lpPrimaryBuffer->lpVtbl->Release(DS.lpPrimaryBuffer);
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
/* the secondary buffer size should be between 20 ms and 100 ms */
|
||||
if (dsbc.dwBufferBytes > (100L * wfx.nAvgBytesPerSec) / 1000) {
|
||||
dsbc.dwBufferBytes = (100L * wfx.nAvgBytesPerSec) / 1000;
|
||||
}
|
||||
if (dsbc.dwBufferBytes < (20L * wfx.nAvgBytesPerSec) / 1000) {
|
||||
dsbc.dwBufferBytes = (20L * wfx.nAvgBytesPerSec) / 1000;
|
||||
}
|
||||
|
||||
/* [1998/12/24] in emulation mode use at least 150 ms buffers */
|
||||
if (dsc.dwFlags & DSCAPS_EMULDRIVER) {
|
||||
if (dsbc.dwBufferBytes < (150L * wfx.nAvgBytesPerSec) / 1000)
|
||||
dsbc.dwBufferBytes = (150L * wfx.nAvgBytesPerSec) / 1000;
|
||||
}
|
||||
|
||||
dsbc.dwBufferBytes >>= 2;
|
||||
dsbc.dwBufferBytes <<= 2;
|
||||
|
||||
/* set up secondary buffer description */
|
||||
memset(&dsbd, 0, sizeof(dsbd));
|
||||
dsbd.dwSize = sizeof(dsbd);
|
||||
dsbd.dwFlags = DSBCAPS_STICKYFOCUS | DSBCAPS_GETCURRENTPOSITION2;
|
||||
dsbd.dwBufferBytes = dsbc.dwBufferBytes;
|
||||
dsbd.lpwfxFormat = &wfx;
|
||||
|
||||
/* create secondary sound buffer */
|
||||
if (DS.lpDirectSound->lpVtbl->CreateSoundBuffer(
|
||||
DS.lpDirectSound, &dsbd, &DS.lpSoundBuffer, NULL) != DS_OK) {
|
||||
MSGBOX("Can't create secondary buffer");
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
/* set up buffer chunk variables */
|
||||
DS.dwBufferOffset = 0L;
|
||||
DS.dwBufferSize = dsbd.dwBufferBytes;
|
||||
|
||||
/* start playing the primary buffer */
|
||||
DS.lpPrimaryBuffer->lpVtbl->Play(DS.lpPrimaryBuffer, 0, 0, DSBPLAY_LOOPING);
|
||||
|
||||
/* start playing the secondary buffer */
|
||||
DS.lpSoundBuffer->lpVtbl->Play(DS.lpSoundBuffer, 0, 0, DSBPLAY_LOOPING);
|
||||
|
||||
/* save audio format settings */
|
||||
DS.nSampleRate = lpInfo->nSampleRate;
|
||||
DS.wFormat = lpInfo->wFormat;
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
if (DS.lpDirectSound != NULL) {
|
||||
/* release secondary sound buffer */
|
||||
if (DS.lpSoundBuffer != NULL) {
|
||||
DS.lpSoundBuffer->lpVtbl->Stop(DS.lpSoundBuffer);
|
||||
DS.lpSoundBuffer->lpVtbl->Release(DS.lpSoundBuffer);
|
||||
}
|
||||
|
||||
/* release primary sound buffer */
|
||||
if (DS.lpPrimaryBuffer != NULL) {
|
||||
DS.lpPrimaryBuffer->lpVtbl->Stop(DS.lpPrimaryBuffer);
|
||||
DS.lpPrimaryBuffer->lpVtbl->Release(DS.lpPrimaryBuffer);
|
||||
}
|
||||
|
||||
/* release direct sound */
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
}
|
||||
memset(&DS, 0, sizeof(DS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(UINT nFrames)
|
||||
{
|
||||
LPVOID lpPtr1, lpPtr2;
|
||||
DWORD dwBytes1, dwBytes2;
|
||||
DWORD dwPlayOffset, dwWriteOffset;
|
||||
LONG dwBytes;
|
||||
|
||||
if (DS.wFormat & AUDIO_FORMAT_STEREO) nFrames <<= 1;
|
||||
if (DS.wFormat & AUDIO_FORMAT_16BITS) nFrames <<= 1;
|
||||
if (nFrames <= 0 || nFrames >= DS.dwBufferSize)
|
||||
nFrames = DS.dwBufferSize;
|
||||
|
||||
if (DS.lpSoundBuffer->lpVtbl->GetCurrentPosition(
|
||||
DS.lpSoundBuffer, &dwPlayOffset, &dwWriteOffset) == DS_OK) {
|
||||
|
||||
if ((dwBytes = dwPlayOffset - DS.dwBufferOffset) < 0)
|
||||
dwBytes += DS.dwBufferSize;
|
||||
if (dwBytes > nFrames)
|
||||
dwBytes = nFrames;
|
||||
dwBytes &= ~3;
|
||||
|
||||
if ((dwBytes -= 128) > 0) {
|
||||
|
||||
if (DS.lpSoundBuffer->lpVtbl->Lock(
|
||||
DS.lpSoundBuffer, DS.dwBufferOffset, dwBytes,
|
||||
&lpPtr1, &dwBytes1, &lpPtr2, &dwBytes2, 0) == DS_OK) {
|
||||
|
||||
if (DS.lpfnAudioWave != NULL) {
|
||||
DS.lpfnAudioWave(lpPtr1, dwBytes1);
|
||||
if (lpPtr2 != NULL)
|
||||
DS.lpfnAudioWave(lpPtr2, dwBytes2);
|
||||
}
|
||||
else {
|
||||
memset(lpPtr1, 0, dwBytes1);
|
||||
if (lpPtr2 != NULL)
|
||||
memset(lpPtr2, 0, dwBytes2);
|
||||
}
|
||||
|
||||
DS.lpSoundBuffer->lpVtbl->Unlock(DS.lpSoundBuffer,
|
||||
lpPtr1, dwBytes1, lpPtr2, dwBytes2);
|
||||
|
||||
if ((DS.dwBufferOffset += dwBytes) >= DS.dwBufferSize)
|
||||
DS.dwBufferOffset -= DS.dwBufferSize;
|
||||
}
|
||||
else {
|
||||
DS.lpSoundBuffer->lpVtbl->Restore(DS.lpSoundBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
DS.lpfnAudioWave = lpfnAudioWave;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* DirectSound driver public interfaces
|
||||
*/
|
||||
AUDIOWAVEDRIVER DirectSoundWaveDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, SetAudioCallback
|
||||
};
|
||||
|
||||
AUDIODRIVER DirectSoundDriver =
|
||||
{
|
||||
&DirectSoundWaveDriver, NULL
|
||||
};
|
||||
@ -1,663 +0,0 @@
|
||||
/*
|
||||
* $Id: dsdrv2.c 0.4 1998/12/26 chasan Exp $
|
||||
*
|
||||
* DirectSound accelerated audio driver (Experimental)
|
||||
*
|
||||
* Copyright (C) 1998-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <objbase.h>
|
||||
#include <dsound.h>
|
||||
#include <math.h>
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
#if 0
|
||||
#define MSGBOX(text) MessageBox(NULL, text, "DirectSound", MB_OK)
|
||||
#else
|
||||
#define MSGBOX(text)
|
||||
#endif
|
||||
|
||||
static struct {
|
||||
LPDIRECTSOUND lpDirectSound;
|
||||
LPDIRECTSOUNDBUFFER lpPrimaryBuffer;
|
||||
LPDIRECTSOUNDBUFFER aSoundBuffer[AUDIO_MAX_VOICES];
|
||||
LPFNAUDIOTIMER lpfnTimerHandler;
|
||||
|
||||
LONG aLogVolumeTable[AUDIO_MAX_VOLUME+1];
|
||||
LONG aLogPanningTable[AUDIO_MAX_PANNING+1];
|
||||
|
||||
DWORD aFormatTable[AUDIO_MAX_VOICES];
|
||||
LONG aFrequencyTable[AUDIO_MAX_VOICES];
|
||||
UINT aVolumeTable[AUDIO_MAX_VOICES];
|
||||
UINT aPanningTable[AUDIO_MAX_VOICES];
|
||||
|
||||
LONG dwTimer;
|
||||
LONG dwTimerAccum;
|
||||
LONG dwTimerRate;
|
||||
} DS;
|
||||
|
||||
|
||||
static HRESULT _DirectSoundCreate(GUID FAR *lpGuid,
|
||||
LPDIRECTSOUND *lplpDirectSound, IUnknown FAR *lpUnkOuter)
|
||||
{
|
||||
HRESULT hresult;
|
||||
|
||||
CoInitialize(NULL);
|
||||
hresult = CoCreateInstance(&CLSID_DirectSound, lpUnkOuter,
|
||||
CLSCTX_ALL, &IID_IDirectSound, lplpDirectSound);
|
||||
if (!FAILED(hresult))
|
||||
hresult = IDirectSound_Initialize(*lplpDirectSound, NULL);
|
||||
return hresult;
|
||||
}
|
||||
|
||||
static HRESULT _DirectSoundDestroy(LPDIRECTSOUND lpDirectSound)
|
||||
{
|
||||
HRESULT hresult;
|
||||
|
||||
hresult = IDirectSound_Release(lpDirectSound);
|
||||
CoUninitialize();
|
||||
return hresult;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioMixerValue(UINT, UINT);
|
||||
|
||||
|
||||
/*
|
||||
* DirectSound audio driver API interface
|
||||
*/
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
static AUDIOCAPS Caps =
|
||||
{
|
||||
AUDIO_PRODUCT_NONE, "DirectSound (experimental)",
|
||||
AUDIO_FORMAT_1M08 | AUDIO_FORMAT_1S08 |
|
||||
AUDIO_FORMAT_1M16 | AUDIO_FORMAT_1S16 |
|
||||
AUDIO_FORMAT_2M08 | AUDIO_FORMAT_2S08 |
|
||||
AUDIO_FORMAT_2M16 | AUDIO_FORMAT_2S16 |
|
||||
AUDIO_FORMAT_4M08 | AUDIO_FORMAT_4S08 |
|
||||
AUDIO_FORMAT_4M16 | AUDIO_FORMAT_4S16
|
||||
};
|
||||
|
||||
memcpy(lpCaps, &Caps, sizeof(AUDIOCAPS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
LPDIRECTSOUND lpDirectSound;
|
||||
if (_DirectSoundCreate(NULL, &lpDirectSound, NULL) != DS_OK)
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
_DirectSoundDestroy(lpDirectSound);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
LPDIRECTSOUNDBUFFER lpPrimaryBuffer;
|
||||
DSBUFFERDESC dsbd;
|
||||
WAVEFORMATEX wfx;
|
||||
DSCAPS dsc;
|
||||
LONG nPanning;
|
||||
|
||||
memset(&DS, 0, sizeof(DS));
|
||||
|
||||
if (lpInfo == NULL)
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
|
||||
/* create direct sound object */
|
||||
if (_DirectSoundCreate(NULL, &DS.lpDirectSound, NULL) != DS_OK)
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
|
||||
/* set direct sound cooperative level */
|
||||
if (DS.lpDirectSound->lpVtbl->SetCooperativeLevel(DS.lpDirectSound,
|
||||
GetForegroundWindow(), DSSCL_PRIORITY) != DS_OK) {
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
/* get direct sound capabilities */
|
||||
dsc.dwSize = sizeof(dsc);
|
||||
if (DS.lpDirectSound->lpVtbl->GetCaps(DS.lpDirectSound, &dsc) != DS_OK) {
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
/* adjust the format settings */
|
||||
lpInfo->nSampleRate = 44100;
|
||||
if (!(dsc.dwFlags & DSCAPS_PRIMARYSTEREO))
|
||||
lpInfo->wFormat &= ~AUDIO_FORMAT_STEREO;
|
||||
if (!(dsc.dwFlags & DSCAPS_PRIMARY16BIT))
|
||||
lpInfo->wFormat &= ~AUDIO_FORMAT_16BITS;
|
||||
|
||||
/* setup wave format structure */
|
||||
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wfx.nChannels = lpInfo->wFormat & AUDIO_FORMAT_STEREO ? 2 : 1;
|
||||
wfx.wBitsPerSample = lpInfo->wFormat & AUDIO_FORMAT_16BITS ? 16 : 8;
|
||||
wfx.nSamplesPerSec = lpInfo->nSampleRate;
|
||||
wfx.nAvgBytesPerSec = lpInfo->nSampleRate;
|
||||
wfx.nBlockAlign = 1;
|
||||
wfx.cbSize = 0;
|
||||
if (lpInfo->wFormat & AUDIO_FORMAT_STEREO) {
|
||||
wfx.nAvgBytesPerSec <<= 1;
|
||||
wfx.nBlockAlign <<= 1;
|
||||
}
|
||||
if (lpInfo->wFormat & AUDIO_FORMAT_16BITS) {
|
||||
wfx.nAvgBytesPerSec <<= 1;
|
||||
wfx.nBlockAlign <<= 1;
|
||||
}
|
||||
|
||||
/* create primary sound buffer */
|
||||
memset(&dsbd, 0, sizeof(dsbd));
|
||||
dsbd.dwSize = sizeof(dsbd);
|
||||
dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
dsbd.dwBufferBytes = 0;
|
||||
dsbd.lpwfxFormat = NULL;
|
||||
if (DS.lpDirectSound->lpVtbl->CreateSoundBuffer(DS.lpDirectSound,
|
||||
&dsbd, &DS.lpPrimaryBuffer, NULL) != DS_OK) {
|
||||
MSGBOX("Can't create primary buffer");
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
|
||||
/* setup primary buffer format */
|
||||
while (DS.lpPrimaryBuffer->lpVtbl->SetFormat(DS.lpPrimaryBuffer, &wfx) != DS_OK) {
|
||||
if (lpInfo->nSampleRate <= 11025) {
|
||||
MSGBOX("Can't change primary buffer format");
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
return AUDIO_ERROR_NODEVICE;
|
||||
}
|
||||
wfx.nSamplesPerSec >>= 1;
|
||||
wfx.nAvgBytesPerSec >>= 1;
|
||||
wfx.nBlockAlign >>= 1;
|
||||
lpInfo->nSampleRate >>= 1;
|
||||
}
|
||||
|
||||
/* start playing primary buffer */
|
||||
DS.lpPrimaryBuffer->lpVtbl->Play(DS.lpPrimaryBuffer, 0, 0, DSBPLAY_LOOPING);
|
||||
|
||||
/* set the timer settings */
|
||||
DS.dwTimer = GetTickCount();
|
||||
DS.dwTimerAccum = 0;
|
||||
|
||||
/* set default master volume */
|
||||
SetAudioMixerValue(AUDIO_MIXER_MASTER_VOLUME, 96);
|
||||
|
||||
/* create log panning table */
|
||||
for (nPanning = 0; nPanning <= AUDIO_MAX_PANNING; nPanning++) {
|
||||
DS.aLogPanningTable[nPanning] = (2000 * (nPanning - 128)) >> 7;
|
||||
}
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
UINT i;
|
||||
|
||||
if (DS.lpDirectSound != NULL) {
|
||||
/* stop and release primary buffer */
|
||||
if (DS.lpPrimaryBuffer != NULL) {
|
||||
DS.lpPrimaryBuffer->lpVtbl->Stop(DS.lpPrimaryBuffer);
|
||||
DS.lpPrimaryBuffer->lpVtbl->Release(DS.lpPrimaryBuffer);
|
||||
}
|
||||
|
||||
/* release duplicated sound buffers */
|
||||
for (i = 0; i < AUDIO_MAX_VOICES; i++) {
|
||||
if (DS.aSoundBuffer[i] != NULL) {
|
||||
DS.aSoundBuffer[i]->lpVtbl->Stop(DS.aSoundBuffer[i]);
|
||||
DS.aSoundBuffer[i]->lpVtbl->Release(DS.aSoundBuffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* release direct sound buffer */
|
||||
_DirectSoundDestroy(DS.lpDirectSound);
|
||||
}
|
||||
|
||||
/* clean up DirectSound driver variables */
|
||||
memset(&DS, 0, sizeof(DS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(UINT nFrames)
|
||||
{
|
||||
LONG dwTimer = GetTickCount();
|
||||
|
||||
/* call the virtual audio timer callback */
|
||||
if ((DS.dwTimerAccum += dwTimer - DS.dwTimer) >= DS.dwTimerRate) {
|
||||
DS.dwTimerAccum -= DS.dwTimerRate;
|
||||
if (DS.lpfnTimerHandler != NULL)
|
||||
DS.lpfnTimerHandler();
|
||||
}
|
||||
DS.dwTimer = dwTimer;
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudioSynth(VOID)
|
||||
{
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioMixerValue(UINT nChannel, UINT nValue)
|
||||
{
|
||||
LONG nVolume;
|
||||
|
||||
if (nChannel != AUDIO_MIXER_MASTER_VOLUME &&
|
||||
nChannel != AUDIO_MIXER_TREBLE &&
|
||||
nChannel != AUDIO_MIXER_BASS &&
|
||||
nChannel != AUDIO_MIXER_CHORUS &&
|
||||
nChannel != AUDIO_MIXER_REVERB)
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
|
||||
if (nChannel == AUDIO_MIXER_MASTER_VOLUME && nValue <= 256) {
|
||||
DS.aLogVolumeTable[0] = -10000;
|
||||
for (nVolume = 1; nVolume <= AUDIO_MAX_VOLUME; nVolume++) {
|
||||
LONG value = (nValue * nVolume) >> 6;
|
||||
DS.aLogVolumeTable[nVolume] = (LONG) (value == 0 ? -10000.0 : -2000.0 * log(value / 256.0) / log(1.0/256.0));
|
||||
}
|
||||
}
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenVoices(UINT nVoices)
|
||||
{
|
||||
if (nVoices <= AUDIO_MAX_VOICES) {
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseVoices(VOID)
|
||||
{
|
||||
UINT i;
|
||||
|
||||
for (i = 0; i < AUDIO_MAX_VOICES; i++) {
|
||||
/* stop and release duplicated sound buffers */
|
||||
if (DS.aSoundBuffer[i] != NULL) {
|
||||
DS.aSoundBuffer[i]->lpVtbl->Stop(DS.aSoundBuffer[i]);
|
||||
DS.aSoundBuffer[i]->lpVtbl->Release(DS.aSoundBuffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* clean up duplicated sound buffer array */
|
||||
memset(DS.aSoundBuffer, 0, sizeof(DS.aSoundBuffer));
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
if (lpfnAudioWave != NULL) {
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioTimerProc(LPFNAUDIOTIMER lpfnAudioTimer)
|
||||
{
|
||||
if (lpfnAudioTimer != NULL) {
|
||||
/* start up the timer settings */
|
||||
if (DS.lpfnTimerHandler == NULL) {
|
||||
DS.dwTimer = GetTickCount();
|
||||
DS.dwTimerAccum = 0;
|
||||
}
|
||||
DS.lpfnTimerHandler = lpfnAudioTimer;
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioTimerRate(UINT nBPM)
|
||||
{
|
||||
if (nBPM >= 0x20 && nBPM <= 0xFF) {
|
||||
/* set timer rate in milliseconds */
|
||||
DS.dwTimerRate = (5 * 1000L) / (2 * nBPM);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
static LONG AIAPI GetAudioDataAvail(VOID)
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
|
||||
static UINT AIAPI CreateAudioData(LPAUDIOWAVE lpWave)
|
||||
{
|
||||
LPDIRECTSOUNDBUFFER lpSoundBuffer;
|
||||
DSBUFFERDESC dsbd;
|
||||
DSBCAPS dsbc;
|
||||
WAVEFORMATEX wfx;
|
||||
|
||||
if (lpWave != NULL) {
|
||||
lpWave->dwHandle = 0;
|
||||
|
||||
/* setup waveform format */
|
||||
wfx.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wfx.nChannels = 1;
|
||||
wfx.wBitsPerSample = lpWave->wFormat & AUDIO_FORMAT_16BITS ? 16 : 8;
|
||||
wfx.nSamplesPerSec = lpWave->nSampleRate;
|
||||
wfx.nAvgBytesPerSec = lpWave->nSampleRate;
|
||||
wfx.nBlockAlign = 1;
|
||||
wfx.cbSize = 0;
|
||||
if (lpWave->wFormat & AUDIO_FORMAT_16BITS) {
|
||||
wfx.nAvgBytesPerSec <<= 1;
|
||||
wfx.nBlockAlign <<= 1;
|
||||
}
|
||||
|
||||
/* setup sound buffer description */
|
||||
dsbd.dwSize = sizeof(dsbd);
|
||||
dsbd.dwFlags = DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME |
|
||||
DSBCAPS_CTRLFREQUENCY | DSBCAPS_STICKYFOCUS |
|
||||
DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_LOCSOFTWARE;
|
||||
dsbd.dwBufferBytes = lpWave->dwLength;
|
||||
dsbd.dwReserved = 0;
|
||||
dsbd.lpwfxFormat = &wfx;
|
||||
|
||||
/* create sound buffer object */
|
||||
if (DS.lpDirectSound->lpVtbl->CreateSoundBuffer(DS.lpDirectSound,
|
||||
&dsbd, &lpSoundBuffer, NULL) != DS_OK) {
|
||||
MSGBOX("Can't create DirectSoundBuffer object");
|
||||
return AUDIO_ERROR_NOMEMORY;
|
||||
}
|
||||
|
||||
lpWave->dwHandle = (DWORD) lpSoundBuffer;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
static UINT AIAPI DestroyAudioData(LPAUDIOWAVE lpWave)
|
||||
{
|
||||
LPDIRECTSOUNDBUFFER lpSoundBuffer;
|
||||
|
||||
if (lpWave != NULL && lpWave->dwHandle != 0) {
|
||||
lpSoundBuffer = (LPDIRECTSOUNDBUFFER) lpWave->dwHandle;
|
||||
lpSoundBuffer->lpVtbl->Stop(lpSoundBuffer);
|
||||
lpSoundBuffer->lpVtbl->Release(lpSoundBuffer);
|
||||
lpWave->dwHandle = 0;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
static UINT AIAPI WriteAudioData(LPAUDIOWAVE lpWave, DWORD dwOffset, UINT nCount)
|
||||
{
|
||||
LPDIRECTSOUNDBUFFER lpSoundBuffer;
|
||||
LPVOID lpPtr1, lpPtr2;
|
||||
DWORD dwBytes1, dwBytes2;
|
||||
UINT i;
|
||||
|
||||
if (lpWave != NULL && lpWave->dwHandle != 0 && lpWave->lpData != NULL) {
|
||||
if (dwOffset + nCount <= lpWave->dwLength) {
|
||||
lpSoundBuffer = (LPDIRECTSOUNDBUFFER) lpWave->dwHandle;
|
||||
|
||||
/* lock sound buffer in memory */
|
||||
if (lpSoundBuffer->lpVtbl->Lock(lpSoundBuffer, dwOffset, nCount,
|
||||
&lpPtr1, &dwBytes1, &lpPtr2, &dwBytes2, 0) == DS_OK) {
|
||||
|
||||
/* copy samples to the sound buffer (convert to unsigned) */
|
||||
if (lpWave->wFormat & AUDIO_FORMAT_16BITS) {
|
||||
memcpy(lpPtr1, lpWave->lpData + dwOffset, dwBytes1);
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < dwBytes1; i++)
|
||||
((LPBYTE)lpPtr1)[i] = lpWave->lpData[dwOffset++] ^ 0x80;
|
||||
}
|
||||
|
||||
/* unlock the sound buffer from memory */
|
||||
lpSoundBuffer->lpVtbl->Unlock(lpSoundBuffer, lpPtr1,
|
||||
dwBytes1, lpPtr2, dwBytes2);
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
else {
|
||||
MSGBOX("Can't lock DirectSoundBuffer memory");
|
||||
lpSoundBuffer->lpVtbl->Restore(lpSoundBuffer);
|
||||
}
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI PrimeVoice(UINT nVoice, LPAUDIOWAVE lpWave)
|
||||
{
|
||||
LPDIRECTSOUNDBUFFER lpSoundBuffer;
|
||||
|
||||
if (nVoice < AUDIO_MAX_VOICES && lpWave != NULL) {
|
||||
lpSoundBuffer = (LPDIRECTSOUNDBUFFER) lpWave->dwHandle;
|
||||
|
||||
/* release the sound buffer for this voice */
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
DS.aSoundBuffer[nVoice]->lpVtbl->Stop(DS.aSoundBuffer[nVoice]);
|
||||
DS.aSoundBuffer[nVoice]->lpVtbl->Release(DS.aSoundBuffer[nVoice]);
|
||||
DS.aSoundBuffer[nVoice] = NULL;
|
||||
}
|
||||
|
||||
/* create a duplicate sound buffer */
|
||||
if (DS.lpDirectSound->lpVtbl->DuplicateSoundBuffer(DS.lpDirectSound,
|
||||
lpSoundBuffer, &DS.aSoundBuffer[nVoice]) != DS_OK) {
|
||||
MSGBOX("Can't duplicate DirectSoundBuffer object");
|
||||
return AUDIO_ERROR_NOMEMORY;
|
||||
}
|
||||
|
||||
/* setup frequency, volume and panning */
|
||||
DS.aSoundBuffer[nVoice]->lpVtbl->SetCurrentPosition(DS.aSoundBuffer[nVoice], 0);
|
||||
DS.aSoundBuffer[nVoice]->lpVtbl->SetFrequency(DS.aSoundBuffer[nVoice],
|
||||
DS.aFrequencyTable[nVoice]);
|
||||
DS.aSoundBuffer[nVoice]->lpVtbl->SetVolume(DS.aSoundBuffer[nVoice],
|
||||
DS.aLogVolumeTable[DS.aVolumeTable[nVoice]]);
|
||||
DS.aSoundBuffer[nVoice]->lpVtbl->SetPan(DS.aSoundBuffer[nVoice],
|
||||
DS.aLogPanningTable[DS.aPanningTable[nVoice]]);
|
||||
|
||||
/* save format of the sound buffer */
|
||||
DS.aFormatTable[nVoice] = lpWave->wFormat;
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI StartVoice(UINT nVoice)
|
||||
{
|
||||
DWORD dwFlags;
|
||||
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
// FIXME: handle looping samples!
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
dwFlags = (DS.aFormatTable[nVoice] & AUDIO_FORMAT_LOOP ? DSBPLAY_LOOPING : 0);
|
||||
if (DS.aSoundBuffer[nVoice]->lpVtbl->Play(DS.aSoundBuffer[nVoice],
|
||||
0, 0, dwFlags) != DS_OK) {
|
||||
MSGBOX("Can't play DirectSoundBuffer object");
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI StopVoice(UINT nVoice)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
if (DS.aSoundBuffer[nVoice]->lpVtbl->Stop(DS.aSoundBuffer[nVoice]) != DS_OK) {
|
||||
MSGBOX("Can't stop DirectSoundBuffer object");
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetVoicePosition(UINT nVoice, LONG dwPosition)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (dwPosition >= AUDIO_MIN_POSITION &&
|
||||
dwPosition <= AUDIO_MAX_POSITION) {
|
||||
// FIXME: adjust position for 16-bit samples
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
DS.aSoundBuffer[nVoice]->lpVtbl->SetCurrentPosition(DS.aSoundBuffer[nVoice], dwPosition);
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetVoiceFrequency(UINT nVoice, LONG dwFrequency)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (dwFrequency >= AUDIO_MIN_FREQUENCY &&
|
||||
dwFrequency <= AUDIO_MAX_FREQUENCY) {
|
||||
DS.aFrequencyTable[nVoice] = dwFrequency;
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
if (DS.aSoundBuffer[nVoice]->lpVtbl->SetFrequency(DS.aSoundBuffer[nVoice], dwFrequency) != DS_OK)
|
||||
MSGBOX("Can't change DirectSoundBuffer frequency");
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetVoiceVolume(UINT nVoice, UINT nVolume)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (nVolume < AUDIO_MAX_VOLUME) {
|
||||
DS.aVolumeTable[nVoice] = nVolume;
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
if (DS.aSoundBuffer[nVoice]->lpVtbl->SetVolume(DS.aSoundBuffer[nVoice], DS.aLogVolumeTable[nVolume]) != DS_OK)
|
||||
MSGBOX("Can't change DirectSoundBuffer volume");
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetVoicePanning(UINT nVoice, UINT nPanning)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (nPanning < AUDIO_MAX_PANNING) {
|
||||
DS.aPanningTable[nVoice] = nPanning;
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
if (DS.aSoundBuffer[nVoice]->lpVtbl->SetPan(DS.aSoundBuffer[nVoice], DS.aLogPanningTable[nPanning]) != DS_OK)
|
||||
MSGBOX("Can't change DirectSoundBuffer panning");
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoicePosition(UINT nVoice, LPLONG lpdwPosition)
|
||||
{
|
||||
DWORD dwWritePosition;
|
||||
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (lpdwPosition != NULL) {
|
||||
*lpdwPosition = 0L;
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
if (DS.aSoundBuffer[nVoice]->lpVtbl->GetCurrentPosition(
|
||||
DS.aSoundBuffer[nVoice], lpdwPosition, &dwWritePosition) != DS_OK)
|
||||
*lpdwPosition = 0L;
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoiceFrequency(UINT nVoice, LPLONG lpdwFrequency)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (lpdwFrequency != NULL) {
|
||||
*lpdwFrequency = DS.aFrequencyTable[nVoice];
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoiceVolume(UINT nVoice, LPUINT lpnVolume)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (lpnVolume != NULL) {
|
||||
*lpnVolume = DS.aVolumeTable[nVoice];
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoicePanning(UINT nVoice, LPUINT lpnPanning)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (lpnPanning != NULL) {
|
||||
*lpnPanning = DS.aPanningTable[nVoice];
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoiceStatus(UINT nVoice, LPBOOL lpnStatus)
|
||||
{
|
||||
if (nVoice < AUDIO_MAX_VOICES) {
|
||||
if (lpnStatus != NULL) {
|
||||
*lpnStatus = 1;
|
||||
if (DS.aSoundBuffer[nVoice] != NULL) {
|
||||
if (DS.aSoundBuffer[nVoice]->lpVtbl->GetStatus(DS.aSoundBuffer[nVoice], lpnStatus) != DS_OK)
|
||||
MSGBOX("Can't getDirectSoundBuffer status");;
|
||||
*lpnStatus = (*lpnStatus & DSBSTATUS_PLAYING ? 0 : 1);
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DirectSound audio driver public interface
|
||||
*/
|
||||
static AUDIOWAVEDRIVER DirectSoundWaveDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, SetAudioCallback
|
||||
};
|
||||
|
||||
static AUDIOSYNTHDRIVER DirectSoundSynthDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudioSynth, OpenVoices, CloseVoices,
|
||||
SetAudioTimerProc, SetAudioTimerRate, SetAudioMixerValue,
|
||||
GetAudioDataAvail, CreateAudioData, DestroyAudioData,
|
||||
WriteAudioData, PrimeVoice, StartVoice, StopVoice,
|
||||
SetVoicePosition, SetVoiceFrequency, SetVoiceVolume,
|
||||
SetVoicePanning, GetVoicePosition, GetVoiceFrequency,
|
||||
GetVoiceVolume, GetVoicePanning, GetVoiceStatus
|
||||
};
|
||||
|
||||
AUDIODRIVER DirectSoundAccelDriver =
|
||||
{
|
||||
&DirectSoundWaveDriver, &DirectSoundSynthDriver
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,110 +0,0 @@
|
||||
/*
|
||||
* $Id: iofile.c 1.5 1996/08/05 18:51:19 chasan released $
|
||||
*
|
||||
* Input/Output file stream routines.
|
||||
*
|
||||
* Copyright (c) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "audio.h"
|
||||
#include "iofile.h"
|
||||
|
||||
/*
|
||||
* Audio I/O file stream routines
|
||||
*/
|
||||
static FILE *lpStream;
|
||||
|
||||
UINT AIAPI AIOOpenFile(LPSTR lpszFileName)
|
||||
{
|
||||
if ((lpStream = fopen(lpszFileName, "rb")) != NULL)
|
||||
return AUDIO_ERROR_NONE;
|
||||
return AUDIO_ERROR_FILENOTFOUND;
|
||||
}
|
||||
|
||||
UINT AIAPI AIOCloseFile(VOID)
|
||||
{
|
||||
fclose(lpStream);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
UINT AIAPI AIOSeekFile(LONG dwOffset, UINT nWhere)
|
||||
{
|
||||
fseek(lpStream, dwOffset, nWhere);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
UINT AIAPI AIOReadFile(LPVOID lpData, UINT nSize)
|
||||
{
|
||||
if (fread(lpData, 1, nSize, lpStream) != nSize)
|
||||
memset(lpData, 0, nSize);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
/* little-endian input routines */
|
||||
UINT AIAPI AIOReadChar(LPBYTE lpData)
|
||||
{
|
||||
if (fread(lpData, 1, sizeof(BYTE), lpStream) != sizeof(BYTE))
|
||||
memset(lpData, 0, sizeof(BYTE));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
UINT AIAPI AIOReadShort(LPWORD lpData)
|
||||
{
|
||||
if (fread(lpData, 1, sizeof(WORD), lpStream) != sizeof(WORD))
|
||||
memset(lpData, 0, sizeof(WORD));
|
||||
#ifdef __BIGENDIAN__
|
||||
*lpData = MAKEWORD(HIBYTE(*lpData), LOBYTE(*lpData));
|
||||
#endif
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
UINT AIAPI AIOReadLong(LPDWORD lpData)
|
||||
{
|
||||
if (fread(lpData, 1, sizeof(DWORD), lpStream) != sizeof(DWORD))
|
||||
memset(lpData, 0, sizeof(DWORD));
|
||||
#ifdef __BIGENDIAN__
|
||||
*lpData = MAKELONG(
|
||||
MAKEWORD(HIBYTE(HIWORD(*lpData)), LOBYTE(HIWORD(*lpData))),
|
||||
MAKEWORD(HIBYTE(LOWORD(*lpData)), LOBYTE(LOWORD(*lpData))));
|
||||
#endif
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
/* big-endian input routines */
|
||||
UINT AIAPI AIOReadCharM(LPBYTE lpData)
|
||||
{
|
||||
if (fread(lpData, 1, sizeof(BYTE), lpStream) != sizeof(BYTE))
|
||||
memset(lpData, 0, sizeof(BYTE));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
UINT AIAPI AIOReadShortM(LPWORD lpData)
|
||||
{
|
||||
if (fread(lpData, 1, sizeof(WORD), lpStream) != sizeof(WORD))
|
||||
memset(lpData, 0, sizeof(WORD));
|
||||
#ifndef __BIGENDIAN__
|
||||
*lpData = MAKEWORD(HIBYTE(*lpData), LOBYTE(*lpData));
|
||||
#endif
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
UINT AIAPI AIOReadLongM(LPDWORD lpData)
|
||||
{
|
||||
if (fread(lpData, 1, sizeof(DWORD), lpStream) != sizeof(DWORD))
|
||||
memset(lpData, 0, sizeof(DWORD));
|
||||
#ifndef __BIGENDIAN__
|
||||
*lpData = MAKELONG(
|
||||
MAKEWORD(HIBYTE(HIWORD(*lpData)), LOBYTE(HIWORD(*lpData))),
|
||||
MAKEWORD(HIBYTE(LOWORD(*lpData)), LOBYTE(LOWORD(*lpData))));
|
||||
#endif
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* $Id: iofile.h 1.6 1996/09/13 16:30:26 chasan released $
|
||||
*
|
||||
* Input/Output file stream routines.
|
||||
*
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __IOFILE_H
|
||||
#define __IOFILE_H
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <unistd.h>
|
||||
#include <memory.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
UINT AIAPI AIOOpenFile(LPSTR lpszFileName);
|
||||
UINT AIAPI AIOCloseFile(VOID);
|
||||
UINT AIAPI AIOSeekFile(LONG dwOffset, UINT nWhere);
|
||||
UINT AIAPI AIOReadFile(LPVOID lpData, UINT nSize);
|
||||
UINT AIAPI AIOReadChar(LPBYTE lpData);
|
||||
UINT AIAPI AIOReadShort(LPWORD lpData);
|
||||
UINT AIAPI AIOReadLong(LPDWORD lpData);
|
||||
UINT AIAPI AIOReadCharM(LPBYTE lpData);
|
||||
UINT AIAPI AIOReadShortM(LPWORD lpData);
|
||||
UINT AIAPI AIOReadLongM(LPDWORD lpData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,144 +0,0 @@
|
||||
/*
|
||||
* $Id: lnxdrv.c 1.5 1996/08/05 18:51:19 chasan released $
|
||||
*
|
||||
* Linux's Voxware audio driver.
|
||||
*
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#ifdef __LINUX__
|
||||
#include <linux/soundcard.h>
|
||||
#endif
|
||||
#ifdef __FREEBSD__
|
||||
#include <machine/soundcard.h>
|
||||
#endif
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
|
||||
/*
|
||||
* Linux driver buffer fragments defines
|
||||
*/
|
||||
#define NUMFRAGS 16
|
||||
#define FRAGSIZE 12
|
||||
#define BUFFERSIZE (1 << FRAGSIZE)
|
||||
|
||||
/*
|
||||
* Linux driver configuration structure
|
||||
*/
|
||||
static struct {
|
||||
int nHandle;
|
||||
BYTE aBuffer[BUFFERSIZE];
|
||||
LPFNAUDIOWAVE lpfnAudioWave;
|
||||
WORD wFormat;
|
||||
} Audio;
|
||||
|
||||
|
||||
/*
|
||||
* Linux driver API interface
|
||||
*/
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
static AUDIOCAPS Caps =
|
||||
{
|
||||
AUDIO_PRODUCT_LINUX, "Linux Voxware",
|
||||
AUDIO_FORMAT_1M08 | AUDIO_FORMAT_1S08 |
|
||||
AUDIO_FORMAT_1M16 | AUDIO_FORMAT_1S16 |
|
||||
AUDIO_FORMAT_2M08 | AUDIO_FORMAT_2S08 |
|
||||
AUDIO_FORMAT_2M16 | AUDIO_FORMAT_2S16 |
|
||||
AUDIO_FORMAT_4M08 | AUDIO_FORMAT_4S08 |
|
||||
AUDIO_FORMAT_4M16 | AUDIO_FORMAT_4S16
|
||||
};
|
||||
|
||||
memcpy(lpCaps, &Caps, sizeof(AUDIOCAPS));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
return access("/dev/dsp", W_OK) ? AUDIO_ERROR_NODEVICE : AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
int nBitsPerSample, nStereoOn, nSampleRate, nFrags;
|
||||
|
||||
memset(&Audio, 0, sizeof(Audio));
|
||||
|
||||
/* try to open DSP audio device for playback */
|
||||
if ((Audio.nHandle = open("/dev/dsp", O_WRONLY | O_NDELAY)) < 0)
|
||||
return AUDIO_ERROR_DEVICEBUSY;
|
||||
|
||||
/* setup number and size of buffer fragments */
|
||||
nFrags = (NUMFRAGS << 16) + (FRAGSIZE);
|
||||
ioctl(Audio.nHandle, SNDCTL_DSP_SETFRAGMENT, &nFrags);
|
||||
|
||||
/* setup audio playback encoding format and sampling frequency */
|
||||
nBitsPerSample = lpInfo->wFormat & AUDIO_FORMAT_16BITS ? 16 : 8;
|
||||
nStereoOn = lpInfo->wFormat & AUDIO_FORMAT_STEREO ? 1 : 0;
|
||||
nSampleRate = lpInfo->nSampleRate;
|
||||
if (ioctl(Audio.nHandle, SNDCTL_DSP_SAMPLESIZE, &nBitsPerSample) < 0 ||
|
||||
ioctl(Audio.nHandle, SNDCTL_DSP_STEREO, &nStereoOn) < 0 ||
|
||||
ioctl(Audio.nHandle, SNDCTL_DSP_SPEED, &nSampleRate) < 0) {
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_BADFORMAT;
|
||||
}
|
||||
|
||||
Audio.wFormat = lpInfo->wFormat;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
/* close DSP audio device */
|
||||
close(Audio.nHandle);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(UINT nFrames)
|
||||
{
|
||||
/* compute frame size */
|
||||
if (Audio.wFormat & AUDIO_FORMAT_16BITS) nFrames <<= 1;
|
||||
if (Audio.wFormat & AUDIO_FORMAT_STEREO) nFrames <<= 1;
|
||||
if (nFrames <= 0 || nFrames > sizeof(Audio.aBuffer))
|
||||
nFrames = sizeof(Audio.aBuffer);
|
||||
|
||||
/* send PCM samples to the DSP audio device */
|
||||
if (Audio.lpfnAudioWave != NULL) {
|
||||
Audio.lpfnAudioWave(Audio.aBuffer, nFrames);
|
||||
write(Audio.nHandle, Audio.aBuffer, nFrames);
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioCallback(LPFNAUDIOWAVE lpfnAudioWave)
|
||||
{
|
||||
/* set up DSP audio device user's callback function */
|
||||
Audio.lpfnAudioWave = lpfnAudioWave;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Linux driver public interface
|
||||
*/
|
||||
AUDIOWAVEDRIVER LinuxWaveDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, SetAudioCallback
|
||||
};
|
||||
|
||||
AUDIODRIVER LinuxDriver =
|
||||
{
|
||||
&LinuxWaveDriver, NULL
|
||||
};
|
||||
@ -1,909 +0,0 @@
|
||||
/*
|
||||
* $Id: mixdrv.c 1.13 1996/09/08 21:14:54 chasan released $
|
||||
* 1.14 1998/10/24 18:20:53 chasan released (Mixer API)
|
||||
*
|
||||
* Software-based waveform synthesizer emulator driver.
|
||||
*
|
||||
* Copyright (C) 1995-1999 Carlos Hasan
|
||||
*
|
||||
* 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#define __FILTER__
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <memory.h>
|
||||
#define cdecl
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "audio.h"
|
||||
#include "drivers.h"
|
||||
|
||||
|
||||
/*
|
||||
* Voice control bit fields
|
||||
*/
|
||||
#define VOICE_STOP 0x01
|
||||
#define VOICE_16BITS 0x02
|
||||
#define VOICE_LOOP 0x04
|
||||
#define VOICE_BIDILOOP 0x08
|
||||
#define VOICE_REVERSE 0x10
|
||||
|
||||
/*
|
||||
* Voice pitch accurary and mixing buffer size
|
||||
*/
|
||||
#define ACCURACY 12
|
||||
#define BUFFERSIZE 512
|
||||
|
||||
|
||||
/*
|
||||
* Waveform synthesizer voice structure
|
||||
*/
|
||||
typedef struct {
|
||||
LPVOID lpData;
|
||||
LONG dwAccum;
|
||||
LONG dwFrequency;
|
||||
LONG dwLoopStart;
|
||||
LONG dwLoopEnd;
|
||||
BYTE nVolume;
|
||||
BYTE nPanning;
|
||||
BYTE bControl;
|
||||
BYTE bReserved;
|
||||
} VOICE, *LPVOICE;
|
||||
|
||||
/*
|
||||
* Low level voice mixing routine prototype
|
||||
*/
|
||||
typedef VOID (cdecl* LPFNMIXAUDIO)(LPLONG, UINT, LPVOICE);
|
||||
|
||||
/*
|
||||
* Waveform synthesizer state structure
|
||||
*/
|
||||
static struct {
|
||||
VOICE aVoices[AUDIO_MAX_VOICES];
|
||||
UINT nVoices;
|
||||
UINT wFormat;
|
||||
UINT nSampleRate;
|
||||
LONG dwTimerRate;
|
||||
LONG dwTimerAccum;
|
||||
LPBYTE lpMemory;
|
||||
LPFNAUDIOTIMER lpfnAudioTimer;
|
||||
LPFNMIXAUDIO lpfnMixAudioProc[2];
|
||||
} Synth;
|
||||
|
||||
LPLONG lpVolumeTable;
|
||||
LPBYTE lpFilterTable;
|
||||
|
||||
static VOID AIAPI UpdateVoices(LPBYTE lpData, UINT nCount);
|
||||
|
||||
/* low level resamplation and quantization routines */
|
||||
#ifdef __ASM__
|
||||
|
||||
VOID cdecl QuantAudioData08(LPVOID lpBuffer, LPLONG lpData, UINT nCount);
|
||||
VOID cdecl QuantAudioData16(LPVOID lpBuffer, LPLONG lpData, UINT nCount);
|
||||
VOID cdecl MixAudioData08M(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice);
|
||||
VOID cdecl MixAudioData08S(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice);
|
||||
VOID cdecl MixAudioData08MI(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice);
|
||||
VOID cdecl MixAudioData08SI(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice);
|
||||
VOID cdecl MixAudioData16M(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice);
|
||||
VOID cdecl MixAudioData16S(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice);
|
||||
VOID cdecl MixAudioData16MI(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice);
|
||||
VOID cdecl MixAudioData16SI(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice);
|
||||
|
||||
static VOID QuantAudioData(LPVOID lpBuffer, LPLONG lpData, UINT nCount)
|
||||
{
|
||||
if (Synth.wFormat & AUDIO_FORMAT_16BITS)
|
||||
QuantAudioData16(lpBuffer, lpData, nCount);
|
||||
else
|
||||
QuantAudioData08(lpBuffer, lpData, nCount);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
typedef short SHORT;
|
||||
typedef SHORT* LPSHORT;
|
||||
|
||||
static VOID QuantAudioData(LPVOID lpBuffer, LPLONG lpData, UINT nCount)
|
||||
{
|
||||
LPSHORT lpwBuffer;
|
||||
LPBYTE lpbBuffer;
|
||||
LONG dwSample;
|
||||
|
||||
if (Synth.wFormat & AUDIO_FORMAT_16BITS) {
|
||||
lpwBuffer = (LPSHORT) lpBuffer;
|
||||
while (nCount-- > 0) {
|
||||
dwSample = *lpData++;
|
||||
if (dwSample < -32768)
|
||||
dwSample = -32768;
|
||||
else if (dwSample > +32767)
|
||||
dwSample = +32767;
|
||||
*lpwBuffer++ = (SHORT) dwSample;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lpbBuffer = (LPBYTE) lpBuffer;
|
||||
while (nCount-- > 0) {
|
||||
dwSample = *lpData++;
|
||||
if (dwSample < -32768)
|
||||
dwSample = -32768;
|
||||
else if (dwSample > +32767)
|
||||
dwSample = +32767;
|
||||
*lpbBuffer++ = (BYTE) ((dwSample >> 8) + 128);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static VOID AIAPI
|
||||
MixAudioData08M(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
register UINT count;
|
||||
register DWORD accum, delta;
|
||||
register LPLONG table, buf;
|
||||
register LPBYTE data;
|
||||
|
||||
accum = lpVoice->dwAccum;
|
||||
delta = lpVoice->dwFrequency;
|
||||
table = lpVolumeTable + ((UINT) lpVoice->nVolume << 8);
|
||||
data = lpVoice->lpData;
|
||||
buf = lpBuffer;
|
||||
count = nCount;
|
||||
|
||||
do {
|
||||
*buf++ += table[data[accum >> ACCURACY]];
|
||||
accum += delta;
|
||||
} while (--count != 0);
|
||||
|
||||
lpVoice->dwAccum = accum;
|
||||
}
|
||||
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
static VOID AIAPI
|
||||
MixAudioData08S(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
register UINT a;
|
||||
register DWORD accum, delta;
|
||||
register LPLONG ltable, rtable, buf;
|
||||
register LPBYTE data;
|
||||
|
||||
accum = lpVoice->dwAccum;
|
||||
delta = lpVoice->dwFrequency;
|
||||
a = ((UINT) lpVoice->nVolume * lpVoice->nPanning) >> 8;
|
||||
rtable = lpVolumeTable + (a << 8);
|
||||
ltable = lpVolumeTable + ((lpVoice->nVolume - a) << 8);
|
||||
data = lpVoice->lpData;
|
||||
buf = lpBuffer;
|
||||
|
||||
do {
|
||||
a = data[accum >> ACCURACY];
|
||||
buf[0] += ltable[a];
|
||||
buf[1] += rtable[a];
|
||||
accum += delta;
|
||||
buf += 2;
|
||||
} while (--nCount != 0);
|
||||
|
||||
lpVoice->dwAccum = accum;
|
||||
}
|
||||
|
||||
static VOID AIAPI
|
||||
MixAudioData08MI(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
register INT a, frac;
|
||||
register DWORD accum, delta;
|
||||
register LPLONG table, buf;
|
||||
register LPBYTE data, ftable;
|
||||
|
||||
/* adaptive oversampling interpolation comparison */
|
||||
if (lpVoice->dwFrequency < -(1 << ACCURACY) ||
|
||||
lpVoice->dwFrequency > +(1 << ACCURACY)) {
|
||||
MixAudioData08M(lpBuffer, nCount, lpVoice);
|
||||
return;
|
||||
}
|
||||
|
||||
accum = lpVoice->dwAccum;
|
||||
delta = lpVoice->dwFrequency;
|
||||
table = lpVolumeTable + ((UINT) lpVoice->nVolume << 8);
|
||||
data = lpVoice->lpData;
|
||||
buf = lpBuffer;
|
||||
|
||||
#ifdef __FILTER__
|
||||
a = (BYTE) lpVoice->bReserved;
|
||||
frac = ((long) delta < 0 ? -delta : +delta) >> (ACCURACY - 5);
|
||||
ftable = lpFilterTable + (frac << 8);
|
||||
do {
|
||||
a = (BYTE)(a + ftable[data[accum >> ACCURACY]] - ftable[a]);
|
||||
*buf++ += table[a];
|
||||
accum += delta;
|
||||
} while (--nCount != 0);
|
||||
lpVoice->bReserved = (BYTE) a;
|
||||
#else
|
||||
do {
|
||||
register INT b;
|
||||
a = (signed char) data[accum >> ACCURACY];
|
||||
b = (signed char) data[(accum >> ACCURACY) + 1];
|
||||
frac = (accum & ((1 << ACCURACY) - 1)) >> (ACCURACY - 5);
|
||||
a = (BYTE)(a + ((frac * (b - a)) >> 5));
|
||||
*buf++ += table[a];
|
||||
accum += delta;
|
||||
} while (--nCount != 0);
|
||||
#endif
|
||||
|
||||
lpVoice->dwAccum = accum;
|
||||
}
|
||||
|
||||
static VOID AIAPI
|
||||
MixAudioData08SI(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
register INT a, frac;
|
||||
register DWORD accum, delta;
|
||||
register LPLONG buf, ltable, rtable;
|
||||
register LPBYTE data, ftable;
|
||||
|
||||
/* adaptive oversampling interpolation comparison */
|
||||
if (lpVoice->dwFrequency < -(1 << ACCURACY) ||
|
||||
lpVoice->dwFrequency > +(1 << ACCURACY)) {
|
||||
MixAudioData08S(lpBuffer, nCount, lpVoice);
|
||||
return;
|
||||
}
|
||||
|
||||
accum = lpVoice->dwAccum;
|
||||
delta = lpVoice->dwFrequency;
|
||||
a = ((UINT) lpVoice->nVolume * lpVoice->nPanning) >> 8;
|
||||
rtable = lpVolumeTable + (a << 8);
|
||||
ltable = lpVolumeTable + ((lpVoice->nVolume - a) << 8);
|
||||
data = lpVoice->lpData;
|
||||
buf = lpBuffer;
|
||||
|
||||
#ifdef __FILTER__
|
||||
a = (BYTE) lpVoice->bReserved;
|
||||
frac = ((long) delta < 0 ? -delta : +delta) >> (ACCURACY - 5);
|
||||
ftable = lpFilterTable + (frac << 8);
|
||||
do {
|
||||
a = (BYTE)(a + ftable[data[accum >> ACCURACY]] - ftable[a]);
|
||||
buf[0] += ltable[a];
|
||||
buf[1] += rtable[a];
|
||||
accum += delta;
|
||||
buf += 2;
|
||||
} while (--nCount != 0);
|
||||
lpVoice->bReserved = (BYTE) a;
|
||||
#else
|
||||
do {
|
||||
register INT b;
|
||||
a = (signed char) data[accum >> ACCURACY];
|
||||
b = (signed char) data[(accum >> ACCURACY) + 1];
|
||||
frac = (accum & ((1 << ACCURACY) - 1)) >> (ACCURACY - 5);
|
||||
a = (BYTE)(a + ((frac * (b - a)) >> 5));
|
||||
buf[0] += ltable[a];
|
||||
buf[1] += rtable[a];
|
||||
accum += delta;
|
||||
buf += 2;
|
||||
} while (--nCount != 0);
|
||||
#endif
|
||||
|
||||
lpVoice->dwAccum = accum;
|
||||
}
|
||||
|
||||
static VOID AIAPI
|
||||
MixAudioData16M(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
register UINT a, count;
|
||||
register DWORD accum, delta;
|
||||
register LPLONG table, buf;
|
||||
register LPWORD data;
|
||||
|
||||
accum = lpVoice->dwAccum;
|
||||
delta = lpVoice->dwFrequency;
|
||||
table = lpVolumeTable + ((UINT) lpVoice->nVolume << 8);
|
||||
data = lpVoice->lpData;
|
||||
buf = lpBuffer;
|
||||
count = nCount;
|
||||
|
||||
do {
|
||||
a = data[accum >> ACCURACY];
|
||||
*buf++ += table[a >> 8];
|
||||
accum += delta;
|
||||
} while (--count != 0);
|
||||
|
||||
lpVoice->dwAccum = accum;
|
||||
}
|
||||
|
||||
static VOID AIAPI
|
||||
MixAudioData16S(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
register UINT a;
|
||||
register DWORD accum, delta;
|
||||
register LPLONG ltable, rtable, buf;
|
||||
register LPWORD data;
|
||||
|
||||
accum = lpVoice->dwAccum;
|
||||
delta = lpVoice->dwFrequency;
|
||||
a = ((UINT) lpVoice->nVolume * lpVoice->nPanning) >> 8;
|
||||
rtable = lpVolumeTable + (a << 8);
|
||||
ltable = lpVolumeTable + ((lpVoice->nVolume - a) << 8);
|
||||
data = lpVoice->lpData;
|
||||
buf = lpBuffer;
|
||||
|
||||
do {
|
||||
a = data[accum >> ACCURACY];
|
||||
buf[0] += ltable[a >> 8];
|
||||
buf[1] += rtable[a >> 8];
|
||||
accum += delta;
|
||||
buf += 2;
|
||||
} while (--nCount != 0);
|
||||
|
||||
lpVoice->dwAccum = accum;
|
||||
}
|
||||
|
||||
|
||||
static VOID AIAPI
|
||||
MixAudioData16MI(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
register UINT frac, count;
|
||||
register DWORD a, b, accum, delta;
|
||||
register LPLONG table, buf;
|
||||
register LPWORD data;
|
||||
|
||||
/* adaptive oversampling interpolation comparison */
|
||||
if (lpVoice->dwFrequency < -(1 << ACCURACY) ||
|
||||
lpVoice->dwFrequency > +(1 << ACCURACY)) {
|
||||
MixAudioData16M(lpBuffer, nCount, lpVoice);
|
||||
return;
|
||||
}
|
||||
|
||||
accum = lpVoice->dwAccum;
|
||||
delta = lpVoice->dwFrequency;
|
||||
table = lpVolumeTable + ((UINT) lpVoice->nVolume << 8);
|
||||
data = lpVoice->lpData;
|
||||
buf = lpBuffer;
|
||||
count = nCount;
|
||||
|
||||
do {
|
||||
a = data[accum >> ACCURACY];
|
||||
b = data[(accum >> ACCURACY) + 1];
|
||||
frac = (accum & ((1 << ACCURACY) - 1)) >> (ACCURACY - 5);
|
||||
a = (WORD)((SHORT)a + ((frac * ((SHORT)b - (SHORT)a)) >> 5));
|
||||
*buf++ += table[a >> 8];
|
||||
accum += delta;
|
||||
} while (--count != 0);
|
||||
|
||||
lpVoice->dwAccum = accum;
|
||||
}
|
||||
|
||||
static VOID AIAPI
|
||||
MixAudioData16SI(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
register UINT frac;
|
||||
register DWORD a, b, accum, delta;
|
||||
register LPLONG ltable, rtable, buf;
|
||||
register LPWORD data;
|
||||
|
||||
/* adaptive oversampling interpolation comparison */
|
||||
if (lpVoice->dwFrequency < -(1 << ACCURACY) ||
|
||||
lpVoice->dwFrequency > +(1 << ACCURACY)) {
|
||||
MixAudioData16S(lpBuffer, nCount, lpVoice);
|
||||
return;
|
||||
}
|
||||
|
||||
accum = lpVoice->dwAccum;
|
||||
delta = lpVoice->dwFrequency;
|
||||
a = ((UINT) lpVoice->nVolume * lpVoice->nPanning) >> 8;
|
||||
rtable = lpVolumeTable + (a << 8);
|
||||
ltable = lpVolumeTable + ((lpVoice->nVolume - a) << 8);
|
||||
data = lpVoice->lpData;
|
||||
buf = lpBuffer;
|
||||
|
||||
do {
|
||||
a = data[accum >> ACCURACY];
|
||||
b = data[(accum >> ACCURACY) + 1];
|
||||
frac = (accum & ((1 << ACCURACY) - 1)) >> (ACCURACY - 5);
|
||||
a = (WORD)((SHORT)a + ((frac * ((int)(SHORT)b - (int)(SHORT)a)) >> 5));
|
||||
buf[0] += ltable[a >> 8];
|
||||
buf[1] += rtable[a >> 8];
|
||||
accum += delta;
|
||||
buf += 2;
|
||||
} while (--nCount != 0);
|
||||
|
||||
lpVoice->dwAccum = accum;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static VOID MixAudioData(LPLONG lpBuffer, UINT nCount, LPVOICE lpVoice)
|
||||
{
|
||||
UINT nSize;
|
||||
|
||||
if (Synth.wFormat & AUDIO_FORMAT_STEREO)
|
||||
nCount >>= 1;
|
||||
|
||||
while (nCount > 0 && !(lpVoice->bControl & VOICE_STOP)) {
|
||||
/* check boundary conditions */
|
||||
if (lpVoice->bControl & VOICE_REVERSE) {
|
||||
if (lpVoice->dwAccum < lpVoice->dwLoopStart) {
|
||||
if (lpVoice->bControl & VOICE_BIDILOOP) {
|
||||
lpVoice->dwAccum = lpVoice->dwLoopStart +
|
||||
(lpVoice->dwLoopStart - lpVoice->dwAccum);
|
||||
lpVoice->bControl ^= VOICE_REVERSE;
|
||||
continue;
|
||||
}
|
||||
else if (lpVoice->bControl & VOICE_LOOP) {
|
||||
lpVoice->dwAccum = lpVoice->dwLoopEnd -
|
||||
(lpVoice->dwLoopStart - lpVoice->dwAccum);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
lpVoice->bControl |= VOICE_STOP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (lpVoice->dwAccum > lpVoice->dwLoopEnd) {
|
||||
if (lpVoice->bControl & VOICE_BIDILOOP) {
|
||||
lpVoice->dwAccum = lpVoice->dwLoopEnd -
|
||||
(lpVoice->dwAccum - lpVoice->dwLoopEnd);
|
||||
lpVoice->bControl ^= VOICE_REVERSE;
|
||||
continue;
|
||||
}
|
||||
else if (lpVoice->bControl & VOICE_LOOP) {
|
||||
lpVoice->dwAccum = lpVoice->dwLoopStart +
|
||||
(lpVoice->dwAccum - lpVoice->dwLoopEnd);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
lpVoice->bControl |= VOICE_STOP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check for overflow and clip if necessary */
|
||||
nSize = nCount;
|
||||
if (lpVoice->bControl & VOICE_REVERSE) {
|
||||
if (nSize * lpVoice->dwFrequency >
|
||||
lpVoice->dwAccum - lpVoice->dwLoopStart)
|
||||
nSize = (lpVoice->dwAccum - lpVoice->dwLoopStart +
|
||||
lpVoice->dwFrequency) / lpVoice->dwFrequency;
|
||||
}
|
||||
else {
|
||||
if (nSize * lpVoice->dwFrequency >
|
||||
lpVoice->dwLoopEnd - lpVoice->dwAccum)
|
||||
nSize = (lpVoice->dwLoopEnd - lpVoice->dwAccum +
|
||||
lpVoice->dwFrequency) / lpVoice->dwFrequency;
|
||||
}
|
||||
|
||||
if (lpVoice->bControl & VOICE_REVERSE)
|
||||
lpVoice->dwFrequency = -lpVoice->dwFrequency;
|
||||
|
||||
/* mixes chunk of data in a burst mode */
|
||||
if (lpVoice->bControl & VOICE_16BITS) {
|
||||
Synth.lpfnMixAudioProc[1] (lpBuffer, nSize, lpVoice);
|
||||
}
|
||||
else {
|
||||
Synth.lpfnMixAudioProc[0] (lpBuffer, nSize, lpVoice);
|
||||
}
|
||||
|
||||
if (lpVoice->bControl & VOICE_REVERSE)
|
||||
lpVoice->dwFrequency = -lpVoice->dwFrequency;
|
||||
|
||||
/* update mixing buffer address and counter */
|
||||
lpBuffer += nSize;
|
||||
if (Synth.wFormat & AUDIO_FORMAT_STEREO)
|
||||
lpBuffer += nSize;
|
||||
nCount -= nSize;
|
||||
}
|
||||
}
|
||||
|
||||
static VOID MixAudioVoices(LPLONG lpBuffer, UINT nCount)
|
||||
{
|
||||
UINT nVoice, nSize;
|
||||
|
||||
while (nCount > 0) {
|
||||
nSize = nCount;
|
||||
if (Synth.lpfnAudioTimer != NULL) {
|
||||
nSize = (Synth.dwTimerRate - Synth.dwTimerAccum + 64L) & ~63L;
|
||||
if (nSize > nCount)
|
||||
nSize = nCount;
|
||||
if ((Synth.dwTimerAccum += nSize) >= Synth.dwTimerRate) {
|
||||
Synth.dwTimerAccum -= Synth.dwTimerRate;
|
||||
Synth.lpfnAudioTimer();
|
||||
}
|
||||
}
|
||||
for (nVoice = 0; nVoice < Synth.nVoices; nVoice++) {
|
||||
MixAudioData(lpBuffer, nSize, &Synth.aVoices[nVoice]);
|
||||
}
|
||||
lpBuffer += nSize;
|
||||
nCount -= nSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* High level waveform synthesizer interface
|
||||
*/
|
||||
static UINT AIAPI GetAudioCaps(LPAUDIOCAPS lpCaps)
|
||||
{
|
||||
memset(lpCaps, 0, sizeof(AUDIOCAPS));
|
||||
return AUDIO_ERROR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
static UINT AIAPI PingAudio(VOID)
|
||||
{
|
||||
return AUDIO_ERROR_NOTSUPPORTED;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
|
||||
{
|
||||
memset(&Synth, 0, sizeof(Synth));
|
||||
Synth.wFormat = lpInfo->wFormat;
|
||||
Synth.nSampleRate = lpInfo->nSampleRate;
|
||||
if (Synth.wFormat & AUDIO_FORMAT_FILTER) {
|
||||
Synth.lpfnMixAudioProc[0] = (Synth.wFormat & AUDIO_FORMAT_STEREO) ?
|
||||
MixAudioData08SI : MixAudioData08MI;
|
||||
Synth.lpfnMixAudioProc[1] = (Synth.wFormat & AUDIO_FORMAT_STEREO) ?
|
||||
MixAudioData16SI : MixAudioData16MI;
|
||||
}
|
||||
else {
|
||||
Synth.lpfnMixAudioProc[0] = (Synth.wFormat & AUDIO_FORMAT_STEREO) ?
|
||||
MixAudioData08S : MixAudioData08M;
|
||||
Synth.lpfnMixAudioProc[1] = (Synth.wFormat & AUDIO_FORMAT_STEREO) ?
|
||||
MixAudioData16S : MixAudioData16M;
|
||||
}
|
||||
|
||||
/* allocate volume (0-64) and filter (0-31) table */
|
||||
Synth.lpMemory = malloc(sizeof(LONG) * 65 * 256 +
|
||||
sizeof(BYTE) * 32 * 256 + 1023);
|
||||
if (Synth.lpMemory != NULL) {
|
||||
uintptr_t tmp;
|
||||
tmp = ((uintptr_t)(Synth.lpMemory) + 1023) & ~1023;
|
||||
lpVolumeTable = (LPLONG)(tmp);
|
||||
lpFilterTable = (LPBYTE) (lpVolumeTable + 65 * 256);
|
||||
ASetAudioMixerValue(AUDIO_MIXER_MASTER_VOLUME, 96);
|
||||
ASetAudioCallback(UpdateVoices);
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_NOMEMORY;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseAudio(VOID)
|
||||
{
|
||||
if (Synth.lpMemory != NULL)
|
||||
free(Synth.lpMemory);
|
||||
memset(&Synth, 0, sizeof(Synth));
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioMixerValue(UINT nChannel, UINT nMixerValue)
|
||||
{
|
||||
LPBYTE lpFilter;
|
||||
LPLONG lpVolume;
|
||||
UINT nVolume, nSample;
|
||||
LONG dwAccum, dwDelta;
|
||||
|
||||
if (Synth.lpMemory == NULL)
|
||||
return AUDIO_ERROR_NOTSUPPORTED;
|
||||
|
||||
/* master volume must be less than 256 units */
|
||||
if (nChannel != AUDIO_MIXER_MASTER_VOLUME || nMixerValue > 256)
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
|
||||
/* half dynamic range for mono output */
|
||||
if (!(Synth.wFormat & AUDIO_FORMAT_STEREO))
|
||||
nMixerValue >>= 1;
|
||||
|
||||
/* build volume table (0-64) */
|
||||
lpVolume = lpVolumeTable;
|
||||
dwDelta = 0;
|
||||
for (nVolume = 0; nVolume <= 64; nVolume++, dwDelta += nMixerValue) {
|
||||
dwAccum = 0;
|
||||
for (nSample = 0; nSample < 128; nSample++, dwAccum += dwDelta)
|
||||
*lpVolume++ = dwAccum >> 4;
|
||||
dwAccum = -dwAccum;
|
||||
for (nSample = 0; nSample < 128; nSample++, dwAccum += dwDelta)
|
||||
*lpVolume++ = dwAccum >> 4;
|
||||
}
|
||||
|
||||
#ifdef __FILTER__
|
||||
/* build lowpass filter table (0-31) */
|
||||
lpFilter = lpFilterTable;
|
||||
for (nVolume = 0; nVolume < 32; nVolume++) {
|
||||
dwAccum = 0;
|
||||
for (nSample = 0; nSample < 128; nSample++, dwAccum += nVolume)
|
||||
*lpFilter++ = dwAccum >> 5;
|
||||
dwAccum = -dwAccum;
|
||||
for (nSample = 0; nSample < 128; nSample++, dwAccum += nVolume)
|
||||
*lpFilter++ = dwAccum >> 5;
|
||||
}
|
||||
#endif
|
||||
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI OpenVoices(UINT nVoices)
|
||||
{
|
||||
UINT nVoice;
|
||||
|
||||
/*
|
||||
* Initialize waveform synthesizer structure for playback
|
||||
*/
|
||||
if (nVoices >= 1 && nVoices <= AUDIO_MAX_VOICES) {
|
||||
Synth.nVoices = nVoices;
|
||||
for (nVoice = 0; nVoice < Synth.nVoices; nVoice++)
|
||||
Synth.aVoices[nVoice].bControl = VOICE_STOP;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
static UINT AIAPI CloseVoices(VOID)
|
||||
{
|
||||
UINT nVoice;
|
||||
|
||||
memset(Synth.aVoices, 0, sizeof(Synth.aVoices));
|
||||
for (nVoice = 0; nVoice < AUDIO_MAX_VOICES; nVoice++)
|
||||
Synth.aVoices[nVoice].bControl = VOICE_STOP;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI UpdateAudio(VOID)
|
||||
{
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static LONG AIAPI GetAudioDataAvail(VOID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UINT AIAPI CreateAudioData(LPAUDIOWAVE lpWave)
|
||||
{
|
||||
if (lpWave != NULL) {
|
||||
lpWave->dwHandle = (uintptr_t) lpWave->lpData;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI DestroyAudioData(LPAUDIOWAVE lpWave)
|
||||
{
|
||||
if (lpWave != NULL && lpWave->dwHandle != 0) {
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI WriteAudioData(LPAUDIOWAVE lpWave, DWORD dwOffset, UINT nCount)
|
||||
{
|
||||
if (lpWave != NULL && lpWave->dwHandle != 0) {
|
||||
/* anticlick removal work around */
|
||||
if (lpWave->wFormat & AUDIO_FORMAT_LOOP) {
|
||||
*(LPDWORD) (lpWave->dwHandle + lpWave->dwLoopEnd) =
|
||||
*(LPDWORD) (lpWave->dwHandle + lpWave->dwLoopStart);
|
||||
}
|
||||
else if (dwOffset + nCount >= lpWave->dwLength) {
|
||||
*(LPDWORD) (lpWave->dwHandle + lpWave->dwLength) = 0;
|
||||
}
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI PrimeVoice(UINT nVoice, LPAUDIOWAVE lpWave)
|
||||
{
|
||||
LPVOICE lpVoice;
|
||||
|
||||
if (nVoice < Synth.nVoices && lpWave != NULL && lpWave->dwHandle != 0) {
|
||||
lpVoice = &Synth.aVoices[nVoice];
|
||||
lpVoice->lpData = (LPVOID) lpWave->dwHandle;
|
||||
lpVoice->bControl = VOICE_STOP;
|
||||
lpVoice->dwAccum = 0;
|
||||
if (lpWave->wFormat & (AUDIO_FORMAT_LOOP | AUDIO_FORMAT_BIDILOOP)) {
|
||||
lpVoice->dwLoopStart = lpWave->dwLoopStart;
|
||||
lpVoice->dwLoopEnd = lpWave->dwLoopEnd;
|
||||
lpVoice->bControl |= VOICE_LOOP;
|
||||
if (lpWave->wFormat & AUDIO_FORMAT_BIDILOOP)
|
||||
lpVoice->bControl |= VOICE_BIDILOOP;
|
||||
}
|
||||
else {
|
||||
lpVoice->dwLoopStart = lpWave->dwLength;
|
||||
lpVoice->dwLoopEnd = lpWave->dwLength;
|
||||
}
|
||||
if (lpWave->wFormat & AUDIO_FORMAT_16BITS) {
|
||||
lpVoice->dwLoopStart >>= 1;
|
||||
lpVoice->dwLoopEnd >>= 1;
|
||||
lpVoice->bControl |= VOICE_16BITS;
|
||||
}
|
||||
lpVoice->dwAccum <<= ACCURACY;
|
||||
lpVoice->dwLoopStart <<= ACCURACY;
|
||||
lpVoice->dwLoopEnd <<= ACCURACY;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI StartVoice(UINT nVoice)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
Synth.aVoices[nVoice].bControl &= ~VOICE_STOP;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI StopVoice(UINT nVoice)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
Synth.aVoices[nVoice].bControl |= VOICE_STOP;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
|
||||
}
|
||||
|
||||
static UINT AIAPI SetVoicePosition(UINT nVoice, LONG dwPosition)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
dwPosition <<= ACCURACY;
|
||||
if (dwPosition >= 0 && dwPosition < Synth.aVoices[nVoice].dwLoopEnd) {
|
||||
Synth.aVoices[nVoice].dwAccum = dwPosition;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetVoiceFrequency(UINT nVoice, LONG dwFrequency)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
if (dwFrequency >= AUDIO_MIN_FREQUENCY &&
|
||||
dwFrequency <= AUDIO_MAX_FREQUENCY) {
|
||||
Synth.aVoices[nVoice].dwFrequency = ((dwFrequency << ACCURACY) +
|
||||
(Synth.nSampleRate >> 1)) / Synth.nSampleRate;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetVoiceVolume(UINT nVoice, UINT nVolume)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
if (nVolume <= AUDIO_MAX_VOLUME) {
|
||||
Synth.aVoices[nVoice].nVolume = nVolume >> 1;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetVoicePanning(UINT nVoice, UINT nPanning)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
if (nPanning <= AUDIO_MAX_PANNING) {
|
||||
Synth.aVoices[nVoice].nPanning = nPanning;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoicePosition(UINT nVoice, LPLONG lpdwPosition)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
if (lpdwPosition != NULL) {
|
||||
*lpdwPosition = Synth.aVoices[nVoice].dwAccum >> ACCURACY;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoiceFrequency(UINT nVoice, LPLONG lpdwFrequency)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
if (lpdwFrequency != NULL) {
|
||||
*lpdwFrequency = (Synth.aVoices[nVoice].dwFrequency *
|
||||
Synth.nSampleRate) >> ACCURACY;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoiceVolume(UINT nVoice, LPUINT lpnVolume)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
if (lpnVolume != NULL) {
|
||||
*lpnVolume = Synth.aVoices[nVoice].nVolume << 1;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoicePanning(UINT nVoice, LPUINT lpnPanning)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
if (lpnPanning != NULL) {
|
||||
*lpnPanning = Synth.aVoices[nVoice].nPanning;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI GetVoiceStatus(UINT nVoice, LPBOOL lpnStatus)
|
||||
{
|
||||
if (nVoice < Synth.nVoices) {
|
||||
if (lpnStatus != NULL) {
|
||||
*lpnStatus = (Synth.aVoices[nVoice].bControl & VOICE_STOP) != 0;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
return AUDIO_ERROR_INVALHANDLE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioTimerProc(LPFNAUDIOTIMER lpfnAudioTimer)
|
||||
{
|
||||
Synth.lpfnAudioTimer = lpfnAudioTimer;
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
|
||||
static UINT AIAPI SetAudioTimerRate(UINT nBPM)
|
||||
{
|
||||
if (nBPM >= 0x20 && nBPM <= 0xFF) {
|
||||
Synth.dwTimerRate = Synth.nSampleRate;
|
||||
if (Synth.wFormat & AUDIO_FORMAT_STEREO)
|
||||
Synth.dwTimerRate <<= 1;
|
||||
Synth.dwTimerRate = (5 * Synth.dwTimerRate) / (2 * nBPM);
|
||||
return AUDIO_ERROR_NONE;
|
||||
}
|
||||
return AUDIO_ERROR_INVALPARAM;
|
||||
}
|
||||
|
||||
static VOID AIAPI UpdateVoices(LPBYTE lpData, UINT nCount)
|
||||
{
|
||||
static LONG aBuffer[BUFFERSIZE];
|
||||
UINT nSamples;
|
||||
|
||||
if (Synth.wFormat & AUDIO_FORMAT_16BITS)
|
||||
nCount >>= 1;
|
||||
while (nCount > 0) {
|
||||
if ((nSamples = nCount) > BUFFERSIZE)
|
||||
nSamples = BUFFERSIZE;
|
||||
memset(aBuffer, 0, nSamples << 2);
|
||||
MixAudioVoices(aBuffer, nSamples);
|
||||
QuantAudioData(lpData, aBuffer, nSamples);
|
||||
lpData += nSamples << ((Synth.wFormat & AUDIO_FORMAT_16BITS) != 0);
|
||||
nCount -= nSamples;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Waveform synthesizer public interface
|
||||
*/
|
||||
AUDIOSYNTHDRIVER EmuSynthDriver =
|
||||
{
|
||||
GetAudioCaps, PingAudio, OpenAudio, CloseAudio,
|
||||
UpdateAudio, OpenVoices, CloseVoices,
|
||||
SetAudioTimerProc, SetAudioTimerRate, SetAudioMixerValue,
|
||||
GetAudioDataAvail, CreateAudioData, DestroyAudioData,
|
||||
WriteAudioData, PrimeVoice, StartVoice, StopVoice,
|
||||
SetVoicePosition, SetVoiceFrequency, SetVoiceVolume,
|
||||
SetVoicePanning, GetVoicePosition, GetVoiceFrequency,
|
||||
GetVoiceVolume, GetVoicePanning, GetVoiceStatus
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user