android-16.0

This commit is contained in:
dvab-sarma 2025-06-26 23:13:24 -05:00
commit 72b7c25859
394 changed files with 155765 additions and 0 deletions

33
Android.bp Normal file
View file

@ -0,0 +1,33 @@
//
// Copyright (C) 2025 KonstaKANG
//
// SPDX-License-Identifier: LGPL-2.1
//
cc_library_shared {
name: "libasound",
vendor: true,
export_include_dirs: [
"include",
],
srcs: [
"src/**/*.c",
],
exclude_srcs: [
"src/control/ctl_symbols_list.c",
"src/pcm/scopes/*.c",
"src/pcm/pcm_dmix_generic.c",
"src/pcm/pcm_dmix_i386.c",
"src/pcm/pcm_dmix_x86_64.c",
"src/pcm/pcm_symbols_list.c",
],
cflags: [
"-O2",
"-DPIC",
"-fPIC",
"-Wno-pointer-arith",
"-Wno-pointer-bool-conversion",
"-Wno-single-bit-bitfield-constant-conversion",
],
required: ["libasound-config"],
}

504
COPYING Normal file
View file

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

69
ChangeLog Normal file
View file

@ -0,0 +1,69 @@
* update to libtool 1.3.3
0.1.3 -> 0.2.0
* added snd_pcm_loopback_block_mode to PCM loopback interface
* fixups in header files (according to documentation)
* version is now compatible with driver
0.1.2 -> 0.1.3
* added PCM loopback interface
0.1.1 -> 0.1.2
* bug fixes in open() functions
0.1.0 -> 0.1.1
* added more switch functions to control interface
0.0.9 -> 0.1.0
* renamed soundlib.h to asoundlib.h
* renamed libraries from libsound to libasound
* big API changes
- added switches interfaces
* added RawMIDI API
0.0.8 -> 0.0.9
* Makefile and configure.in changes
- added check for alsa driver package
- added spec file for RPM
0.0.7 -> 0.0.8
* added LGPL notice to all source and header files
0.0.6 -> 0.0.7
* added snd_cards_name function
0.0.5 -> 0.0.6
* fixed SND_PCM_OPEN constants
0.0.4 -> 0.0.5
* added snd_cards_mask function
* added info functions for pcm playback/record in control interface
* fixed Makefile bugs for shared library (added -fPIC)
0.0.3 -> 0.0.4
* changed COPYING policy from GPL to LGPL
* fixed bug in snd_mixer_channel_read & write
* added mixer exact support
* added pcm time mode support
* 'make install' is now possible
0.0.2 -> 0.0.3
* corrected documentation
0.0.1 -> 0.0.2
* added file COPYING
* added documentation in sgml + plan.txt
* minor changes in API for MIXER & PCM

133
INSTALL Normal file
View file

@ -0,0 +1,133 @@
ALSA library installation
=========================
Installation from tarball
-------------------------
For installation you can use these commands:
./configure
make install
Compilation from Git-sources
---------------------------
Requirements:
* automake
* libtool
To compile alsa-lib from source:
./gitcompile
If you do not want to use the supplied gitcompile-script, you can
compile alsa-lib manually by using these steps:
libtoolize --force --copy --automake
aclocal
autoheader
automake --foreign --copy --add-missing
autoconf
./configure
make
Note: Some automake packages have missing aclocal program. Use newer version
in the case.
Compilation of static library
-----------------------------
If you would like to use the static ALSA library, you need to use these
options for the configure script:
./configure --enable-shared=no --enable-static=yes
Unfortunately, due to bug in the libtool script, the shared and static
library cannot be built together.
Partial Builds
--------------
You can choose the core components to build via --enable-* or --disable-*
configure option for reducing the size of libasound. The selectable
components are: pcm, mixer, rawmidi, hwdep, seq and instr.
For example, --disable-rawmidi will prevent to build the stuff related
with raw MIDI. As default, all components are enabled.
The PCM plugins to build can be selected via --with-pcm-plugins
configure option. Multiple plugins can be passed by separation with
comma. For example, to select _only_ rate and linear plugins (and
disable other plugins), pass
--with-pcm-plugins=rate,linear
Note that "hw" plugin is always enabled.
Passing "all" will select all available plugins (which is the default
behavior).
When you select "plug" plugin, copy and linear plugins will be
automatically selected, too. That is, the linear-format and
access-type conversions are always available with plug layer.
The other conversions of plug (channel shrink/expansion, rate,
non-linear and float conversions) are enabled when the corresponding
plugin is selected, too.
Configuration for cross-compilation
-----------------------------------
When you would like to cross-compile ALSA library (e.g. compile on
i686 host but for arm architecture) you will need to call ./configure
script with additional parameters:
CC=arm-linux-gcc ./configure --host=arm-linux
You can omit setting 'CC' variable and cross-compiler will be guessed too.
So simplest version would be:
./configure --host=arm-linux
For platform names in the form cpu-vendor-os (or aliases for this)
you should look in 'config.guess' script. Target and all paths
used here are only examples and should not be directly applicable to
your system.
Configuration for machines without FPU
--------------------------------------
If your machine does not have FP unit, you should use '--with-softfloat'
option. This option disables usage of float numbers in PCM route plugin.
ALSA could then leave much more CPU cycles for your applications, but you
could still need some floating point emulator.
Thread-safety option
--------------------
As default, major PCM functions of alsa-lib are built to be
thread-safe with pthread mutex (while this wasn't present in the
versions earlier than 1.1.2). If you want to build without this
thread-safety support but reduce the overhead, pass
--disable-thread-safety configure option.
Jack plugin
-----------
JACK plugin is moved to alsa-plugins package.
Trouble Shooting
----------------
* Install path on Fedora Core 3
FC3 installs its system ALSA library to /lib instead of /usr/lib.
Specify --libdir=/lib to configure to overwrite it with the new library,
or run like
# ln -sf /usr/lib/libasound.so.2.0.0 /lib/libasound.so.2.0.0
to make symlink to the new path.
Note that /lib might be /lib64 on 64bit architecture.

13
MEMORY-LEAK Normal file
View file

@ -0,0 +1,13 @@
Memory leaks - really?
----------------------
Note that some developers are thinking that the ALSA library has some memory
leaks. Sure, it can be truth, but before contacting us, please, be sure that
these leaks are not forced.
The biggest reported leak is that the global configuration is cached for
next usage. If you do not want this feature, simply, call
snd_config_update_free_global() after all snd_*_open*() calls. This function
will free the cache.

35
Makefile.am Normal file
View file

@ -0,0 +1,35 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS=doc include src
if BUILD_TOPOLOGY
SUBDIRS += src/topology
endif
if BUILD_MODULES
SUBDIRS += modules
endif
if BUILD_PCM_PLUGIN_SHM
SUBDIRS += aserver
endif
SUBDIRS += test utils
EXTRA_DIST=README.md ChangeLog INSTALL TODO NOTES configure gitcompile libtool \
depcomp version MEMORY-LEAK m4/attributes.m4
AUTOMAKE_OPTIONS=foreign
AM_CPPFLAGS=-I$(top_srcdir)/include
rpm: dist
$(MAKE) -C utils rpm
dist-hook:
-chmod -R a+r $(distdir)
@if ! test -z "$(AMTAR)"; then \
$(AMTAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
else \
$(TAR) --create --verbose --file=- $(distdir) | bzip2 -c -9 > $(distdir).tar.bz2 ; \
fi
doc-dummy:
doc: doc-dummy
$(MAKE) -C include all
$(MAKE) -C doc doc

56
NOTES Normal file
View file

@ -0,0 +1,56 @@
Old versus new PCM API (values returned using indirect pointers)
================================================================
From the binary compatibility view, there is no change. For compilation,
1.0 ALSA applications do not need any change. The older applications must
use this include sequence:
#define ALSA_PCM_OLD_HW_PARAMS_API
#define ALSA_PCM_OLD_SW_PARAMS_API
#include <alsa/asoundlib.h>
If you use already the new API, you may remove old defines selecting
this API, because they are no longer used:
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
Verbose Error Messages
======================
Since version 1.0.8, assert() for some non-fatal errors are removed
and error messages are no longer shown to stderr as default. Instead,
the error messages appear only when the environment variable
LIBASOUND_DEBUG is set (to a non-empty value).
When LIBASOUND_DEBUG=1 is set, the errors in hw_params configuration
will be dumped to stderr. Note that this will show even the non-fatal
errors of plug layer (trial-and-error of parameters).
This feature is disabled when --with-debug=no is passed to configure,
i.e. no strict checking is done in alsa-lib.
In addition, when --enable-debug-assert configure option is given and
when LIBASOUND_DEBUG_ASSERT=1 is set, the default error message
handler can call assert() to catch with a debugger. This feature was
formerly activated via LIBASOUND_DEBUG=2.
Blocking Open Mode
==================
The default behavior of blocking at snd_pcm_open is changed to
non-blocking since version 1.0.11. That is, snd_pcm_open() returns
-EAGAIN immediately when the device is in use and cannot be opened,
while the function was blocked in the former version. This influences
only on the opening behavior. The behavior of the further access,
read/write, poll or commit, are not changed. They follow the extra
flag argument of snd_pcm_open() as well as the former version.
For taking back the compatible behavior of open blocking mode, set
defaults.pcm.nonblock 0
in /etc/asound.conf or ~/.asoundrc file.

25
README.md Normal file
View file

@ -0,0 +1,25 @@
# alsa-lib
## Advanced Linux Sound Architecture (ALSA) project
[![Build alsa-lib](https://github.com/alsa-project/alsa-lib/workflows/Build%20alsa-lib/badge.svg?branch=master)](https://github.com/alsa-project/alsa-lib/actions/workflows/build.yml)
The alsa-lib is a library to interface with ALSA in the Linux kernel and
virtual devices using a plugin system.
The up-to-date reference generated from sources can be accessed here:
http://www.alsa-project.org/alsa-doc/alsa-lib/
You may give a look for more information about the ALSA project to URL
http://www.alsa-project.org.
### Submitting patches
The preferred way to submit patches is by sending them by email to the
alsa-devel mailing list. Sending mail to the list requires subscription,
subscribe here: https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Add Takashi Iwai `<tiwai@suse.de>` and/or Jaroslav Kysela `<perex@perex.cz>` to
Cc so that your patch won't be missed.
Patches are also accepted as GitHub pull requests.

4
TODO Normal file
View file

@ -0,0 +1,4 @@
H add serious PCM test application to test various period/buffer size
combinations to determine possible problems in the lowlevel drivers
M think about xrun recovery helpers
L move OSS emulation to user space? (pseudo device driver and daemon)

24
acinclude.m4 Normal file
View file

@ -0,0 +1,24 @@
AC_DEFUN([SAVE_LIBRARY_VERSION], [
AC_MSG_CHECKING(for library version)
SND_LIB_VERSION=$VERSION
echo $VERSION > $srcdir/version
AC_DEFINE_UNQUOTED(VERSION, "$SND_LIB_VERSION", [sound library version string])
AC_SUBST(SND_LIB_VERSION)
SND_LIB_MAJOR=`echo $VERSION | cut -d . -f 1`
AC_SUBST(SND_LIB_MAJOR)
SND_LIB_MINOR=`echo $VERSION | cut -d . -f 2`
AC_SUBST(SND_LIB_MINOR)
SND_LIB_SUBMINOR=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([[^[:alpha:]]]*\)\(.*\)$/\1/g'`
AC_SUBST(SND_LIB_SUBMINOR)
SND_LIB_EXTRASTR=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([[^[:alpha:]]]*\)\([[[:alpha:]]]*\)\([[[:digit:]]]*\)\(.*\)$/\2/g'`
SND_LIB_EXTRAVER=`echo $VERSION | cut -d . -f 3 | sed -e 's/^\([[^[:alpha:]]]*\)\([[[:alpha:]]]*\)\([[[:digit:]]]*\)\(.*\)$/\3/g'`
case "$SND_LIB_EXTRASTR" in
pre) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 00000` ;;
alpha) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 10000` ;;
beta) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 20000` ;;
rc) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 100000` ;;
*) SND_LIB_EXTRAVER=1000000 ;;
esac
AC_MSG_RESULT(major $SND_LIB_MAJOR minor $SND_LIB_MINOR subminor $SND_LIB_SUBMINOR extrastr $SND_LIB_EXTRASTR extraver $SND_LIB_EXTRAVER)
AC_SUBST(SND_LIB_EXTRAVER)
])

340
aserver/COPYING Normal file
View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

12
aserver/Makefile.am Normal file
View file

@ -0,0 +1,12 @@
bin_PROGRAMS = aserver
aserver_SOURCES = aserver.c
# aserver_LDADD = -lasound
aserver_LDADD = ../src/libasound.la
all: aserver
AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/src/pcm
../src/libasound.la:
$(MAKE) -C ../src libasound.la

1096
aserver/aserver.c Normal file

File diff suppressed because it is too large Load diff

62
configure-android Executable file
View file

@ -0,0 +1,62 @@
#!/bin/bash
#
# Copyright (C) 2025 KonstaKANG
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
if [ ! -d "$ANDROID_NDK_HOME" ]; then
echo "ANDROID_NDK_HOME environment variable is not properly set!"
exit 1
fi
export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64
export TARGET=aarch64-linux-android
export API=35
export CC="$TOOLCHAIN/bin/clang --target=$TARGET$API"
export CXX="$TOOLCHAIN/bin/clang++ --target=$TARGET$API"
export AR=$TOOLCHAIN/bin/llvm-ar
export AS=$CC
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip
echo "Running autoconf..."
touch ltconfig
libtoolize --force --copy --automake
aclocal
autoheader
automake --foreign --copy --add-missing
touch depcomp
autoconf
ALSA_CONFIG=" \
--disable-aload \
--host=aarch64-linux \
--with-configdir=/vendor/etc/alsa \
--with-plugindir=/vendor/etc/alsa/lib/alsa-lib \
--with-versioned=false"
echo "Generating configuration..."
echo "./configure $ALSA_CONFIG $TARGET"
./configure $ALSA_CONFIG $TARGET
cat > include/version.h <<EOF
/*
* version.h
*/
#define SND_LIB_MAJOR $(cat version | cut -d . -f 1) /**< major number of library version */
#define SND_LIB_MINOR $(cat version | cut -d . -f 2) /**< minor number of library version */
#define SND_LIB_SUBMINOR $(cat version | cut -d . -f 3) /**< subminor number of library version */
#define SND_LIB_EXTRAVER 1000000 /**< extra version number, used mainly for betas */
/** library version */
#define SND_LIB_VER(maj, min, sub) (((maj)<<16)|((min)<<8)|(sub))
#define SND_LIB_VERSION SND_LIB_VER(SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR)
/** library version (string) */
#define SND_LIB_VERSION_STR "$(cat version)"
EOF
exit 0

830
configure.ac Normal file
View file

@ -0,0 +1,830 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(alsa-lib, 1.2.14)
AC_CONFIG_SRCDIR([src/control/control.c])
AC_CONFIG_MACRO_DIR([m4])
dnl *************************************************
dnl current:revision:age
dnl change (without API) = c:r+1:a
dnl change API = c+1:0:a
dnl add API = c+1:0:a+1
dnl remove API = c+1:0:0
dnl *************************************************
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
eval LIBTOOL_VERSION_INFO="2:0:0"
dnl *************************************************
AM_CONDITIONAL([INSTALL_M4], [test -n "${ACLOCAL}"])
AM_MAINTAINER_MODE([enable])
# Test for new silent rules and enable only if they are available
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PREFIX_DEFAULT(/usr)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_INSTALL
AC_PROG_LN_S
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
CC_NOUNDEFINED
dnl Checks for header files.
AC_HEADER_STDC
AC_CONFIG_HEADERS(include/config.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_CHECK_ATTRIBUTE_SYMVER
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_CHECK_FUNCS([uselocale])
AC_CHECK_FUNCS([eaccess])
dnl Enable largefile support
AC_SYS_LARGEFILE
SAVE_LIBRARY_VERSION
AC_SUBST(LIBTOOL_VERSION_INFO)
test "x$prefix" = xNONE && prefix=$ac_default_prefix
dnl Do not build static and shared libraries together
if test "$enable_static" = "$enable_shared" -a "$enable_static" = "yes"; then
cat <<EOF
Please, do not try to compile static and shared libraries together.
See INSTALL file for more details (do not use --enable-shared=yes with
--enable-static=yes).
EOF
exit 1
fi
dnl Do not use --with-pic for shared libraries (consider to use PIE)
if test "$enable_static" = "yes" -a "$pic_mode" = "yes"; then
cat <<EOF
Please, do not enable PIC (--with-pic) for static library. Consider
to remove this option or use PIE flags.
EOF
exit 1
fi
dnl ALSA configuration directory
AC_ARG_WITH(configdir,
AS_HELP_STRING([--with-configdir=dir],
[path where ALSA config files are stored]),
confdir="$withval", confdir="")
if test -z "$confdir"; then
eval dir="$datadir"
case "$dir" in
/*) ;;
*) dir="$prefix/share"
esac
confdir="$dir/alsa"
fi
ALSA_CONFIG_DIR="$confdir"
AC_DEFINE_UNQUOTED(ALSA_CONFIG_DIR, "$confdir", [directory containing ALSA configuration database])
AC_SUBST(ALSA_CONFIG_DIR)
dnl ALSA plugin directory
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
AC_ARG_WITH(plugindir,
AS_HELP_STRING([--with-plugindir=dir],
[path where ALSA plugin files are stored]),
plugindir="$withval", plugindir="")
if test -z "$plugindir"; then
eval dir="$libdir"
case "$dir" in
/*) ;;
*) dir="$dir"
esac
plugindir="$dir/$PACKAGE"
fi
AC_DEFINE_UNQUOTED(ALSA_PLUGIN_DIR, "$plugindir", [directory containing ALSA add-on modules])
ALSA_PLUGIN_DIR="$plugindir"
AC_SUBST(ALSA_PLUGIN_DIR)
AC_ARG_WITH(pkgconfdir,
AS_HELP_STRING([--with-pkgconfdir=dir],
[path where pkgconfig files are stored]),
pkgconfdir="$withval", pkgconfdir="")
if test -z "$pkgconfdir"; then
eval dir="$libdir"
case "$dir" in
/*) ;;
*) dir="$dir"
esac
pkgconfdir="$dir/pkgconfig"
fi
AC_DEFINE_UNQUOTED(ALSA_PKGCONF_DIR, "$pkgconfdir", [directory containing pkgconfig files])
ALSA_PKGCONF_DIR="$pkgconfdir"
AC_SUBST(ALSA_PKGCONF_DIR)
dnl Check for versioned symbols
AC_MSG_CHECKING(for versioned symbols)
AC_ARG_WITH(versioned,
AS_HELP_STRING([--with-versioned],
[shared library will be compiled with versioned symbols (default = yes)]),
versioned="$withval", versioned="yes")
if test "$versioned" = "yes"; then
# it seems that GNU ld versions since 2.10 are not broken
xres=`grep '^VERSION=' ${srcdir}/ltmain.sh | cut -d = -f 2 | cut -d \" -f 2`
major=`echo $xres | cut -d . -f 1`
minor=`echo $xres | cut -d . -f 2`
pass=0
if test $major -eq 1 && test $minor -gt 3; then
pass=1
else
if test $major -gt 1; then
pass=1
fi
fi
if test $pass -eq 1; then
AC_DEFINE(VERSIONED_SYMBOLS,,[compiled with versioned symbols])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(broken libtool - use libtool v1.4+; no versions)
fi
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL([VERSIONED_SYMBOLS], [test x$versioned = xyes])
dnl Check for symbolic-functions
AC_MSG_CHECKING(for symbolic-functions)
AC_ARG_ENABLE(symbolic-functions,
AS_HELP_STRING([--enable-symbolic-functions],
[use -Bsymbolic-functions option if available (optmization for size and speed)]),
symfuncs="$enableval", symfuncs="no")
if test "$symfuncs" = "yes"; then
if ld --help | grep -q -- '-Bsymbolic-functions'; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(not supported by ld)
symfuncs="no"
fi
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL([SYMBOLIC_FUNCTIONS], [test x"$symfuncs" = xyes])
dnl See if toolchain has a custom prefix for symbols ...
AC_MSG_CHECKING(for custom symbol prefixes)
SYMBOL_PREFIX=` \
echo "PREFIX=__USER_LABEL_PREFIX__" \
| ${CPP-${CC-gcc} -E} - 2>&1 \
| ${EGREP-grep} "^PREFIX=" \
| ${SED-sed} "s:^PREFIX=::"`
AC_DEFINE_UNQUOTED([__SYMBOL_PREFIX], "$SYMBOL_PREFIX", [Toolchain Symbol Prefix])
AC_SUBST(SYMBOL_PREFIX)
AC_MSG_RESULT($SYMBOL_PREFIX)
dnl Check for debug...
AC_MSG_CHECKING(for debug)
AC_ARG_WITH(debug,
AS_HELP_STRING([--with-debug],
[library will be compiled with asserts (default = yes)]),
debug="$withval", debug="yes")
if test "$debug" = "yes"; then
AC_MSG_RESULT(yes)
else
AC_DEFINE(NDEBUG,,[No assert debug])
AC_MSG_RESULT(no)
fi
if test "$debug" = "yes"; then
AC_MSG_CHECKING(for debug assert)
AC_ARG_ENABLE(debug-assert,
AS_HELP_STRING([--enable-debug],
[enable assert call at the default error message handler]),
debug_assert="$enableval", debug_assert="no")
if test "$debug_assert" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(ALSA_DEBUG_ASSERT,,[Enable assert at error message handler])
else
AC_MSG_RESULT(no)
fi
fi
dnl Temporary directory
AC_MSG_CHECKING(for tmpdir)
AC_ARG_WITH(tmpdir,
AS_HELP_STRING([--with-tmpdir=directory],
[directory to put tmp socket files (/tmp)]),
tmpdir="$withval", tmpdir="/tmp")
AC_MSG_RESULT($tmpdir)
AC_DEFINE_UNQUOTED(TMPDIR, "$tmpdir", [directory to put tmp socket files])
dnl Check for softfloat...
AC_MSG_CHECKING(for softfloat)
AC_ARG_WITH(softfloat,
AS_HELP_STRING([--with-softfloat],
[do you have floating point unit on this machine? (optional)]),
[case "$withval" in
y|yes) softfloat=yes ;;
*) softfloat=no ;;
esac],)
if test "$softfloat" = "yes" ; then
AC_DEFINE(HAVE_SOFT_FLOAT, "1", [Avoid calculation in float])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
ALSA_DEPLIBS=""
if test "$softfloat" != "yes"; then
ALSA_DEPLIBS="-lm"
fi
dnl Check for scandir64
AC_MSG_CHECKING(for LFS calls)
AC_TRY_LINK([#include <dirent.h>],
[struct dirent64 a; ],
[have_lfs=yes],
[have_lfs=no])
if test "$have_lfs" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_LFS], 1, [Have LFS])
else
AC_MSG_RESULT(no)
fi
dnl Check for libdl
AC_MSG_CHECKING(for libdl)
AC_ARG_WITH(libdl,
AS_HELP_STRING([--with-libdl], [Use libdl for plugins (default = yes)]),
[ have_libdl="$withval" ], [ have_libdl="yes" ])
HAVE_LIBDL=
if test "$have_libdl" = "yes"; then
AC_SEARCH_LIBS([dlsym], [dl], [HAVE_LIBDL="yes"])
if test "$HAVE_LIBDL" = "yes" ; then
AC_DEFINE([HAVE_LIBDL], 1, [Have libdl])
fi
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL([BUILD_MODULES], [test "$HAVE_LIBDL" = "yes"])
dnl Check for pthread
AC_MSG_CHECKING(for pthread)
AC_ARG_WITH(pthread,
AS_HELP_STRING([--with-pthread], [Use pthread (default = yes)]),
[ have_pthread="$withval" ], [ have_pthread="yes" ])
if test "$have_pthread" = "yes"; then
AC_CHECK_LIB([pthread], [pthread_join], [HAVE_LIBPTHREAD="yes"])
if test "$HAVE_LIBPTHREAD" = "yes"; then
ALSA_DEPLIBS="$ALSA_DEPLIBS -lpthread"
AC_DEFINE([HAVE_LIBPTHREAD], 1, [Have libpthread])
fi
else
AC_MSG_RESULT(no)
fi
dnl Check for pthread
if test "$HAVE_LIBPTHREAD" = "yes"; then
AC_CHECK_DECL(PTHREAD_MUTEX_RECURSIVE,
AC_DEFINE(HAVE_PTHREAD_MUTEX_RECURSIVE, [],
[Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE]),
,
[#include <pthread.h>])
fi
dnl Check for __thread
AC_MSG_CHECKING([for __thread])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) || (__GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ < 2))
#error gcc has this bug: http://gcc.gnu.org/ml/gcc-bugs/2006-09/msg02275.html
#endif], [static __thread int p = 0])],
[AC_DEFINE(HAVE___THREAD, 1,
Define to 1 if compiler supports __thread)
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
dnl Check for librt
AC_MSG_CHECKING(for librt)
AC_ARG_WITH(librt,
AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]),
[ have_librt="$withval" ], [ have_librt="yes" ])
if test "$have_librt" = "yes"; then
AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"])
if test "$HAVE_LIBRT" = "yes" ; then
ALSA_DEPLIBS="$ALSA_DEPLIBS -lrt"
AC_DEFINE([HAVE_LIBRT], 1, [Have librt])
AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime])
fi
else
AC_MSG_RESULT(no)
fi
AC_SUBST(ALSA_DEPLIBS)
dnl Check for use of wordexp...
AC_MSG_CHECKING(for use of wordexp)
AC_ARG_WITH(wordexp,
AS_HELP_STRING([--with-wordexp],
[Use wordexp when expanding configs (default = no)]),
[case "$withval" in
y|yes) wordexp=yes ;;
*) wordexp=no ;;
esac],)
if test "$wordexp" = "yes" ; then
AC_DEFINE(HAVE_WORDEXP, "1", [Enable use of wordexp])
AC_MSG_RESULT(yes)
AC_CHECK_HEADER([wordexp.h],[], [AC_MSG_ERROR([Couldn't find wordexp.h])])
else
AC_MSG_RESULT(no)
fi
dnl Check for headers
AC_CHECK_HEADERS([endian.h sys/endian.h sys/shm.h malloc.h])
dnl Check for resmgr support...
AC_MSG_CHECKING(for resmgr support)
AC_ARG_ENABLE(resmgr,
AS_HELP_STRING([--enable-resmgr], [support resmgr (optional)]),
resmgr="$enableval", resmgr="no")
AC_MSG_RESULT($resmgr)
if test "$resmgr" = "yes"; then
AC_CHECK_LIB(resmgr, rsm_open_device,,
AC_ERROR([Cannot find libresmgr]))
AC_DEFINE(SUPPORT_RESMGR, "1", [Support resmgr with alsa-lib])
fi
dnl Check for aload* support...
AC_MSG_CHECKING(for aload* support)
AC_ARG_ENABLE(aload,
AS_HELP_STRING([--disable-aload], [disable reading /dev/aload*]),
aload="$enableval", aload="yes")
AC_MSG_RESULT($aload)
if test "$aload" = "yes"; then
AC_DEFINE(SUPPORT_ALOAD, "1", [Support /dev/aload* access for auto-loading])
fi
dnl Check for non-standard /dev directory
AC_MSG_CHECKING([for ALSA device file directory])
AC_ARG_WITH(alsa-devdir,
AS_HELP_STRING([--with-alsa-devdir=dir],
[directory with ALSA device files (default /dev/snd)]),
[alsa_dev_dir="$withval"],
[alsa_dev_dir="/dev/snd"])
dnl make sure it has a trailing slash
if echo "$alsa_dev_dir" | grep -v '/$' > /dev/null; then
alsa_dev_dir="$alsa_dev_dir/"
fi
AC_DEFINE_UNQUOTED(ALSA_DEVICE_DIRECTORY, "$alsa_dev_dir", [Directory with ALSA device files])
AC_MSG_RESULT([$alsa_dev_dir])
AC_MSG_CHECKING([for aload* device file directory])
AC_ARG_WITH(aload-devdir,
AS_HELP_STRING([--with-aload-devdir=dir],
[directory with aload* device files (default /dev)]),
[aload_dev_dir="$withval"],
[aload_dev_dir="/dev"])
if echo "$aload_dev_dir" | grep -v '/$' > /dev/null; then
aload_dev_dir="$aload_dev_dir/"
fi
AC_DEFINE_UNQUOTED(ALOAD_DEVICE_DIRECTORY, "$aload_dev_dir", [Directory with aload* device files])
AC_MSG_RESULT([$aload_dev_dir])
dnl Build conditions
AC_ARG_ENABLE(mixer,
AS_HELP_STRING([--disable-mixer], [disable the mixer component]),
[build_mixer="$enableval"], [build_mixer="yes"])
AC_ARG_ENABLE(pcm,
AS_HELP_STRING([--disable-pcm], [disable the PCM component]),
[build_pcm="$enableval"], [build_pcm="yes"])
AC_ARG_ENABLE(rawmidi,
AS_HELP_STRING([--disable-rawmidi], [disable the raw MIDI component]),
[build_rawmidi="$enableval"], [build_rawmidi="yes"])
AC_ARG_ENABLE(hwdep,
AS_HELP_STRING([--disable-hwdep], [disable the hwdep component]),
[build_hwdep="$enableval"], [build_hwdep="yes"])
AC_ARG_ENABLE(seq,
AS_HELP_STRING([--disable-seq], [disable the sequencer component]),
[build_seq="$enableval"], [build_seq="yes"])
AC_ARG_ENABLE(ucm,
AS_HELP_STRING([--disable-ucm], [disable the use-case-manager component]),
[build_ucm="$enableval"], [build_ucm="yes"])
AC_ARG_ENABLE(topology,
AS_HELP_STRING([--disable-topology], [disable the DSP topology component]),
[build_topology="$enableval"], [build_topology="yes"])
AC_ARG_ENABLE(old-symbols,
AS_HELP_STRING([--disable-old-symbols], [disable old obsoleted symbols]),
[keep_old_symbols="$enableval"], [keep_old_symbols="yes"])
AM_CONDITIONAL([KEEP_OLD_SYMBOLS], [test x$keep_old_symbols = xyes])
AC_ARG_ENABLE(mixer-modules,
AS_HELP_STRING([--enable-mixer-modules], [enable the additional mixer modules (experimental)]),
[build_mixer_modules="$enableval"], [build_mixer_modules="no"])
AC_ARG_ENABLE(mixer-pymods,
AS_HELP_STRING([--enable-mixer-pymods], [enable the mixer python modules (experimental)]),
[build_mixer_pymodules="$enableval"], [build_mixer_pymodules="no"])
AC_ARG_ENABLE(python,
AS_HELP_STRING([--disable-python], [disable the python components]),
[build_python="$enableval"], [build_python="yes"])
AC_ARG_ENABLE(python2,
AS_HELP_STRING([--enable-python2], [prefer python2]),
[build_python2="$enableval"], [build_python2="no"])
PYTHON_LIBS=""
PYTHON_INCLUDES=""
if test "$build_python" = "yes" -a "$build_mixer_pymodules" = "yes"; then
pythonlibs0=
pythoninc0=
if test "$build_python2" != "yes"; then
pythonlibs0=$(python3-config --libs --embed 2> /dev/null)
if test -z "$pythonlibs0"; then
pythonlibs0=$(python3-config --libs)
fi
pythoninc0=$(python3-config --includes)
fi
if test -z "$pythonlibs0"; then
pythonlibs0=$(python-config --libs)
pythoninc0=$(python-config --includes)
fi
AC_ARG_WITH(pythonlibs,
AS_HELP_STRING([--with-pythonlibs=ldflags],
[specify python libraries (-lpthread -lm -ldl -lpython2.4)]),
pythonlibs="$withval", pythonlibs=$pythonlibs0)
AC_ARG_WITH(pythonincludes,
AS_HELP_STRING([--with-pythonincludes=Cflags],
[specify python C header files (-I/usr/include/python)]),
pythonincludes="$withval", pythonincludes=$pythoninc0)
if test -z "$pythonlibs"; then
echo "Unable to determine python libraries! Probably python-config is not"
echo "available on this system. Please, use --with-pythonlibs and"
echo "--with-pythonincludes options. Python components are disabled in this build."
build_python="no"
else
PYTHON_LIBS="$pythonlibs"
PYTHON_INCLUDES="$pythonincludes"
fi
fi
if test "$build_python" != "yes"; then
build_mixer_pymodules=
fi
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_INCLUDES)
if test "$build_rawmidi" != "yes"; then
if test "$build_seq" = "yes"; then
AC_ERROR([Cannot enable sequencer without rawmidi])
fi
fi
AM_CONDITIONAL([BUILD_MIXER], [test x$build_mixer = xyes])
AM_CONDITIONAL([BUILD_PCM], [test x$build_pcm = xyes])
AM_CONDITIONAL([BUILD_RAWMIDI], [test x$build_rawmidi = xyes])
AM_CONDITIONAL([BUILD_HWDEP], [test x$build_hwdep = xyes])
AM_CONDITIONAL([BUILD_SEQ], [test x$build_seq = xyes])
AM_CONDITIONAL([BUILD_UCM], [test x$build_ucm = xyes])
AM_CONDITIONAL([BUILD_TOPOLOGY], [test x$build_topology = xyes])
AM_CONDITIONAL([BUILD_MIXER_MODULES], [test x$build_mixer_modules = xyes])
AM_CONDITIONAL([BUILD_MIXER_PYMODULES], [test x$build_mixer_pymodules = xyes])
if test "$build_mixer" = "yes"; then
AC_DEFINE([BUILD_MIXER], "1", [Build mixer component])
fi
if test "$build_pcm" = "yes"; then
AC_DEFINE([BUILD_PCM], "1", [Build PCM component])
fi
if test "$build_rawmidi" = "yes"; then
AC_DEFINE([BUILD_RAWMIDI], "1", [Build raw MIDI component])
fi
if test "$build_hwdep" = "yes"; then
AC_DEFINE([BUILD_HWDEP], "1", [Build hwdep component])
fi
if test "$build_seq" = "yes"; then
AC_DEFINE([BUILD_SEQ], "1", [Build sequencer component])
fi
if test "$build_ucm" = "yes"; then
AC_DEFINE([BUILD_UCM], "1", [Build UCM component])
fi
if test "$build_topology" = "yes"; then
AC_DEFINE([BUILD_TOPOLOGY], "1", [Build DSP Topology component])
fi
dnl PCM Plugins
if test "$build_pcm" = "yes"; then
AC_ARG_WITH(pcm-plugins,
AS_HELP_STRING([--with-pcm-plugins=<list>],
[build PCM plugins (default = all)]),
[pcm_plugins="$withval"], [pcm_plugins="all"])
else
pcm_plugins=""
fi
dnl check atomics for pcm_meter
AC_MSG_CHECKING([whether GCC supports builtin atomic intrinsics])
if test -z "$gcc_have_atomics"; then
gcc_have_atomics=no
AC_TRY_LINK([],
[int i;
__atomic_load_n(&i, __ATOMIC_SEQ_CST);
__atomic_add_fetch(&i, 0, __ATOMIC_SEQ_CST);
],
[gcc_have_atomics=yes],
[gcc_have_atomics=no])
fi
AC_MSG_RESULT($gcc_have_atomics)
dnl check mmx register for pcm_dmix_i386
AC_TRY_LINK([],
[__asm__ volatile ("" : : : "mm0");],
[AC_DEFINE([HAVE_MMX], "1", [MMX technology is enabled])],
[])
PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug mmap_emul"
build_pcm_plugin="no"
for t in $PCM_PLUGIN_LIST; do
eval build_pcm_$t="no"
done
pcm_plugins=`echo $pcm_plugins | sed 's/,/ /g'`
for p in $pcm_plugins; do
for t in $PCM_PLUGIN_LIST; do
if test "$p" = "$t" -o "$p" = "all"; then
eval build_pcm_$t="yes"
build_pcm_plugin="yes"
fi
done
done
dnl special dependencies
if test "$build_pcm_plug" = "yes"; then
build_pcm_linear="yes"
build_pcm_copy="yes"
fi
if test "$build_pcm_ioplug" = "yes"; then
build_pcm_extplug="yes"
fi
if test "$HAVE_LIBDL" != "yes"; then
build_pcm_meter="no"
build_pcm_ladspa="no"
build_pcm_pcm_ioplug="no"
build_pcm_pcm_extplug="no"
fi
if test "$HAVE_LIBPTHREAD" != "yes"; then
build_pcm_share="no"
fi
if test "$softfloat" = "yes"; then
build_pcm_lfloat="no"
build_pcm_ladspa="no"
fi
if test "$gcc_have_atomics" != "yes"; then
build_pcm_meter="no"
fi
if test "$ac_cv_header_sys_shm_h" != "yes"; then
build_pcm_dmix="no"
build_pcm_dshare="no"
build_pcm_dsnoop="no"
build_pcm_shm="no"
fi
AM_CONDITIONAL([BUILD_PCM_PLUGIN], [test x$build_pcm_plugin = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_COPY], [test x$build_pcm_copy = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_LINEAR], [test x$build_pcm_linear = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_ROUTE], [test x$build_pcm_route = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_MULAW], [test x$build_pcm_mulaw = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_ALAW], [test x$build_pcm_alaw = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_ADPCM], [test x$build_pcm_adpcm = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_RATE], [test x$build_pcm_rate = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_PLUG], [test x$build_pcm_plug = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_MULTI], [test x$build_pcm_multi = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_SHM], [test x$build_pcm_shm = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_FILE], [test x$build_pcm_file = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_NULL], [test x$build_pcm_null = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_EMPTY], [test x$build_pcm_empty = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_SHARE], [test x$build_pcm_share = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_METER], [test x$build_pcm_meter = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_HOOKS], [test x$build_pcm_hooks = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_LFLOAT], [test x$build_pcm_lfloat = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_LADSPA], [test x$build_pcm_ladspa = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_DMIX], [test x$build_pcm_dmix = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSHARE], [test x$build_pcm_dshare = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_DSNOOP], [test x$build_pcm_dsnoop = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_ASYM], [test x$build_pcm_asym = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_IEC958], [test x$build_pcm_iec958 = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_SOFTVOL], [test x$build_pcm_softvol = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_EXTERNAL], [test x$build_pcm_extplug = xyes -o x$build_pcm_ioplug = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_EXTPLUG], [test x$build_pcm_extplug = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_IOPLUG], [test x$build_pcm_ioplug = xyes])
AM_CONDITIONAL([BUILD_PCM_PLUGIN_MMAP_EMUL], [test x$build_pcm_mmap_emul = xyes])
dnl Defines for plug plugin
if test "$build_pcm_rate" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_RATE], "1", [Build PCM rate plugin])
fi
if test "$build_pcm_route" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_ROUTE], "1", [Build PCM route plugin])
fi
if test "$build_pcm_lfloat" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_LFLOAT], "1", [Build PCM lfloat plugin])
fi
if test "$build_pcm_adpcm" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_ADPCM], "1", [Build PCM adpcm plugin])
fi
if test "$build_pcm_mulaw" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_MULAW], "1", [Build PCM mulaw plugin])
fi
if test "$build_pcm_alaw" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_ALAW], "1", [Build PCM alaw plugin])
fi
if test "$build_pcm_iec958" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_IEC958], "1", [Build PCM iec958 plugin])
fi
if test "$build_pcm_mmap_emul" = "yes"; then
AC_DEFINE([BUILD_PCM_PLUGIN_MMAP_EMUL], "1", [Build PCM mmap-emul plugin])
fi
if test "$build_pcm_dmix" = "yes"; then
AC_MSG_CHECKING(for default lockless dmix)
AC_ARG_ENABLE(lockless-dmix,
AS_HELP_STRING([--enable-lockless-dmix],
[use lockless dmix as default on x86]),
lockless_dmix="$enableval", lockless_dmix="no")
if test "$lockless_dmix" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE([LOCKLESS_DMIX_DEFAULT], "1", [Lockless dmix as default])
else
AC_MSG_RESULT(no)
fi
fi
dnl Create PCM plugin symbol list for static library
rm -f "$srcdir"/src/pcm/pcm_symbols_list.c
touch "$srcdir"/src/pcm/pcm_symbols_list.c
for t in $PCM_PLUGIN_LIST; do
if eval test \$build_pcm_$t = yes; then
echo \&_snd_module_pcm_$t, >> "$srcdir"/src/pcm/pcm_symbols_list.c
fi
done
dnl Control Plugins
AC_ARG_WITH(ctl-plugins,
AS_HELP_STRING([--with-ctl-plugins=<list>],
[build control plugins (default = all)]),
[ctl_plugins="$withval"], [ctl_plugins="all"])
CTL_PLUGIN_LIST="remap shm ext"
build_ctl_plugin="no"
for t in $CTL_PLUGIN_LIST; do
eval build_ctl_$t="no"
done
ctl_plugins=`echo $ctl_plugins | sed 's/,/ /g'`
for p in $ctl_plugins; do
for t in $CTL_PLUGIN_LIST; do
if test "$p" = "$t" -o "$p" = "all"; then
eval build_ctl_$t="yes"
build_ctl_plugin="yes"
fi
done
done
if test "$ac_cv_header_sys_shm_h" != "yes"; then
build_ctl_shm="no"
fi
AM_CONDITIONAL([BUILD_CTL_PLUGIN], [test x$build_ctl_plugin = xyes])
AM_CONDITIONAL([BUILD_CTL_PLUGIN_REMAP], [test x$build_ctl_remap = xyes])
AM_CONDITIONAL([BUILD_CTL_PLUGIN_SHM], [test x$build_ctl_shm = xyes])
AM_CONDITIONAL([BUILD_CTL_PLUGIN_EXT], [test x$build_ctl_ext = xyes])
dnl Create ctl plugin symbol list for static library
rm -f "$srcdir"/src/control/ctl_symbols_list.c
touch "$srcdir"/src/control/ctl_symbols_list.c
for t in $CTL_PLUGIN_LIST; do
if eval test \$build_ctl_$t = yes; then
echo \&_snd_module_control_$t, >> "$srcdir"/src/control/ctl_symbols_list.c
fi
done
dnl Max number of cards
AC_MSG_CHECKING(for max number of cards)
AC_ARG_WITH(max-cards,
AS_HELP_STRING([--with-max-cards], [Specify the max number of cards (default = 32)]),
[ max_cards="$withval" ], [ max_cards="32" ])
AC_MSG_RESULT([$max_cards])
if test "$max_cards" -lt 1; then
AC_ERROR([Invalid max cards $max_cards])
elif test "$max_cards" -gt 256; then
AC_ERROR([Invalid max cards $max_cards])
fi
AC_DEFINE_UNQUOTED(SND_MAX_CARDS, $max_cards, [Max number of cards])
dnl Check for thread-safe API functions
if test "$HAVE_LIBPTHREAD" = "yes"; then
AC_MSG_CHECKING(for thread-safe API functions)
AC_ARG_ENABLE(thread-safety,
AS_HELP_STRING([--disable-thread-safety],
[disable thread-safe API functions]),
threadsafe="$enableval", threadsafe="yes")
if test "$threadsafe" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE([THREAD_SAFE_API], "1", [Disable thread-safe API functions])
else
AC_MSG_RESULT(no)
fi
fi
dnl Make a symlink for inclusion of alsa/xxx.h
if test ! -L "$srcdir"/include/alsa ; then
echo "Making a symlink include/alsa"
rm -f "$srcdir"/include/alsa
ln -sf . "$srcdir"/include/alsa
fi
AC_CONFIG_FILES(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
src/Versions.in src/Makefile \
src/control/Makefile src/mixer/Makefile \
src/pcm/Makefile src/pcm/scopes/Makefile \
src/rawmidi/Makefile src/timer/Makefile \
src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
src/topology/Makefile \
src/conf/Makefile \
src/conf/cards/Makefile \
src/conf/ctl/Makefile \
src/conf/pcm/Makefile \
modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \
aserver/Makefile \
test/Makefile test/lsb/Makefile \
utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)
AC_OUTPUT()
dnl Create asoundlib.h dynamically according to configure options
echo "Creating asoundlib.h..."
cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h
if test "$ac_cv_header_sys_endian_h" != "yes"; then
test "$ac_cv_header_endian_h" = "yes" && echo "#include <endian.h>" >> include/asoundlib.h
else
cat >> include/asoundlib.h <<EOF
#include <sys/endian.h>
#ifndef __BYTE_ORDER
#define __BYTE_ORDER BYTE_ORDER
#endif
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#endif
EOF
fi
cat >> include/asoundlib.h <<EOF
#ifndef DOC_HIDDEN
#ifndef __GNUC__
#define __inline__ inline
#endif
#endif /* DOC_HIDDEN */
#include <alsa/asoundef.h>
#include <alsa/version.h>
#include <alsa/global.h>
#include <alsa/input.h>
#include <alsa/output.h>
#include <alsa/error.h>
#include <alsa/conf.h>
EOF
test "$build_pcm" = "yes" && echo "#include <alsa/pcm.h>" >> include/asoundlib.h
test "$build_rawmidi" = "yes" && echo "#include <alsa/rawmidi.h>" >> include/asoundlib.h
test "$build_rawmidi" = "yes" && echo "#include <alsa/ump.h>" >> include/asoundlib.h
test "$build_pcm" = "yes" && echo "#include <alsa/timer.h>" >> include/asoundlib.h
test "$build_hwdep" = "yes" && echo "#include <alsa/hwdep.h>" >> include/asoundlib.h
echo "#include <alsa/control.h>" >> include/asoundlib.h
test "$build_mixer" = "yes" && echo "#include <alsa/mixer.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/ump_msg.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/seq_event.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/seq.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/seqmid.h>" >> include/asoundlib.h
test "$build_seq" = "yes" && echo "#include <alsa/seq_midi_event.h>" >> include/asoundlib.h
cat "$srcdir"/include/asoundlib-tail.h >> include/asoundlib.h

24
doc/Makefile.am Normal file
View file

@ -0,0 +1,24 @@
SUBDIRS=pictures
EXTRA_DIST=README.1st asoundrc.txt doxygen.cfg index.doxygen
AM_CPPFLAGS=-I$(top_srcdir)/include
doc:
test -e doxygen.cfg || sed s:[@]top_srcdir[@]:..:g doxygen.cfg.in > doxygen.cfg
doxygen doxygen.cfg
doc-pack: doc
-chmod -R a+r $(top_srcdir)/doc/doxygen/html/*
-chmod -R a-w $(top_srcdir)/doc/doxygen/html/*
if ! test -z "$(AMTAR)"; then \
$(AMTAR) --create --directory=$(top_srcdir)/doc/doxygen/html --verbose --file=- . | bzip2 -c -9 > $(top_srcdir)/../alsa-lib-doc.tar.bz2 ; \
else \
$(TAR) --create --directory=$(top_srcdir)/doc/doxygen/html --verbose --file=- . | bzip2 -c -9 > $(top_srcdir)/../alsa-lib-doc.tar.bz2 ; \
fi
-chmod -R u+w $(top_srcdir)/doc/doxygen/html/*
rm -rf $(top_srcdir)/doc/doxygen/html/*
doc-clean:
-chmod -R u+w $(top_srcdir)/doc/doxygen/html/*
rm -rf $(top_srcdir)/doc/doxygen/html/*

2
doc/README.1st Normal file
View file

@ -0,0 +1,2 @@
The doxygen documentation is created with command 'make doc' in toplevel
directory.

480
doc/asoundrc.txt Normal file
View file

@ -0,0 +1,480 @@
# Configuration file syntax
# Include a new configuration file
<filename>
# Simple assign
name [=] value [,|;]
# Compound assign (first style)
name [=] {
name1 [=] value [,|;]
...
}
# Compound assign (second style)
name.name1 [=] value [,|;]
# Array assign (first style)
name [
value0 [,|;]
value1 [,|;]
...
]
# Array assign (second style)
name.0 [=] value0 [,|;]
name.1 [=] value1 [,|;]
# ******************************************************************************
# Server definition
server.NAME {
host STR # host where the server is located (if map to local address
# server is local, and then it may be started automatically)
[socket STR] # PF_LOCAL socket name to listen/connect
[port INT] # PF_INET port number to listen/connect
}
# PCM type definition
pcm_type.NAME {
[lib STR] # Library file (default libasound.so)
[open STR] # Open function (default _snd_pcm_NAME_open)
[redirect { # Redirect this PCM to an another
[filename STR] # Configuration file specification
name STR # PCM name specification
}]
}
# PCM scope type definition
pcm_scope_type.NAME {
[lib STR] # Library file (default libasound.so)
[open STR] # Open function (default _snd_pcm_scope_NAME_open)
}
# PCM scope definition
pcm_scope.NAME {
type STR # Scope type
...
}
# Slave PCM definition
pcm_slave.NAME {
pcm STR # PCM name
# or
pcm { } # PCM definition
format STR # Format
channels INT # Channels
rate INT # Rate
period_time INT # Period time
buffer_time INT # Buffer time
etc.
}
# Hook arguments definition
hook_args.NAME {
... # Arbitrary arguments
}
# PCM hook type
pcm_hook_type.NAME {
[lib STR] # Library file (default libasound.so)
[install STR] # Install function (default _snd_pcm_hook_NAME_install)
}
# PCM hook definition
pcm_hook.NAME {
type STR # PCM Hook type (see pcm_hook_type)
[args STR] # Arguments for install function (see hook_args)
# or
[args { }] # Arguments for install function
}
# PCM definition
pcm.NAME {
type STR # Type
[comment ANY] # Saved comments
# PCM types:
type hw # Kernel PCM
card INT/STR # Card name or number
[device] INT # Device number (default 0)
[subdevice] INT # Subdevice number, -1 first available (default -1)
mmap_emulation BOOL # enable mmap emulation for ro/wo devices
type hooks # PCM with hooks
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
hooks {
ID STR # Hook name (see pcm_hook)
# or
ID { } # Hook definition (see pcm_hook)
}
type plug # Format adjusted PCM
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format (default nearest) or "unchanged"
[channels INT] # Slave channels (default nearest) or "unchanged"
[rate INT] # Slave rate (default nearest) or "unchanged"
}
route_policy STR # route policy for automatic ttable generation
# STR can be 'default', 'average', 'copy', 'duplicate'
# average: result is average of input channels
# copy: only first channels are copied to destination
# duplicate: duplicate first set of channels
# default: copy policy, except for mono capture - sum
ttable { # Transfer table (bidimensional compound of
# cchannels * schannels numbers)
CCHANNEL {
SCHANNEL REAL # route value (0.0 ... 1.0)
}
}
type copy # Copy conversion PCM
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
type linear # Linear format conversion PCM
type adpcm # IMA-ADPCM format conversion PCM
type alaw # A-Law format conversion PCM
type mulaw # Mu-Law format conversion PCM
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
type rate # Rate conversion PCM
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format (default client format)
rate INT # Slave rate
}
type route # Attenuated static route PCM
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format (default client format)
[channels INT] # Slave channels (default client channels)
}
ttable { # Transfer table (bidimensional compound of
# cchannels * schannels numbers)
CCHANNEL {
SCHANNEL REAL # route value (0.0 ... 1.0)
}
}
type multi # Linked PCMs (exclusive access to selected channels)
slaves { # Slaves definitions
ID STR # Slave name for slave N (see pcm_slave)
# or
ID { # Slave definition for slave N
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
channels INT # Slave channels
}
}
bindings { # Bindings table
N { # Binding for client channel N
slave STR # Slave key
channel INT # Slave channel
}
}
[master INT] # Define the master slave
type file # File plugin
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
file STR # File name
# or
file INT # File descriptor
[format STR] # File format (NYI)
[perm INT] # File permission (default 0600)
type meter # Meter PCM
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition or name
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
[frequency INT] # Updates per second
scopes { # Scopes
ID STR # Scope name (see pcm_scope)
# or
ID { } # Scope definition (see pcm_scope)
}
type droute # Attenuated dynamic route PCM (NYI)
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format (default client format)
[channels INT] # Slave channels (default client channels)
}
ctl STR # Ctl name
bindings { # Bindings table
ID { # Binding entry
cchannels { # Client channels
C INT # Client channel
}
schannel { # Slave channels
S INT # Slave channel
}
control STR # Control name of C * S (or C values: only if C == S)
}
}
type null # Null endpoint plugin
[time INT] # Time related or not (NYI)
type shm # Shared memory client PCM
server STR # Server name
pcm STR # PCM name on server
type share # Share PCM
slave STR # Slave name (see pcm_slave)
bindings { # Bindings table
N INT # Slave channel for client channel N
}
type mix # Mix PCM
slave STR # Slave name (see pcm_slave)
bindings { # Bindings table
N INT # Slave channel for client channel N
}
type ladspa # LADSPA plugin PCM
slave STR # Slave name (see pcm_slave)
path STR # Path or paths (delimited with ':')
plugins | playback_plugins | capture_plugins {
N { # Configuration for LADSPA plugin N
id # # LADSPA plugin ID (for example 1043)
label STR # LADSPA plugin label (for example 'delay_5s')
filename STR # Full filename of .so library with LADPA plugin code
policy STR # Policy can be 'none' or 'duplicate'
input | output {
bindings {
C INT or STR # C - channel, INT - audio port index, STR - audio port name
}
controls {
I INT or REAL # I - control port index, INT or REAL - control value
}
}
}
}
type dmix # Direct mixing plugin
slave STR # Slave name (see pcm_slave)
ipc_key INT # Unique ipc key
ipc_perm INT # ipc permissions (default 0600)
ipc_gid INT # ipc gid (default -1 = disable)
ipc_key_add_uid BOOL # Add current uid to ipc_key
bindings { # Bindings table
N INT # Slave channel for client channel N
}
type dsnoop # Direct snoop (split one capture stream to more)
slave STR # Slave name (see pcm_slave)
ipc_key INT # Unique ipc key
ipc_perm INT # ipc permissions (default 0600)
ipc_gid INT # ipc gid (default -1 = disable)
ipc_key_add_uid BOOL # Add current uid to ipc_key
bindings { # Bindings table
N INT # Slave channel for client channel N
}
type dshare # Share channels from one stream
slave STR # Slave name (see pcm_slave)
ipc_key INT # Unique ipc key
ipc_perm INT # ipc permissions (default 0600)
ipc_gid INT # ipc gid (default -1 = disable)
ipc_key_add_uid BOOL # Add current uid to ipc_key
bindings { # Bindings table
N INT # Slave channel for client channel N
}
}
# CTL type definition
ctl_type.NAME {
[lib STR] # Library file (default libasound.so)
[open STR] # Open function (default _snd_ctl_NAME_open)
}
# CTL definition
ctl.NAME {
type STR # Type
[comment ANY] # Saved comments
# CTL types
type hw
card STR/INT # Card name or number
type shm # Shared memory client CTL
server STR # Server name
ctl STR # CTL name on server
}
# RAWMIDI type definition
rawmidi_type.NAME {
[lib STR] # Library file (default libasound.so)
[open STR] # Open function (default _snd_rawmidi_NAME_open)
}
# RAWMIDI definition
rawmidi.NAME {
type STR # Type
[comment ANY] # Saved comments
# RAWMIDI types:
type hw # Kernel RAWMIDI
card INT/STR # Card name or number
[device] INT # Device number (default 0)
[subdevice] INT # Subdevice number, -1 first available (default -1)
}
# SEQ type definition
seq_type.NAME {
[lib STR] # Library file (default libasound.so)
[open STR] # Open function (default _snd_seq_NAME_open)
}
# SEQ definition
seq.NAME {
type STR # Type
[comment ANY] # Saved comments
# SEQ types:
type hw # Kernel SEQ
}
# Aliases
DEF.NAME1 NAME2 # DEF.NAME1 is an alias for DEF.NAME2
Some examples:
pcm.trident {
type hw
card 0
device 0
}
pcm.ice1712 {
type hw
card 1
device 0
}
pcm.ice1712_spdif {
type plug
ttable.0.8 1
ttable.1.9 1
slave.pcm ice1712
}
pcm_slave.rs {
pcm trident
rate 44100
}
pcm.r {
type rate
slave rs
}
pcm.m {
type meter
slave.pcm plug:trident
frequency 50
scopes [
{
type level
}
]
}
pcm_scope_type.level {
lib /home/abramo/scopes/scope-level.so
}
# an example command is 'aplay -D plug:ladspa <filename>'
# otherwise, the ladspa plugin expects FLOAT type which
# is very rare
pcm.ladspa {
type ladspa
slave.pcm "plughw:0,0";
path "/home/perex/src/ladspa_sdk/plugins";
plugins [
{
label delay_5s
input {
controls [ 0.8 0.2 ]
}
}
]
}
# an example command for dmix plugin to force 44100Hz mixing rate:
# aplay -D"plug:'dmix:RATE=44100'" <filename>
# an example command for dmix plugin to force 44100Hz and hw:1,0 output device
# aplay -Dplug:\'dmix:SLAVE=\"hw:1,0\",RATE=44100\' <filename>
# an example command for dmix plugin to force 32-bit signed little endian format
# aplay -D"plug:'dmix:FORMAT=S32_LE'" <filename>

144
doc/doxygen.cfg.in Normal file
View file

@ -0,0 +1,144 @@
PROJECT_NAME = "ALSA project - the C library reference"
OUTPUT_DIRECTORY = doxygen
GENERATE_LATEX = NO
GENERATE_MAN = NO
GENERATE_RTF = NO
CASE_SENSE_NAMES = NO
INPUT = @top_srcdir@/doc/index.doxygen \
@top_srcdir@/include/asoundlib.h \
@top_srcdir@/include/version.h \
@top_srcdir@/include/global.h \
@top_srcdir@/include/asoundef.h \
@top_srcdir@/include/input.h \
@top_srcdir@/include/output.h \
@top_srcdir@/include/error.h \
@top_srcdir@/include/conf.h \
@top_srcdir@/include/control.h \
@top_srcdir@/include/pcm.h \
@top_srcdir@/include/rawmidi.h \
@top_srcdir@/include/ump.h \
@top_srcdir@/include/ump_msg.h \
@top_srcdir@/include/timer.h \
@top_srcdir@/include/hwdep.h \
@top_srcdir@/include/seq.h \
@top_srcdir@/include/seq_event.h \
@top_srcdir@/include/seqmid.h \
@top_srcdir@/include/seq_midi_event.h \
@top_srcdir@/include/pcm_external.h \
@top_srcdir@/include/pcm_extplug.h \
@top_srcdir@/include/pcm_ioplug.h \
@top_srcdir@/include/control_external.h \
@top_srcdir@/include/mixer.h \
@top_srcdir@/include/use-case.h \
@top_srcdir@/include/topology.h \
@top_srcdir@/src/error.c \
@top_srcdir@/src/dlmisc.c \
@top_srcdir@/src/async.c \
@top_srcdir@/src/input.c \
@top_srcdir@/src/output.c \
@top_srcdir@/src/conf.c \
@top_srcdir@/src/confeval.c \
@top_srcdir@/src/confmisc.c \
@top_srcdir@/src/names.c \
@top_srcdir@/src/shmarea.c \
@top_srcdir@/src/userfile.c \
@top_srcdir@/src/control/cards.c \
@top_srcdir@/src/control/control.c \
@top_srcdir@/src/control/control_ext.c \
@top_srcdir@/src/control/control_plugin.c \
@top_srcdir@/src/control/control_hw.c \
@top_srcdir@/src/control/control_remap.c \
@top_srcdir@/src/control/control_shm.c \
@top_srcdir@/src/control/ctlparse.c \
@top_srcdir@/src/control/hcontrol.c \
@top_srcdir@/src/control/namehint.c \
@top_srcdir@/src/control/setup.c \
@top_srcdir@/src/control/tlv.c \
@top_srcdir@/src/mixer \
@top_srcdir@/src/pcm/pcm.c \
@top_srcdir@/src/pcm/pcm_mmap.c \
@top_srcdir@/src/pcm/pcm_plugin.c \
@top_srcdir@/src/pcm/pcm_hw.c \
@top_srcdir@/src/pcm/pcm_mmap_emul.c \
@top_srcdir@/src/pcm/pcm_shm.c \
@top_srcdir@/src/pcm/pcm_null.c \
@top_srcdir@/src/pcm/pcm_copy.c \
@top_srcdir@/src/pcm/pcm_linear.c \
@top_srcdir@/src/pcm/pcm_lfloat.c \
@top_srcdir@/src/pcm/pcm_mulaw.c \
@top_srcdir@/src/pcm/pcm_alaw.c \
@top_srcdir@/src/pcm/pcm_adpcm.c \
@top_srcdir@/src/pcm/pcm_route.c \
@top_srcdir@/src/pcm/pcm_rate.c \
@top_srcdir@/src/pcm/pcm_plug.c \
@top_srcdir@/src/pcm/pcm_file.c \
@top_srcdir@/src/pcm/pcm_multi.c \
@top_srcdir@/src/pcm/pcm_share.c \
@top_srcdir@/src/pcm/pcm_hooks.c \
@top_srcdir@/src/pcm/pcm_dmix.c \
@top_srcdir@/src/pcm/pcm_dshare.c \
@top_srcdir@/src/pcm/pcm_dsnoop.c \
@top_srcdir@/src/pcm/pcm_meter.c \
@top_srcdir@/src/pcm/pcm_ladspa.c \
@top_srcdir@/src/pcm/pcm_asym.c \
@top_srcdir@/src/pcm/pcm_iec958.c \
@top_srcdir@/src/pcm/pcm_softvol.c \
@top_srcdir@/src/pcm/pcm_extplug.c \
@top_srcdir@/src/pcm/pcm_ioplug.c \
@top_srcdir@/src/pcm/pcm_empty.c \
@top_srcdir@/src/pcm/pcm_misc.c \
@top_srcdir@/src/pcm/pcm_simple.c \
@top_srcdir@/src/rawmidi \
@top_srcdir@/src/timer \
@top_srcdir@/src/hwdep \
@top_srcdir@/src/seq \
@top_srcdir@/src/ucm \
@top_srcdir@/src/topology
EXCLUDE = @top_srcdir@/src/control/control_local.h \
@top_srcdir@/src/pcm/atomic.h \
@top_srcdir@/src/pcm/interval.h \
@top_srcdir@/src/pcm/interval_inline.h \
@top_srcdir@/src/pcm/mask.h \
@top_srcdir@/src/pcm/mask_inline.h \
@top_srcdir@/src/pcm/pcm_local.h \
@top_srcdir@/src/pcm/pcm_meter.h \
@top_srcdir@/src/pcm/pcm_plugin.h \
@top_srcdir@/src/pcm/plugin_ops.h \
@top_srcdir@/src/pcm/ladspa.h \
@top_srcdir@/src/hwdep/hwdep_local.h \
@top_srcdir@/src/mixer/mixer_local.h \
@top_srcdir@/src/rawmidi/rawmidi_local.h \
@top_srcdir@/src/seq/seq_local.h \
@top_srcdir@/src/ucm/ucm_local.h \
@top_srcdir@/src/topology/tplg_local.h
RECURSIVE = YES
FILE_PATTERNS = *.c *.h
INCLUDE_PATH = @top_builddir@/include
EXAMPLE_PATH = @top_srcdir@/test
IMAGE_PATH = @top_srcdir@/doc/pictures
QUIET = YES
EXTRACT_ALL = NO
EXTRACT_STATIC = NO
SHOW_INCLUDE_FILES = NO
JAVADOC_AUTOBRIEF = NO
INHERIT_DOCS = YES
ENABLED_SECTIONS = ""
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES
PREDEFINED = DOXYGEN PIC "DOC_HIDDEN" \
"ATTRIBUTE_UNUSED=" \
ALSA_PCM_NEW_HW_PARAMS_API \
_POSIX_C_SOURCE \
"use_default_symbol_version(x,y,z)=" \
"link_warning(x,y)=" \
__attribute__((x))=
OPTIMIZE_OUTPUT_FOR_C = YES # doxygen 1.2.6 option
TYPEDEF_HIDES_STRUCT = YES # needed in doxygen >= 1.5.4
#INPUT_FILTER = inputfilter
#FILTER_SOURCE_FILES = YES
HTML_TIMESTAMP = NO

60
doc/index.doxygen Normal file
View file

@ -0,0 +1,60 @@
/*! \mainpage Index, Preamble and License
\author Jaroslav Kysela <perex@perex.cz>
\author Abramo Bagnara <abramo@alsa-project.org>
\author Takashi Iwai <tiwai@suse.de>
\author Frank van de Pol <fvdpol@coil.demon.nl>
Preface
-------
The Advanced Linux Sound Architecture (\e ALSA) comes with a kernel
API and a library API. This document describes the library API and how
it interfaces with the kernel API.
### Documentation License
This documentation is free; you can redistribute it without
any restrictions. Modifications or derived work must retain
the copyright and list all authors.
This documentation 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.
API usage
---------
Application programmers should use the library API rather than the
kernel API. The library offers 100% of the functionality of the kernel API,
but adds major improvements in usability, making the application code simpler
and better looking. In addition, future fixes or compatibility code
may be placed in the library code instead of the kernel driver.
API links
---------
- Page \subpage control explains the primitive controls API.
- Page \subpage control_plugins explains the design of primitive control plugins.
- Page \subpage hcontrol explains the high-level primitive controls API.
- Page \subpage mixer explains the mixer controls API.
- Page \subpage pcm explains the design of the PCM (digital audio) API.
- Page \subpage pcm_plugins explains the design of PCM (digital audio) plugins.
- Page \subpage pcm_external_plugins explains the external PCM plugin SDK.
- Page \subpage ctl_external_plugins explains the external control plugin SDK.
- Page \subpage rawmidi explains the design of the RawMidi API.
- Page \subpage timer explains the design of the Timer API.
- Page \subpage seq explains the design of the Sequencer API.
- Page \subpage ucm explains the use case API.
- Page \subpage topology explains the DSP topology API.
Configuration
-------------
- Page \subpage conf explains the syntax of library configuration.
- Page \subpage confarg explains the run-time argument syntax.
- Page \subpage conffunc explains run-time function definitions and their usage.
- Page \subpage confhooks explains run-time hook definitions and their usage.
- Page \subpage ucm_conf explains the UCM configuration and their usage.
*/

9
doc/pictures/Makefile.am Normal file
View file

@ -0,0 +1,9 @@
GIT_FILES=$(wildcard *.gif)
PUML_FILES=$(wildcard *.puml)
SVG_FILES=$(PUML_FILES:.puml=.svg)
EXTRA_DIST=$(GIT_FILES) $(PUML_FILES) $(SVG_FILES)
all: $(SVG_FILES)
.puml.svg:
plantuml -tsvg $<

View file

@ -0,0 +1,17 @@
@startuml
title "UCM sequence boot order (using udev and alsactl)"
start
:Sound card detected (udev);
:UCM: FixedBootSequence;
if (Card state (/var/lib/alsa/asound.state)) then (not present)
:UCM: BootSequence;
else (present)
:alsactl: Restore state (from asound.state);
endif
:Standard sound card use (with or without UCM);
:Save sound card state (asound.state);
:Sound card detached;
stop
@enduml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.2 KiB

View file

@ -0,0 +1,26 @@
@startuml
title "UCM device sequence graph"
start
split
:Enable device;
:EnableSequence;
:Use device;
:Disable device;
:DisableSequence;
split again
:Switch device;
:Disable old device;
if (TransitionSequence) then (present)
:TransitionSequence;
:Enable new device;
else (not present)
:Disable old device;
:DisableSequence;
:Enable new device;
:EnableSequence;
endif
end split
stop
@enduml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,30 @@
@startuml
title "UCM verb sequence graph"
start
split
:Enable verb;
:SectionDefaults sequence;
:EnableSequence;
:Enable, use and disable verb devices;
:Disable verb;
:DisableSequence;
split again
:Switch verb;
:Disable old verb;
if (TransitionSequence) then (present)
:TransitionSequence;
:Enable new verb;
else (not present)
:Disable old verb;
:DisableSequence;
:Enable new verb;
:EnableSequence;
endif
end split
stop
@enduml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -0,0 +1,19 @@
@startuml
title "UCM volume"
start
if (Card state (/var/lib/alsa/asound.state)) then (not present)
:UCM: BootSequence;
else (present)
:alsactl: Restore state (from asound.state);
endif
:UCM application:set device volume;
note right
The application uses (Playback|Capture)MixerElem or
(Playback/Capture)(Volume/Switch) values to get
the controls.
end note
:alsactl: Store state (to asound.state);
stop
@enduml

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
doc/pictures/wave1.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
doc/pictures/wave2.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,020 B

97
gitcompile Executable file
View file

@ -0,0 +1,97 @@
#!/bin/bash
set -e
bits32=
cbits32=
modules=
lto=
if [ $# -ne 0 ]; then
endloop=
while [ -z "$endloop" ]; do
case "$1" in
32)
bits32=yes
cbits32="-m32"
echo "Forced 32-bit library build..."
shift ;;
modules)
modules=yes
echo "Forced mixer modules build..."
shift ;;
python2)
python2=yes
echo "Forced python2 interpreter build..."
shift ;;
lto)
lto="-flto -flto-partition=none"
echo "Forced lto build..."
shift ;;
static)
static=yes
echo "Selected static build..."
shift ;;
*)
endloop=yes
;;
esac
done
fi
if [ $# -ne 0 -a -z "$bit32" ]; then
args="$@"
elif [ -r /etc/asound/library_args ]; then
args="`cat /etc/asound/library_args`"
if [ -z "$bits32" ]; then
test -r /etc/asound/library64_args && \
args="`cat /etc/asound/library64_args`"
fi
else
prefix="/usr"
libdir="/usr/lib"
libdir2="/usr/lib"
if [ -z "$bits32" ]; then
test -d /usr/lib64 && libdir="/usr/lib64"
test -f /lib64/libasound.so.2 && libdir="/lib64"
test -d /usr/lib64 && libdir2="/usr/lib64"
else
test -f /lib/libasound.so.2 && libdir="/lib"
fi
args="--disable-aload --prefix=$prefix --libdir=$libdir"
args="$args --with-plugindir=$libdir2/alsa-lib"
args="$args --with-pkgconfdir=$libdir2/pkgconfig"
fi
if [ "$modules" = "yes" ]; then
args="$args --enable-mixer-modules"
args="$args --enable-mixer-pymods"
fi
if [ "$python2" = "yes" ]; then
args="$args --enable-python2"
fi
if [ "$static" = "yes" ]; then
#args="$args --enable-shared=no --enable-static=yes"
args="$args --disable-shared"
fi
touch ltconfig
libtoolize --force --copy --automake
aclocal $ACLOCAL_FLAGS
autoheader
automake --foreign --copy --add-missing
touch depcomp # seems to be missing for old automake
autoconf
export CFLAGS="$cbits32 -O2 -Wall -W -Wunused-const-variable=0 -pipe -g $lto"
if [ -n "$lto" ]; then
export AR="gcc-ar"
export RANLIB="gcc-ranlib"
fi
echo "CFLAGS=$CFLAGS"
echo "./configure $args"
./configure $args || exit 1
unset CFLAGS
if [ -z "$GITCOMPILE_NO_MAKE" ]; then
make
fi

105
include/Makefile.am Normal file
View file

@ -0,0 +1,105 @@
SUBDIRS = sound
sysincludedir = ${includedir}/sys
alsaincludedir = ${includedir}/alsa
alsainclude_HEADERS = asoundlib.h asoundef.h \
version.h global.h input.h output.h error.h \
conf.h control.h
if BUILD_CTL_PLUGIN
alsainclude_HEADERS += control_plugin.h
endif
if BUILD_CTL_PLUGIN_EXT
alsainclude_HEADERS += control_external.h
endif
if BUILD_PCM
alsainclude_HEADERS += pcm.h pcm_old.h timer.h
if BUILD_PCM_PLUGIN
alsainclude_HEADERS += pcm_plugin.h
endif
if BUILD_PCM_PLUGIN_RATE
alsainclude_HEADERS += pcm_rate.h
endif
if BUILD_PCM_PLUGIN_EXTERNAL
# FIXME: pcm_external.h includes both pcm_extplug.h and pcm_ioplug.h
alsainclude_HEADERS += pcm_external.h pcm_extplug.h pcm_ioplug.h
endif
#if BUILD_PCM_PLUGIN_EXTPLUG
#alsainclude_HEADERS += pcm_extplug.h
#endif
#if BUILD_PCM_PLUGIN_IOPLUG
#alsainclude_HEADERS += pcm_ioplug.h
#endif
endif
if BUILD_RAWMIDI
alsainclude_HEADERS += rawmidi.h ump.h ump_msg.h
endif
if BUILD_HWDEP
alsainclude_HEADERS += hwdep.h
endif
if BUILD_MIXER
alsainclude_HEADERS += mixer.h mixer_abst.h
endif
if BUILD_SEQ
alsainclude_HEADERS += seq_event.h seq.h seqmid.h seq_midi_event.h
endif
if BUILD_UCM
alsainclude_HEADERS += use-case.h
endif
if BUILD_TOPOLOGY
alsainclude_HEADERS += topology.h
endif
noinst_HEADERS = alsa sys.h search.h list.h aserver.h local.h alsa-symbols.h \
asoundlib-head.h asoundlib-tail.h bswap.h type_compat.h
DISTCLEANFILES = stamp-vh version.h alsa asoundlib.h
.DUMMY: alsa_link
alsa_link:
if ! test -r alsa/local.h; then \
ln -s $(top_srcdir)/include alsa; \
fi
version.h: stamp-vh alsa_link
for f in asoundlib.h version.h; do \
if ! test -r $(top_srcdir)/include/$$f; then \
ln -s $(abs_top_builddir)/include/$$f $(top_srcdir)/include/$$f; \
fi; \
done
stamp-vh: $(top_builddir)/configure.ac
@echo "/*" > ver.tmp
@echo " * version.h" >> ver.tmp
@echo " */" >> ver.tmp
@echo "" >> ver.tmp
@echo "#define SND_LIB_MAJOR $(SND_LIB_MAJOR) /**< major number of library version */" >> ver.tmp
@echo "#define SND_LIB_MINOR $(SND_LIB_MINOR) /**< minor number of library version */" >> ver.tmp
@echo "#define SND_LIB_SUBMINOR $(SND_LIB_SUBMINOR) /**< subminor number of library version */" >> ver.tmp
@echo "#define SND_LIB_EXTRAVER $(SND_LIB_EXTRAVER) /**< extra version number, used mainly for betas */" >> ver.tmp
@echo "/** library version */" >> ver.tmp
@echo "#define SND_LIB_VER(maj, min, sub) (((maj)<<16)|((min)<<8)|(sub))" >> ver.tmp
@echo "#define SND_LIB_VERSION SND_LIB_VER(SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR)" >> ver.tmp
@echo "/** library version (string) */" >> ver.tmp
@echo "#define SND_LIB_VERSION_STR \"$(SND_LIB_VERSION)\"" >> ver.tmp
@echo >> ver.tmp
@cmp -s version.h ver.tmp \
|| (echo "Updating version.h"; \
cp ver.tmp version.h; \
echo timestamp > stamp-vh)
-@rm -f ver.tmp
AM_CPPFLAGS=-I$(top_srcdir)/include
install-data-hook:
test -d $(DESTDIR)$(sysincludedir) || mkdir -p $(DESTDIR)$(sysincludedir)
$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(sysincludedir)/asoundlib.h
$(INSTALL_DATA) $(srcdir)/sys.h $(DESTDIR)$(includedir)/asoundlib.h

1
include/alsa Symbolic link
View file

@ -0,0 +1 @@
.

68
include/alsa-symbols.h Normal file
View file

@ -0,0 +1,68 @@
/*
* ALSA lib - dynamic symbol versions
* Copyright (c) 2002 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ALSA_SYMBOLS_H
#define __ALSA_SYMBOLS_H
#if defined(PIC) && defined(VERSIONED_SYMBOLS) /* might be also configurable */
#define USE_VERSIONED_SYMBOLS
#endif
#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post
#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name)
#if HAVE_ATTRIBUTE_SYMVER && __GNUC__ > 10
#define symbol_version(real, name, version) \
extern __typeof (real) real __attribute__((symver (#name "@" #version)))
#define default_symbol_version(real, name, version) \
extern __typeof (real) real __attribute__((symver (#name "@@" #version)))
#else
#define symbol_version(real, name, version) \
__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@" #version)
#define default_symbol_version(real, name, version) \
__asm__ (".symver " ASM_NAME(#real) "," ASM_NAME(#name) "@@" #version)
#endif
#ifdef __clang__
#define EXPORT_SYMBOL __attribute__((visibility("default")))
#else
#define EXPORT_SYMBOL __attribute__((visibility("default"),externally_visible))
#endif
#ifdef USE_VERSIONED_SYMBOLS
#define use_symbol_version(real, name, version) \
symbol_version(real, name, version)
#define use_default_symbol_version(real, name, version) \
default_symbol_version(real, name, version)
#else
#define use_symbol_version(real, name, version) /* nothing */
#if defined(__alpha__) || defined(__mips__)
#define use_default_symbol_version(real, name, version) \
__asm__ (".weak " ASM_NAME(#name)); \
__asm__ (ASM_NAME(#name) " = " ASM_NAME(#real))
#else
#define use_default_symbol_version(real, name, version) \
__asm__ (".weak " ASM_NAME(#name)); \
__asm__ (".set " ASM_NAME(#name) "," ASM_NAME(#real))
#endif
#endif
#endif /* __ALSA_SYMBOLS_H */

159
include/aserver.h Normal file
View file

@ -0,0 +1,159 @@
/*
* ALSA client/server header file
* Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "../src/pcm/pcm_local.h"
#include "../src/control/control_local.h"
#include <netdb.h>
int snd_receive_fd(int sock, void *data, size_t len, int *fd);
typedef enum _snd_dev_type {
SND_DEV_TYPE_PCM,
SND_DEV_TYPE_CONTROL,
SND_DEV_TYPE_RAWMIDI,
SND_DEV_TYPE_TIMER,
SND_DEV_TYPE_HWDEP,
SND_DEV_TYPE_SEQ,
} snd_dev_type_t;
typedef enum _snd_transport_type {
SND_TRANSPORT_TYPE_SHM,
SND_TRANSPORT_TYPE_TCP,
} snd_transport_type_t;
#define SND_PCM_IOCTL_HWSYNC _IO ('A', 0x22)
#define SND_PCM_IOCTL_STATE _IO ('A', 0xf1)
#define SND_PCM_IOCTL_MMAP _IO ('A', 0xf2)
#define SND_PCM_IOCTL_MUNMAP _IO ('A', 0xf3)
#define SND_PCM_IOCTL_MMAP_COMMIT _IO ('A', 0xf4)
#define SND_PCM_IOCTL_AVAIL_UPDATE _IO ('A', 0xf5)
#define SND_PCM_IOCTL_ASYNC _IO ('A', 0xf6)
#define SND_PCM_IOCTL_CLOSE _IO ('A', 0xf7)
#define SND_PCM_IOCTL_POLL_DESCRIPTOR _IO ('A', 0xf8)
#define SND_PCM_IOCTL_HW_PTR_FD _IO ('A', 0xf9)
#define SND_PCM_IOCTL_APPL_PTR_FD _IO ('A', 0xfa)
#define SND_PCM_IOCTL_FORWARD _IO ('A', 0xfb)
typedef struct {
snd_pcm_uframes_t ptr;
int use_mmap;
off_t offset; /* for mmap */
int changed;
} snd_pcm_shm_rbptr_t;
typedef struct {
long result;
int cmd;
snd_pcm_shm_rbptr_t hw;
snd_pcm_shm_rbptr_t appl;
union {
struct {
int sig;
pid_t pid;
} async;
snd_pcm_info_t info;
snd_pcm_hw_params_t hw_refine;
snd_pcm_hw_params_t hw_params;
snd_pcm_sw_params_t sw_params;
snd_pcm_status_t status;
struct {
snd_pcm_uframes_t frames;
} avail;
struct {
snd_pcm_sframes_t frames;
} delay;
struct {
int enable;
} pause;
snd_pcm_channel_info_t channel_info;
struct {
snd_pcm_uframes_t frames;
} rewind;
struct {
snd_pcm_uframes_t frames;
} forward;
struct {
int fd;
} link;
struct {
snd_pcm_uframes_t offset;
snd_pcm_uframes_t frames;
} mmap_commit;
struct {
char use_mmap;
int shmid;
off_t offset;
} rbptr;
} u;
char data[0];
} snd_pcm_shm_ctrl_t;
#define PCM_SHM_SIZE sizeof(snd_pcm_shm_ctrl_t)
#define SND_CTL_IOCTL_READ _IOR('U', 0xf1, snd_ctl_event_t)
#define SND_CTL_IOCTL_CLOSE _IO ('U', 0xf2)
#define SND_CTL_IOCTL_POLL_DESCRIPTOR _IO ('U', 0xf3)
#define SND_CTL_IOCTL_ASYNC _IO ('U', 0xf4)
typedef struct {
int result;
int cmd;
union {
struct {
int sig;
pid_t pid;
} async;
int device;
int subscribe_events;
snd_ctl_card_info_t card_info;
snd_ctl_elem_list_t element_list;
snd_ctl_elem_info_t element_info;
snd_ctl_elem_value_t element_read;
snd_ctl_elem_value_t element_write;
snd_ctl_elem_id_t element_lock;
snd_ctl_elem_id_t element_unlock;
snd_hwdep_info_t hwdep_info;
snd_pcm_info_t pcm_info;
int pcm_prefer_subdevice;
snd_rawmidi_info_t rawmidi_info;
int rawmidi_prefer_subdevice;
unsigned int power_state;
snd_ctl_event_t read;
} u;
char data[0];
} snd_ctl_shm_ctrl_t;
#define CTL_SHM_SIZE 65536
#define CTL_SHM_DATA_MAXLEN (CTL_SHM_SIZE - offsetof(snd_ctl_shm_ctrl_t, data))
typedef struct {
unsigned char dev_type;
unsigned char transport_type;
unsigned char stream;
unsigned char mode;
unsigned char namelen;
char name[0];
} snd_client_open_request_t;
typedef struct {
long result;
int cookie;
} snd_client_open_answer_t;

352
include/asoundef.h Normal file
View file

@ -0,0 +1,352 @@
/**
* \file include/asoundef.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Definitions of constants for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/asoundef.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_ASOUNDEF_H
#define __ALSA_ASOUNDEF_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Digital_Audio_Interface Constants for Digital Audio Interfaces
* AES/IEC958/CEA-861 channel status bits.
* \{
*/
#define IEC958_AES0_PROFESSIONAL (1<<0) /**< 0 = consumer, 1 = professional */
#define IEC958_AES0_NONAUDIO (1<<1) /**< 0 = audio, 1 = non-audio */
#define IEC958_AES0_PRO_EMPHASIS (7<<2) /**< mask - emphasis */
#define IEC958_AES0_PRO_EMPHASIS_NOTID (0<<2) /**< emphasis not indicated */
#define IEC958_AES0_PRO_EMPHASIS_NONE (1<<2) /**< no emphasis */
#define IEC958_AES0_PRO_EMPHASIS_5015 (3<<2) /**< 50/15us emphasis */
#define IEC958_AES0_PRO_EMPHASIS_CCITT (7<<2) /**< CCITT J.17 emphasis */
#define IEC958_AES0_PRO_FREQ_UNLOCKED (1<<5) /**< source sample frequency: 0 = locked, 1 = unlocked */
#define IEC958_AES0_PRO_FS (3<<6) /**< mask - sample frequency */
#define IEC958_AES0_PRO_FS_NOTID (0<<6) /**< fs not indicated */
#define IEC958_AES0_PRO_FS_44100 (1<<6) /**< 44.1kHz */
#define IEC958_AES0_PRO_FS_48000 (2<<6) /**< 48kHz */
#define IEC958_AES0_PRO_FS_32000 (3<<6) /**< 32kHz */
#define IEC958_AES0_CON_NOT_COPYRIGHT (1<<2) /**< 0 = copyright, 1 = not copyright */
#define IEC958_AES0_CON_EMPHASIS (7<<3) /**< mask - emphasis */
#define IEC958_AES0_CON_EMPHASIS_NONE (0<<3) /**< no emphasis */
#define IEC958_AES0_CON_EMPHASIS_5015 (1<<3) /**< 50/15us emphasis */
#define IEC958_AES0_CON_MODE (3<<6) /**< mask - mode */
#define IEC958_AES1_PRO_MODE (15<<0) /**< mask - channel mode */
#define IEC958_AES1_PRO_MODE_NOTID (0<<0) /**< mode not indicated */
#define IEC958_AES1_PRO_MODE_STEREOPHONIC (2<<0) /**< stereophonic - ch A is left */
#define IEC958_AES1_PRO_MODE_SINGLE (4<<0) /**< single channel */
#define IEC958_AES1_PRO_MODE_TWO (8<<0) /**< two channels */
#define IEC958_AES1_PRO_MODE_PRIMARY (12<<0) /**< primary/secondary */
#define IEC958_AES1_PRO_MODE_BYTE3 (15<<0) /**< vector to byte 3 */
#define IEC958_AES1_PRO_USERBITS (15<<4) /**< mask - user bits */
#define IEC958_AES1_PRO_USERBITS_NOTID (0<<4) /**< user bits not indicated */
#define IEC958_AES1_PRO_USERBITS_192 (8<<4) /**< 192-bit structure */
#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /**< user defined application */
#define IEC958_AES1_CON_CATEGORY 0x7f /**< consumer category */
#define IEC958_AES1_CON_GENERAL 0x00 /**< general category */
#define IEC958_AES1_CON_LASEROPT_MASK 0x07 /**< Laser-optical mask */
#define IEC958_AES1_CON_LASEROPT_ID 0x01 /**< Laser-optical ID */
#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00) /**< IEC958 CD compatible device */
#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08) /**< non-IEC958 CD compatible device */
#define IEC958_AES1_CON_MINI_DISC (IEC958_AES1_CON_LASEROPT_ID|0x48) /**< Mini-Disc device */
#define IEC958_AES1_CON_DVD (IEC958_AES1_CON_LASEROPT_ID|0x18) /**< DVD device */
#define IEC958_AES1_CON_LASTEROPT_OTHER (IEC958_AES1_CON_LASEROPT_ID|0x78) /**< Other laser-optical product */
#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07 /**< digital<->digital converter mask */
#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02 /**< digital<->digital converter id */
#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00) /**< PCM coder */
#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10) /**< Digital signal mixer */
#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18) /**< Rate converter */
#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20) /**< PCM sampler */
#define IEC958_AES1_CON_DSP (IEC958_AES1_CON_DIGDIGCONV_ID|0x28) /**< Digital sound processor */
#define IEC958_AES1_CON_DIGDIGCONV_OTHER (IEC958_AES1_CON_DIGDIGCONV_ID|0x78) /**< Other digital<->digital product */
#define IEC958_AES1_CON_MAGNETIC_MASK 0x07 /**< Magnetic device mask */
#define IEC958_AES1_CON_MAGNETIC_ID 0x03 /**< Magnetic device ID */
#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00) /**< Digital Audio Tape */
#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08) /**< Video recorder */
#define IEC958_AES1_CON_DCC (IEC958_AES1_CON_MAGNETIC_ID|0x40) /**< Digital compact cassette */
#define IEC958_AES1_CON_MAGNETIC_DISC (IEC958_AES1_CON_MAGNETIC_ID|0x18) /**< Magnetic disc digital audio device */
#define IEC958_AES1_CON_MAGNETIC_OTHER (IEC958_AES1_CON_MAGNETIC_ID|0x78) /**< Other magnetic device */
#define IEC958_AES1_CON_BROADCAST1_MASK 0x07 /**< Broadcast mask */
#define IEC958_AES1_CON_BROADCAST1_ID 0x04 /**< Broadcast ID */
#define IEC958_AES1_CON_DAB_JAPAN (IEC958_AES1_CON_BROADCAST1_ID|0x00) /**< Digital audio broadcast (Japan) */
#define IEC958_AES1_CON_DAB_EUROPE (IEC958_AES1_CON_BROADCAST1_ID|0x08) /**< Digital audio broadcast (Europe) */
#define IEC958_AES1_CON_DAB_USA (IEC958_AES1_CON_BROADCAST1_ID|0x60) /**< Digital audio broadcast (USA) */
#define IEC958_AES1_CON_SOFTWARE (IEC958_AES1_CON_BROADCAST1_ID|0x40) /**< Electronic software delivery */
#define IEC958_AES1_CON_IEC62105 (IEC958_AES1_CON_BROADCAST1_ID|0x20) /**< Used by another standard (IEC 62105) */
#define IEC958_AES1_CON_BROADCAST1_OTHER (IEC958_AES1_CON_BROADCAST1_ID|0x78) /**< Other broadcast product */
#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f /**< Broadcast alternative mask */
#define IEC958_AES1_CON_BROADCAST2_ID 0x0e /**< Broadcast alternative ID */
#define IEC958_AES1_CON_MUSICAL_MASK 0x07 /**< Musical device mask */
#define IEC958_AES1_CON_MUSICAL_ID 0x05 /**< Musical device ID */
#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00) /**< Synthesizer */
#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08) /**< Microphone */
#define IEC958_AES1_CON_MUSICAL_OTHER (IEC958_AES1_CON_MUSICAL_ID|0x78) /**< Other musical device */
#define IEC958_AES1_CON_ADC_MASK 0x1f /**< ADC Mask */
#define IEC958_AES1_CON_ADC_ID 0x06 /**< ADC ID */
#define IEC958_AES1_CON_ADC (IEC958_AES1_CON_ADC_ID|0x00) /**< ADC without copyright information */
#define IEC958_AES1_CON_ADC_OTHER (IEC958_AES1_CON_ADC_ID|0x60) /**< Other ADC product (with no copyright information) */
#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f /**< ADC Copyright mask */
#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x16 /**< ADC Copyright ID */
#define IEC958_AES1_CON_ADC_COPYRIGHT (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x00) /**< ADC with copyright information */
#define IEC958_AES1_CON_ADC_COPYRIGHT_OTHER (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x60) /**< Other ADC with copyright information product */
#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f /**< Solid memory based products mask */
#define IEC958_AES1_CON_SOLIDMEM_ID 0x08 /**< Solid memory based products ID */
#define IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER (IEC958_AES1_CON_SOLIDMEM_ID|0x00) /**< Digital audio recorder and player using solid state memory */
#define IEC958_AES1_CON_SOLIDMEM_OTHER (IEC958_AES1_CON_SOLIDMEM_ID|0x70) /**< Other solid state memory based product */
#define IEC958_AES1_CON_EXPERIMENTAL 0x40 /**< experimental category */
#define IEC958_AES1_CON_ORIGINAL (1<<7) /**< this bits depends on the category code */
#define IEC958_AES2_PRO_SBITS (7<<0) /**< mask - sample bits */
#define IEC958_AES2_PRO_SBITS_20 (2<<0) /**< 20-bit - coordination */
#define IEC958_AES2_PRO_SBITS_24 (4<<0) /**< 24-bit - main audio */
#define IEC958_AES2_PRO_SBITS_UDEF (6<<0) /**< user defined application */
#define IEC958_AES2_PRO_WORDLEN (7<<3) /**< mask - source word length */
#define IEC958_AES2_PRO_WORDLEN_NOTID (0<<3) /**< source word length not indicated */
#define IEC958_AES2_PRO_WORDLEN_22_18 (2<<3) /**< 22-bit or 18-bit */
#define IEC958_AES2_PRO_WORDLEN_23_19 (4<<3) /**< 23-bit or 19-bit */
#define IEC958_AES2_PRO_WORDLEN_24_20 (5<<3) /**< 24-bit or 20-bit */
#define IEC958_AES2_PRO_WORDLEN_20_16 (6<<3) /**< 20-bit or 16-bit */
#define IEC958_AES2_CON_SOURCE (15<<0) /**< mask - source number */
#define IEC958_AES2_CON_SOURCE_UNSPEC (0<<0) /**< source number unspecified */
#define IEC958_AES2_CON_CHANNEL (15<<4) /**< mask - channel number */
#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /**< channel number unspecified */
#define IEC958_AES3_CON_FS (15<<0) /**< mask - sample frequency */
#define IEC958_AES3_CON_FS_44100 (0<<0) /**< 44.1kHz */
#define IEC958_AES3_CON_FS_NOTID (1<<0) /**< sample frequency non indicated */
#define IEC958_AES3_CON_FS_48000 (2<<0) /**< 48kHz */
#define IEC958_AES3_CON_FS_32000 (3<<0) /**< 32kHz */
#define IEC958_AES3_CON_FS_22050 (4<<0) /**< 22.05kHz */
#define IEC958_AES3_CON_FS_24000 (6<<0) /**< 24kHz */
#define IEC958_AES3_CON_FS_88200 (8<<0) /**< 88.2kHz */
#define IEC958_AES3_CON_FS_768000 (9<<0) /**< 768kHz */
#define IEC958_AES3_CON_FS_96000 (10<<0) /**< 96kHz */
#define IEC958_AES3_CON_FS_176400 (12<<0) /**< 176.4kHz */
#define IEC958_AES3_CON_FS_192000 (14<<0) /**< 192kHz */
#define IEC958_AES3_CON_CLOCK (3<<4) /**< mask - clock accuracy */
#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /**< 1000 ppm */
#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /**< 50 ppm */
#define IEC958_AES3_CON_CLOCK_VARIABLE (2<<4) /**< variable pitch */
#define IEC958_AES4_CON_MAX_WORDLEN_24 (1<<0) /**< 0 = 20-bit, 1 = 24-bit */
#define IEC958_AES4_CON_WORDLEN (7<<1) /**< mask - sample word length */
#define IEC958_AES4_CON_WORDLEN_NOTID (0<<1) /**< not indicated */
#define IEC958_AES4_CON_WORDLEN_20_16 (1<<1) /**< 20-bit or 16-bit */
#define IEC958_AES4_CON_WORDLEN_22_18 (2<<1) /**< 22-bit or 18-bit */
#define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /**< 23-bit or 19-bit */
#define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /**< 24-bit or 20-bit */
#define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /**< 21-bit or 17-bit */
#define IEC958_AES4_CON_ORIGFS (15<<4) /**< mask - original sample frequency */
#define IEC958_AES4_CON_ORIGFS_NOTID (0<<4) /**< original sample frequency not indicated */
#define IEC958_AES4_CON_ORIGFS_192000 (1<<4) /**< 192kHz */
#define IEC958_AES4_CON_ORIGFS_12000 (2<<4) /**< 12kHz */
#define IEC958_AES4_CON_ORIGFS_176400 (3<<4) /**< 176.4kHz */
#define IEC958_AES4_CON_ORIGFS_96000 (5<<4) /**< 96kHz */
#define IEC958_AES4_CON_ORIGFS_8000 (6<<4) /**< 8kHz */
#define IEC958_AES4_CON_ORIGFS_88200 (7<<4) /**< 88.2kHz */
#define IEC958_AES4_CON_ORIGFS_16000 (8<<4) /**< 16kHz */
#define IEC958_AES4_CON_ORIGFS_24000 (9<<4) /**< 24kHz */
#define IEC958_AES4_CON_ORIGFS_11025 (10<<4) /**< 11.025kHz */
#define IEC958_AES4_CON_ORIGFS_22050 (11<<4) /**< 22.05kHz */
#define IEC958_AES4_CON_ORIGFS_32000 (12<<4) /**< 32kHz */
#define IEC958_AES4_CON_ORIGFS_48000 (13<<4) /**< 48kHz */
#define IEC958_AES4_CON_ORIGFS_44100 (15<<4) /**< 44.1kHz */
#define IEC958_AES5_CON_CGMSA (3<<0) /**< mask - CGMS-A */
#define IEC958_AES5_CON_CGMSA_COPYFREELY (0<<0) /**< copying is permitted without restriction */
#define IEC958_AES5_CON_CGMSA_COPYONCE (1<<0) /**< one generation of copies may be made */
#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /**< condition not be used */
#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /**< no copying is permitted */
#define CEA861_AUDIO_INFOFRAME_DB1CC (7<<0) /**< mask - channel count */
#define CEA861_AUDIO_INFOFRAME_DB1CT (0xf<<4) /**< mask - coding type */
#define CEA861_AUDIO_INFOFRAME_DB1CT_FROM_STREAM (0<<4) /**< refer to stream */
#define CEA861_AUDIO_INFOFRAME_DB1CT_IEC60958 (1<<4) /**< IEC-60958 L-PCM */
#define CEA861_AUDIO_INFOFRAME_DB1CT_AC3 (2<<4) /**< AC-3 */
#define CEA861_AUDIO_INFOFRAME_DB1CT_MPEG1 (3<<4) /**< MPEG1 Layers 1 & 2 */
#define CEA861_AUDIO_INFOFRAME_DB1CT_MP3 (4<<4) /**< MPEG1 Layer 3 */
#define CEA861_AUDIO_INFOFRAME_DB1CT_MPEG2_MULTICH (5<<4) /**< MPEG2 Multichannel */
#define CEA861_AUDIO_INFOFRAME_DB1CT_AAC (6<<4) /**< AAC */
#define CEA861_AUDIO_INFOFRAME_DB1CT_DTS (7<<4) /**< DTS */
#define CEA861_AUDIO_INFOFRAME_DB1CT_ATRAC (8<<4) /**< ATRAC */
#define CEA861_AUDIO_INFOFRAME_DB1CT_ONEBIT (9<<4) /**< One Bit Audio */
#define CEA861_AUDIO_INFOFRAME_DB1CT_DOLBY_DIG_PLUS (10<<4) /**< Dolby Digital + */
#define CEA861_AUDIO_INFOFRAME_DB1CT_DTS_HD (11<<4) /**< DTS-HD */
#define CEA861_AUDIO_INFOFRAME_DB1CT_MAT (12<<4) /**< MAT (MLP) */
#define CEA861_AUDIO_INFOFRAME_DB1CT_DST (13<<4) /**< DST */
#define CEA861_AUDIO_INFOFRAME_DB1CT_WMA_PRO (14<<4) /**< WMA Pro */
#define CEA861_AUDIO_INFOFRAME_DB2SF (7<<2) /**< mask - sample frequency */
#define CEA861_AUDIO_INFOFRAME_DB2SF_FROM_STREAM (0<<2) /**< refer to stream */
#define CEA861_AUDIO_INFOFRAME_DB2SF_32000 (1<<2) /**< 32kHz */
#define CEA861_AUDIO_INFOFRAME_DB2SF_44100 (2<<2) /**< 44.1kHz */
#define CEA861_AUDIO_INFOFRAME_DB2SF_48000 (3<<2) /**< 48kHz */
#define CEA861_AUDIO_INFOFRAME_DB2SF_88200 (4<<2) /**< 88.2kHz */
#define CEA861_AUDIO_INFOFRAME_DB2SF_96000 (5<<2) /**< 96kHz */
#define CEA861_AUDIO_INFOFRAME_DB2SF_176400 (6<<2) /**< 176.4kHz */
#define CEA861_AUDIO_INFOFRAME_DB2SF_192000 (7<<2) /**< 192kHz */
#define CEA861_AUDIO_INFOFRAME_DB2SS (3<<0) /**< mask - sample size */
#define CEA861_AUDIO_INFOFRAME_DB2SS_FROM_STREAM (0<<0) /**< refer to stream */
#define CEA861_AUDIO_INFOFRAME_DB2SS_16BIT (1<<0) /**< 16 bits */
#define CEA861_AUDIO_INFOFRAME_DB2SS_20BIT (2<<0) /**< 20 bits */
#define CEA861_AUDIO_INFOFRAME_DB2SS_24BIT (3<<0) /**< 24 bits */
#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH (1<<7) /**< mask - inhibit downmixing */
#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PERMITTED (0<<7) /**< stereo downmix permitted */
#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED (1<<7) /**< stereo downmis prohibited */
#define CEA861_AUDIO_INFOFRAME_DB5_LSV (0xf<<3) /**< mask - level-shift values */
/** \} */
/**
* \defgroup MIDI_Interface Constants for MIDI v1.0
* Constants for MIDI v1.0.
* \{
*/
#define MIDI_CHANNELS 16 /**< Number of channels per port/cable. */
#define MIDI_GM_DRUM_CHANNEL (10-1) /**< Channel number for GM drums. */
/** \} */
/**
* \defgroup MIDI_Commands MIDI Commands
* MIDI command codes.
* \{
*/
#define MIDI_CMD_NOTE_OFF 0x80 /**< note off */
#define MIDI_CMD_NOTE_ON 0x90 /**< note on */
#define MIDI_CMD_NOTE_PRESSURE 0xa0 /**< key pressure */
#define MIDI_CMD_CONTROL 0xb0 /**< control change */
#define MIDI_CMD_PGM_CHANGE 0xc0 /**< program change */
#define MIDI_CMD_CHANNEL_PRESSURE 0xd0 /**< channel pressure */
#define MIDI_CMD_BENDER 0xe0 /**< pitch bender */
#define MIDI_CMD_COMMON_SYSEX 0xf0 /**< sysex (system exclusive) begin */
#define MIDI_CMD_COMMON_MTC_QUARTER 0xf1 /**< MTC quarter frame */
#define MIDI_CMD_COMMON_SONG_POS 0xf2 /**< song position */
#define MIDI_CMD_COMMON_SONG_SELECT 0xf3 /**< song select */
#define MIDI_CMD_COMMON_TUNE_REQUEST 0xf6 /**< tune request */
#define MIDI_CMD_COMMON_SYSEX_END 0xf7 /**< end of sysex */
#define MIDI_CMD_COMMON_CLOCK 0xf8 /**< clock */
#define MIDI_CMD_COMMON_START 0xfa /**< start */
#define MIDI_CMD_COMMON_CONTINUE 0xfb /**< continue */
#define MIDI_CMD_COMMON_STOP 0xfc /**< stop */
#define MIDI_CMD_COMMON_SENSING 0xfe /**< active sensing */
#define MIDI_CMD_COMMON_RESET 0xff /**< reset */
/** \} */
/**
* \defgroup MIDI_Controllers MIDI Controllers
* MIDI controller numbers.
* \{
*/
#define MIDI_CTL_MSB_BANK 0x00 /**< Bank selection */
#define MIDI_CTL_MSB_MODWHEEL 0x01 /**< Modulation */
#define MIDI_CTL_MSB_BREATH 0x02 /**< Breath */
#define MIDI_CTL_MSB_FOOT 0x04 /**< Foot */
#define MIDI_CTL_MSB_PORTAMENTO_TIME 0x05 /**< Portamento time */
#define MIDI_CTL_MSB_DATA_ENTRY 0x06 /**< Data entry */
#define MIDI_CTL_MSB_MAIN_VOLUME 0x07 /**< Main volume */
#define MIDI_CTL_MSB_BALANCE 0x08 /**< Balance */
#define MIDI_CTL_MSB_PAN 0x0a /**< Panpot */
#define MIDI_CTL_MSB_EXPRESSION 0x0b /**< Expression */
#define MIDI_CTL_MSB_EFFECT1 0x0c /**< Effect1 */
#define MIDI_CTL_MSB_EFFECT2 0x0d /**< Effect2 */
#define MIDI_CTL_MSB_GENERAL_PURPOSE1 0x10 /**< General purpose 1 */
#define MIDI_CTL_MSB_GENERAL_PURPOSE2 0x11 /**< General purpose 2 */
#define MIDI_CTL_MSB_GENERAL_PURPOSE3 0x12 /**< General purpose 3 */
#define MIDI_CTL_MSB_GENERAL_PURPOSE4 0x13 /**< General purpose 4 */
#define MIDI_CTL_LSB_BANK 0x20 /**< Bank selection */
#define MIDI_CTL_LSB_MODWHEEL 0x21 /**< Modulation */
#define MIDI_CTL_LSB_BREATH 0x22 /**< Breath */
#define MIDI_CTL_LSB_FOOT 0x24 /**< Foot */
#define MIDI_CTL_LSB_PORTAMENTO_TIME 0x25 /**< Portamento time */
#define MIDI_CTL_LSB_DATA_ENTRY 0x26 /**< Data entry */
#define MIDI_CTL_LSB_MAIN_VOLUME 0x27 /**< Main volume */
#define MIDI_CTL_LSB_BALANCE 0x28 /**< Balance */
#define MIDI_CTL_LSB_PAN 0x2a /**< Panpot */
#define MIDI_CTL_LSB_EXPRESSION 0x2b /**< Expression */
#define MIDI_CTL_LSB_EFFECT1 0x2c /**< Effect1 */
#define MIDI_CTL_LSB_EFFECT2 0x2d /**< Effect2 */
#define MIDI_CTL_LSB_GENERAL_PURPOSE1 0x30 /**< General purpose 1 */
#define MIDI_CTL_LSB_GENERAL_PURPOSE2 0x31 /**< General purpose 2 */
#define MIDI_CTL_LSB_GENERAL_PURPOSE3 0x32 /**< General purpose 3 */
#define MIDI_CTL_LSB_GENERAL_PURPOSE4 0x33 /**< General purpose 4 */
#define MIDI_CTL_SUSTAIN 0x40 /**< Sustain pedal */
#define MIDI_CTL_PORTAMENTO 0x41 /**< Portamento */
#define MIDI_CTL_SOSTENUTO 0x42 /**< Sostenuto */
#define MIDI_CTL_SUSTENUTO 0x42 /**< Sostenuto (a typo in the older version) */
#define MIDI_CTL_SOFT_PEDAL 0x43 /**< Soft pedal */
#define MIDI_CTL_LEGATO_FOOTSWITCH 0x44 /**< Legato foot switch */
#define MIDI_CTL_HOLD2 0x45 /**< Hold2 */
#define MIDI_CTL_SC1_SOUND_VARIATION 0x46 /**< SC1 Sound Variation */
#define MIDI_CTL_SC2_TIMBRE 0x47 /**< SC2 Timbre */
#define MIDI_CTL_SC3_RELEASE_TIME 0x48 /**< SC3 Release Time */
#define MIDI_CTL_SC4_ATTACK_TIME 0x49 /**< SC4 Attack Time */
#define MIDI_CTL_SC5_BRIGHTNESS 0x4a /**< SC5 Brightness */
#define MIDI_CTL_SC6 0x4b /**< SC6 */
#define MIDI_CTL_SC7 0x4c /**< SC7 */
#define MIDI_CTL_SC8 0x4d /**< SC8 */
#define MIDI_CTL_SC9 0x4e /**< SC9 */
#define MIDI_CTL_SC10 0x4f /**< SC10 */
#define MIDI_CTL_GENERAL_PURPOSE5 0x50 /**< General purpose 5 */
#define MIDI_CTL_GENERAL_PURPOSE6 0x51 /**< General purpose 6 */
#define MIDI_CTL_GENERAL_PURPOSE7 0x52 /**< General purpose 7 */
#define MIDI_CTL_GENERAL_PURPOSE8 0x53 /**< General purpose 8 */
#define MIDI_CTL_PORTAMENTO_CONTROL 0x54 /**< Portamento control */
#define MIDI_CTL_E1_REVERB_DEPTH 0x5b /**< E1 Reverb Depth */
#define MIDI_CTL_E2_TREMOLO_DEPTH 0x5c /**< E2 Tremolo Depth */
#define MIDI_CTL_E3_CHORUS_DEPTH 0x5d /**< E3 Chorus Depth */
#define MIDI_CTL_E4_DETUNE_DEPTH 0x5e /**< E4 Detune Depth */
#define MIDI_CTL_E5_PHASER_DEPTH 0x5f /**< E5 Phaser Depth */
#define MIDI_CTL_DATA_INCREMENT 0x60 /**< Data Increment */
#define MIDI_CTL_DATA_DECREMENT 0x61 /**< Data Decrement */
#define MIDI_CTL_NONREG_PARM_NUM_LSB 0x62 /**< Non-registered parameter number */
#define MIDI_CTL_NONREG_PARM_NUM_MSB 0x63 /**< Non-registered parameter number */
#define MIDI_CTL_REGIST_PARM_NUM_LSB 0x64 /**< Registered parameter number */
#define MIDI_CTL_REGIST_PARM_NUM_MSB 0x65 /**< Registered parameter number */
#define MIDI_CTL_ALL_SOUNDS_OFF 0x78 /**< All sounds off */
#define MIDI_CTL_RESET_CONTROLLERS 0x79 /**< Reset Controllers */
#define MIDI_CTL_LOCAL_CONTROL_SWITCH 0x7a /**< Local control switch */
#define MIDI_CTL_ALL_NOTES_OFF 0x7b /**< All notes off */
#define MIDI_CTL_OMNI_OFF 0x7c /**< Omni off */
#define MIDI_CTL_OMNI_ON 0x7d /**< Omni on */
#define MIDI_CTL_MONO1 0x7e /**< Mono1 */
#define MIDI_CTL_MONO2 0x7f /**< Mono2 */
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_ASOUNDEF_H */

42
include/asoundlib-head.h Normal file
View file

@ -0,0 +1,42 @@
/**
* \file include/asoundlib.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ASOUNDLIB_H
#define __ASOUNDLIB_H
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <time.h>

2
include/asoundlib-tail.h Normal file
View file

@ -0,0 +1,2 @@
#endif /* __ASOUNDLIB_H */

80
include/asoundlib.h Normal file
View file

@ -0,0 +1,80 @@
/**
* \file include/asoundlib.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ASOUNDLIB_H
#define __ASOUNDLIB_H
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <time.h>
#include <sys/endian.h>
#ifndef __BYTE_ORDER
#define __BYTE_ORDER BYTE_ORDER
#endif
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#endif
#ifndef DOC_HIDDEN
#ifndef __GNUC__
#define __inline__ inline
#endif
#endif /* DOC_HIDDEN */
#include <alsa/asoundef.h>
#include <alsa/version.h>
#include <alsa/global.h>
#include <alsa/input.h>
#include <alsa/output.h>
#include <alsa/error.h>
#include <alsa/conf.h>
#include <alsa/pcm.h>
#include <alsa/rawmidi.h>
#include <alsa/ump.h>
#include <alsa/timer.h>
#include <alsa/hwdep.h>
#include <alsa/control.h>
#include <alsa/mixer.h>
#include <alsa/ump_msg.h>
#include <alsa/seq_event.h>
#include <alsa/seq.h>
#include <alsa/seqmid.h>
#include <alsa/seq_midi_event.h>
#endif /* __ASOUNDLIB_H */

44
include/bswap.h Normal file
View file

@ -0,0 +1,44 @@
/*
* ALSA lib - compatibility header for providing byte swapping macros
* Copyright (c) 2016 by Thomas Klausner <wiz@NetBSD.org>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __BSWAP_H
#define __BSWAP_H
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
#include <sys/endian.h>
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#elif defined(__OpenBSD__)
#include <sys/endian.h>
#define bswap_16 swap16
#define bswap_32 swap32
#define bswap_64 swap64
#elif defined (__sun)
#include <sys/byteorder.h>
#define bswap_16 BSWAP_16
#define bswap_32 BSWAP_32
#define bswap_64 BSWAP_64
#else
#include <byteswap.h>
#endif
#endif

247
include/conf.h Normal file
View file

@ -0,0 +1,247 @@
/**
* \file include/conf.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_CONF_H
#define __ALSA_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Configuration Configuration Interface
* The configuration functions and types allow you to read, enumerate,
* modify and write the contents of ALSA configuration files.
* \{
*/
/** \brief \c dlsym version for the config evaluate callback. */
#define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
/** \brief \c dlsym version for the config hook callback. */
#define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001
/** \brief Configuration node type. */
typedef enum _snd_config_type {
/** Integer number. */
SND_CONFIG_TYPE_INTEGER,
/** 64-bit integer number. */
SND_CONFIG_TYPE_INTEGER64,
/** Real number. */
SND_CONFIG_TYPE_REAL,
/** Character string. */
SND_CONFIG_TYPE_STRING,
/** Pointer (runtime only, cannot be saved). */
SND_CONFIG_TYPE_POINTER,
/** Compound node. */
SND_CONFIG_TYPE_COMPOUND = 1024
} snd_config_type_t;
/**
* \brief Internal structure for a configuration node object.
*
* The ALSA library uses a pointer to this structure as a handle to a
* configuration node. Applications don't access its contents directly.
*/
typedef struct _snd_config snd_config_t;
/**
* \brief Type for a configuration compound iterator.
*
* The ALSA library uses this pointer type as a handle to a configuration
* compound iterator. Applications don't directly access the contents of
* the structure pointed to by this type.
*/
typedef struct _snd_config_iterator *snd_config_iterator_t;
/**
* \brief Internal structure for a configuration private update object.
*
* The ALSA library uses this structure to save private update information.
*/
typedef struct _snd_config_update snd_config_update_t;
extern snd_config_t *snd_config;
const char *snd_config_topdir(void);
int snd_config_top(snd_config_t **config);
int snd_config_load(snd_config_t *config, snd_input_t *in);
int snd_config_load_string(snd_config_t **config, const char *s, size_t size);
int snd_config_load_override(snd_config_t *config, snd_input_t *in);
int snd_config_save(snd_config_t *config, snd_output_t *out);
int snd_config_update(void);
int snd_config_update_r(snd_config_t **top, snd_config_update_t **update, const char *path);
int snd_config_update_free(snd_config_update_t *update);
int snd_config_update_free_global(void);
int snd_config_update_ref(snd_config_t **top);
void snd_config_ref(snd_config_t *top);
void snd_config_unref(snd_config_t *top);
int snd_config_search(snd_config_t *config, const char *key,
snd_config_t **result);
int snd_config_searchv(snd_config_t *config,
snd_config_t **result, ...);
int snd_config_search_definition(snd_config_t *config,
const char *base, const char *key,
snd_config_t **result);
/**
* \brief custom expansion callback
* \param[out] dst The function puts the handle to the new configuration
* node at the address specified by \a dst.
* \param[in] s string the string to be expanded
* \param[in] private_data Handle to the \c private_data node.
* \return A non-negative value if successful, otherwise a negative error code.
*
* Use a function of this type to define a custom expansion
*/
typedef int (*snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data);
int snd_config_expand_custom(snd_config_t *config, snd_config_t *root,
snd_config_expand_fcn_t fcn, void *private_data,
snd_config_t **result);
int snd_config_expand(snd_config_t *config, snd_config_t *root,
const char *args, snd_config_t *private_data,
snd_config_t **result);
int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
snd_config_t *private_data, snd_config_t **result);
int snd_config_evaluate_string(snd_config_t **dst, const char *s,
snd_config_expand_fcn_t fcn, void *private_data);
int snd_config_add(snd_config_t *config, snd_config_t *child);
int snd_config_add_before(snd_config_t *before, snd_config_t *child);
int snd_config_add_after(snd_config_t *after, snd_config_t *child);
int snd_config_remove(snd_config_t *config);
int snd_config_delete(snd_config_t *config);
int snd_config_delete_compound_members(const snd_config_t *config);
int snd_config_copy(snd_config_t **dst, snd_config_t *src);
int snd_config_substitute(snd_config_t *dst, snd_config_t *src);
int snd_config_merge(snd_config_t *dst, snd_config_t *src, int override);
int snd_config_make(snd_config_t **config, const char *key,
snd_config_type_t type);
int snd_config_make_integer(snd_config_t **config, const char *key);
int snd_config_make_integer64(snd_config_t **config, const char *key);
int snd_config_make_real(snd_config_t **config, const char *key);
int snd_config_make_string(snd_config_t **config, const char *key);
int snd_config_make_pointer(snd_config_t **config, const char *key);
int snd_config_make_compound(snd_config_t **config, const char *key, int join);
int snd_config_make_path(snd_config_t **config, snd_config_t *root, const char *key,
int join, int override);
int snd_config_imake_integer(snd_config_t **config, const char *key, const long value);
int snd_config_imake_integer64(snd_config_t **config, const char *key, const long long value);
int snd_config_imake_real(snd_config_t **config, const char *key, const double value);
int snd_config_imake_string(snd_config_t **config, const char *key, const char *ascii);
int snd_config_imake_safe_string(snd_config_t **config, const char *key, const char *ascii);
int snd_config_imake_pointer(snd_config_t **config, const char *key, const void *ptr);
snd_config_type_t snd_config_get_type(const snd_config_t *config);
int snd_config_is_array(const snd_config_t *config);
int snd_config_is_empty(const snd_config_t *config);
int snd_config_set_id(snd_config_t *config, const char *id);
int snd_config_set_integer(snd_config_t *config, long value);
int snd_config_set_integer64(snd_config_t *config, long long value);
int snd_config_set_real(snd_config_t *config, double value);
int snd_config_set_string(snd_config_t *config, const char *value);
int snd_config_set_ascii(snd_config_t *config, const char *ascii);
int snd_config_set_pointer(snd_config_t *config, const void *ptr);
int snd_config_get_id(const snd_config_t *config, const char **value);
int snd_config_get_integer(const snd_config_t *config, long *value);
int snd_config_get_integer64(const snd_config_t *config, long long *value);
int snd_config_get_real(const snd_config_t *config, double *value);
int snd_config_get_ireal(const snd_config_t *config, double *value);
int snd_config_get_string(const snd_config_t *config, const char **value);
int snd_config_get_ascii(const snd_config_t *config, char **value);
int snd_config_get_pointer(const snd_config_t *config, const void **value);
int snd_config_test_id(const snd_config_t *config, const char *id);
snd_config_iterator_t snd_config_iterator_first(const snd_config_t *node);
snd_config_iterator_t snd_config_iterator_next(const snd_config_iterator_t iterator);
snd_config_iterator_t snd_config_iterator_end(const snd_config_t *node);
snd_config_t *snd_config_iterator_entry(const snd_config_iterator_t iterator);
/**
* \brief Helper macro to iterate over the children of a compound node.
* \param[in,out] pos Iterator variable for the current node.
* \param[in,out] next Temporary iterator variable for the next node.
* \param[in] node Handle to the compound configuration node to iterate over.
*
* Use this macro like a \c for statement, e.g.:
* \code
* snd_config_iterator_t pos, next;
* snd_config_for_each(pos, next, node) {
* snd_config_t *entry = snd_config_iterator_entry(pos);
* ...
* }
* \endcode
*
* This macro allows deleting or removing the current node.
*/
#define snd_config_for_each(pos, next, node) \
for (pos = snd_config_iterator_first(node), next = snd_config_iterator_next(pos); pos != snd_config_iterator_end(node); pos = next, next = snd_config_iterator_next(pos))
/* Misc functions */
int snd_config_get_bool_ascii(const char *ascii);
int snd_config_get_bool(const snd_config_t *conf);
int snd_config_get_card(const snd_config_t *conf);
int snd_config_get_ctl_iface_ascii(const char *ascii);
int snd_config_get_ctl_iface(const snd_config_t *conf);
/* Names functions */
/**
* Device-name list element
*/
typedef struct snd_devname snd_devname_t;
/**
* Device-name list element (definition)
*/
struct snd_devname {
char *name; /**< Device name string */
char *comment; /**< Comments */
snd_devname_t *next; /**< Next pointer */
};
int snd_names_list(const char *iface, snd_devname_t **list);
void snd_names_list_free(snd_devname_t *list);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_CONF_H */

324
include/config.h Normal file
View file

@ -0,0 +1,324 @@
/* include/config.h. Generated from config.h.in by configure. */
/* include/config.h.in. Generated from configure.ac by autoheader. */
/* Directory with aload* device files */
#define ALOAD_DEVICE_DIRECTORY "/dev/"
/* directory containing ALSA configuration database */
#define ALSA_CONFIG_DIR "/vendor/etc/alsa"
/* Enable assert at error message handler */
/* #undef ALSA_DEBUG_ASSERT */
/* Directory with ALSA device files */
#define ALSA_DEVICE_DIRECTORY "/dev/snd/"
/* directory containing pkgconfig files */
#define ALSA_PKGCONF_DIR "/usr/lib/pkgconfig"
/* directory containing ALSA add-on modules */
#define ALSA_PLUGIN_DIR "/vendor/etc/alsa/lib/alsa-lib"
/* Build hwdep component */
#define BUILD_HWDEP "1"
/* Build mixer component */
#define BUILD_MIXER "1"
/* Build PCM component */
#define BUILD_PCM "1"
/* Build PCM adpcm plugin */
#define BUILD_PCM_PLUGIN_ADPCM "1"
/* Build PCM alaw plugin */
#define BUILD_PCM_PLUGIN_ALAW "1"
/* Build PCM iec958 plugin */
#define BUILD_PCM_PLUGIN_IEC958 "1"
/* Build PCM lfloat plugin */
#define BUILD_PCM_PLUGIN_LFLOAT "1"
/* Build PCM mmap-emul plugin */
#define BUILD_PCM_PLUGIN_MMAP_EMUL "1"
/* Build PCM mulaw plugin */
#define BUILD_PCM_PLUGIN_MULAW "1"
/* Build PCM rate plugin */
#define BUILD_PCM_PLUGIN_RATE "1"
/* Build PCM route plugin */
#define BUILD_PCM_PLUGIN_ROUTE "1"
/* Build raw MIDI component */
#define BUILD_RAWMIDI "1"
/* Build sequencer component */
#define BUILD_SEQ "1"
/* Build DSP Topology component */
#define BUILD_TOPOLOGY "1"
/* Build UCM component */
#define BUILD_UCM "1"
/* Define to 0 if __attribute__((symver)) is not supported */
#define HAVE_ATTRIBUTE_SYMVER 0
/* Have clock gettime */
/* #undef HAVE_CLOCK_GETTIME */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the `eaccess' function. */
/* #undef HAVE_EACCESS */
/* Define to 1 if you have the <endian.h> header file. */
#define HAVE_ENDIAN_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Have LFS */
#define HAVE_LFS 1
/* Have libdl */
#define HAVE_LIBDL 1
/* Have libpthread */
/* #undef HAVE_LIBPTHREAD */
/* Define to 1 if you have the `resmgr' library (-lresmgr). */
/* #undef HAVE_LIBRESMGR */
/* Have librt */
/* #undef HAVE_LIBRT */
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the <minix/config.h> header file. */
/* #undef HAVE_MINIX_CONFIG_H */
/* MMX technology is enabled */
/* #undef HAVE_MMX */
/* Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE */
/* #undef HAVE_PTHREAD_MUTEX_RECURSIVE */
/* Avoid calculation in float */
/* #undef HAVE_SOFT_FLOAT */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/endian.h> header file. */
#define HAVE_SYS_ENDIAN_H 1
/* Define to 1 if you have the <sys/shm.h> header file. */
#define HAVE_SYS_SHM_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `uselocale' function. */
#define HAVE_USELOCALE 1
/* Define to 1 if you have the <wchar.h> header file. */
#define HAVE_WCHAR_H 1
/* Enable use of wordexp */
/* #undef HAVE_WORDEXP */
/* Define to 1 if compiler supports __thread */
#define HAVE___THREAD 1
/* Lockless dmix as default */
/* #undef LOCKLESS_DMIX_DEFAULT */
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* No assert debug */
/* #undef NDEBUG */
/* Name of package */
#define PACKAGE "alsa-lib"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "alsa-lib"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "alsa-lib 1.2.14"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "alsa-lib"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.2.14"
/* Max number of cards */
#define SND_MAX_CARDS 32
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#define STDC_HEADERS 1
/* Support /dev/aload* access for auto-loading */
/* #undef SUPPORT_ALOAD */
/* Support resmgr with alsa-lib */
/* #undef SUPPORT_RESMGR */
/* Disable thread-safe API functions */
/* #undef THREAD_SAFE_API */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. This
macro is obsolete. */
#define TIME_WITH_SYS_TIME 1
/* directory to put tmp socket files */
#define TMPDIR "/tmp"
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# define _DARWIN_C_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable X/Open compliant socket functions that do not require linking
with -lxnet on HP-UX 11.11. */
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
# define _HPUX_ALT_XOPEN_SOCKET_API 1
#endif
/* Identify the host operating system as Minix.
This macro does not affect the system headers' behavior.
A future release of Autoconf may stop defining this macro. */
#ifndef _MINIX
/* # undef _MINIX */
#endif
/* Enable general extensions on NetBSD.
Enable NetBSD compatibility extensions on Minix. */
#ifndef _NETBSD_SOURCE
# define _NETBSD_SOURCE 1
#endif
/* Enable OpenBSD compatibility extensions on NetBSD.
Oddly enough, this does nothing on OpenBSD. */
#ifndef _OPENBSD_SOURCE
# define _OPENBSD_SOURCE 1
#endif
/* Define to 1 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_SOURCE
/* # undef _POSIX_SOURCE */
#endif
/* Define to 2 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_1_SOURCE
/* # undef _POSIX_1_SOURCE */
#endif
/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
# define __STDC_WANT_IEC_60559_BFP_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# define __STDC_WANT_IEC_60559_DFP_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
#endif
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
#ifndef __STDC_WANT_LIB_EXT2__
# define __STDC_WANT_LIB_EXT2__ 1
#endif
/* Enable extensions specified by ISO/IEC 24747:2009. */
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
# define __STDC_WANT_MATH_SPEC_FUNCS__ 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable X/Open extensions. Define to 500 only if necessary
to make mbstate_t available. */
#ifndef _XOPEN_SOURCE
/* # undef _XOPEN_SOURCE */
#endif
/* sound library version string */
#define VERSION "1.2.14"
/* compiled with versioned symbols */
/* #undef VERSIONED_SYMBOLS */
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
/* Toolchain Symbol Prefix */
#define __SYMBOL_PREFIX ""
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif

822
include/control.h Normal file
View file

@ -0,0 +1,822 @@
/**
* \file include/control.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/control.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_CONTROL_H
#define __ALSA_CONTROL_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Control Control Interface
* The control interface.
* See \ref control page for more details.
* \{
*/
/** dlsym version for interface entry callback */
#define SND_CONTROL_DLSYM_VERSION _dlsym_control_001
/** IEC958 structure */
typedef struct snd_aes_iec958 {
unsigned char status[24]; /**< AES/IEC958 channel status bits */
unsigned char subcode[147]; /**< AES/IEC958 subcode bits */
unsigned char pad; /**< nothing */
unsigned char dig_subframe[4]; /**< AES/IEC958 subframe bits */
} snd_aes_iec958_t;
/** \brief CTL card info container.
*
* This type contains meta information about a sound card, such as the index,
* name, longname, etc.
*
* \par Memory management
*
* Before using a snd_ctl_card_info_t object, it must be allocated using
* snd_ctl_card_info_alloca() or snd_ctl_card_info_malloc(). When using the
* latter, it must be freed again using snd_ctl_card_info_free().
*
* A card info object can be zeroed out using snd_ctl_card_info_clear().
*
* A card info object can be copied to another one using
* snd_ctl_card_info_copy().
*
* \par Obtaining the Information
*
* To obtain the card information, it must first be opened using
* snd_ctl_open(), and a snd_ctl_card_info_t container must be
* allocated. Then, the information can be read using
* snd_ctl_card_info_get_card().
*
* Thereafter, the card properties can be read using the
* snd_ctl_card_info_get_*() functions.
*/
typedef struct _snd_ctl_card_info snd_ctl_card_info_t;
/** CTL element identifier container */
typedef struct _snd_ctl_elem_id snd_ctl_elem_id_t;
/** CTL element list container
*
* This is a list of CTL elements. The list contains management
* information (e.g. how many elements the sound card has) as well as
* the element identifiers. All functions which operate on the list
* are named snd_ctl_elem_list_*().
*
* \par Memory management
*
* There are two memory areas to deal with: The list container itself
* and the memory for the element identifiers.
*
* To manage the area for the list container, the following functions
* are used:
*
* - snd_ctl_elem_list_malloc() / snd_ctl_elem_list_free() to allocate
* and free memory on the heap, or
* - snd_ctl_elem_list_alloca() to allocate the memory on the
* stack. This memory is auto-released when the stack is unwound.
*
* To manage the space for the element identifiers, the
* snd_ctl_elem_list_alloc_space() and snd_ctl_elem_list_free_space()
* are used. Allocating the right amount of space can be achieved by
* first obtaining the number of elements and then calling
* snd_ctl_elem_list_alloc_space():
*
* \code
* snd_ctl_elem_list_t* list;
* int count;
*
* // Initialise list
* snd_ctl_elem_list_malloc(&list);
*
* // Get number of elements
* snd_ctl_elem_list(ctl, list);
* count = snd_ctl_elem_list_get_count(list);
*
* // Allocate space for identifiers
* snd_ctl_elem_list_alloc_space(list, count);
*
* // Get identifiers
* snd_ctl_elem_list(ctl, list); // yes, this is same as above :)
*
* // Do something useful with the list...
*
* // Cleanup
* snd_ctl_elem_list_free_space(list);
* snd_ctl_elem_list_free(list);
* \endcode
*
*
* \par The Elements
*
* The elements in the list are accessed using an index. This index is
* the location in the list; Don't confuse it with the 'index' of the
* element identifier. For example:
*
* \code
* snd_ctl_elem_list_t list;
* unsigned int element_index;
*
* // Allocate space, fill list ...
*
* element_index = snd_ctl_elem_list_get_index(&list, 2);
* \endcode
*
* This will access the 3rd element in the list (index=2) and get the
* elements index from the driver (which might be 13, for example).
*/
typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t;
/** CTL element info container */
typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t;
/** CTL element value container.
*
* Contains the value(s) (i.e. members) of a single element. All
* values of a given element are of the same type.
*
* \par Memory management
*
* To access a value, a snd_ctl_elem_value_t must be allocated using
* snd_ctl_elem_value_alloca() or snd_ctl_elem_value_malloc(). When
* using the latter, it must be freed again using
* snd_ctl_elem_value_free().
*
* A value object can be zeroed out using snd_ctl_elem_value_clear().
*
* A value object can be copied to another one using
* snd_ctl_elem_value_copy().
*
* \par Identifier
*
* Then, the ID must be filled. It is sufficient to fill only the
* numid, if known. Otherwise, interface type, device, subdevice,
* name, index must all be given. The following functions can be used
* to fill the ID:
*
* - snd_ctl_elem_value_set_id(): Set the ID. Requires an
* snd_ctl_elem_id_t object.
* - snd_ctl_elem_value_set_numid(): Set the numid.
* - Or use all of the following:
*
* - snd_ctl_elem_value_set_interface()
* - snd_ctl_elem_value_set_device()
* - snd_ctl_elem_value_set_subdevice()
* - snd_ctl_elem_value_set_name()
* - snd_ctl_elem_value_set_index()
*
* When communicating with the driver (snd_ctl_elem_read(),
* snd_ctl_elem_write()), and the numid was given, the interface,
* device, ... are filled (even if you set the before). When the numid
* is unset (i.e. it is 0), it is filled.
*
* \par Communicating with the driver
*
* After the value container was created and filled with the ID of the
* desired element, the value(s) can be fetched from the driver (and
* thus from the hardware) or written to the driver.
*
* To fetch a value, use snd_ctl_elem_read(). Thereafter, use the
* snd_ctl_elem_value_get_*() functions to obtain the actual value.
*
* To write a new value, first use a snd_ctl_elem_value_set_*() to set
* it, then call snd_ctl_elem_write() to write it to the driver.
*/
typedef struct _snd_ctl_elem_value snd_ctl_elem_value_t;
/** CTL event container */
typedef struct _snd_ctl_event snd_ctl_event_t;
/** CTL element type */
typedef enum _snd_ctl_elem_type {
/** Invalid type */
SND_CTL_ELEM_TYPE_NONE = 0,
/** Boolean contents */
SND_CTL_ELEM_TYPE_BOOLEAN,
/** Integer contents */
SND_CTL_ELEM_TYPE_INTEGER,
/** Enumerated contents */
SND_CTL_ELEM_TYPE_ENUMERATED,
/** Bytes contents */
SND_CTL_ELEM_TYPE_BYTES,
/** IEC958 (S/PDIF) setting content */
SND_CTL_ELEM_TYPE_IEC958,
/** 64-bit integer contents */
SND_CTL_ELEM_TYPE_INTEGER64,
SND_CTL_ELEM_TYPE_LAST = SND_CTL_ELEM_TYPE_INTEGER64
} snd_ctl_elem_type_t;
/** CTL related interface */
typedef enum _snd_ctl_elem_iface {
/** Card level */
SND_CTL_ELEM_IFACE_CARD = 0,
/** Hardware dependent device */
SND_CTL_ELEM_IFACE_HWDEP,
/** Mixer */
SND_CTL_ELEM_IFACE_MIXER,
/** PCM */
SND_CTL_ELEM_IFACE_PCM,
/** RawMidi */
SND_CTL_ELEM_IFACE_RAWMIDI,
/** Timer */
SND_CTL_ELEM_IFACE_TIMER,
/** Sequencer */
SND_CTL_ELEM_IFACE_SEQUENCER,
SND_CTL_ELEM_IFACE_LAST = SND_CTL_ELEM_IFACE_SEQUENCER
} snd_ctl_elem_iface_t;
/** Event class */
typedef enum _snd_ctl_event_type {
/** Elements related event */
SND_CTL_EVENT_ELEM = 0,
SND_CTL_EVENT_LAST = SND_CTL_EVENT_ELEM
}snd_ctl_event_type_t;
/** Element has been removed (Warning: test this first and if set don't
* test the other masks) \hideinitializer */
#define SND_CTL_EVENT_MASK_REMOVE (~0U)
/** Element value has been changed \hideinitializer */
#define SND_CTL_EVENT_MASK_VALUE (1<<0)
/** Element info has been changed \hideinitializer */
#define SND_CTL_EVENT_MASK_INFO (1<<1)
/** Element has been added \hideinitializer */
#define SND_CTL_EVENT_MASK_ADD (1<<2)
/** Element's TLV value has been changed \hideinitializer */
#define SND_CTL_EVENT_MASK_TLV (1<<3)
/** CTL name helper */
#define SND_CTL_NAME_NONE ""
/** CTL name helper */
#define SND_CTL_NAME_PLAYBACK "Playback "
/** CTL name helper */
#define SND_CTL_NAME_CAPTURE "Capture "
/** CTL name helper */
#define SND_CTL_NAME_IEC958_NONE ""
/** CTL name helper */
#define SND_CTL_NAME_IEC958_SWITCH "Switch"
/** CTL name helper */
#define SND_CTL_NAME_IEC958_VOLUME "Volume"
/** CTL name helper */
#define SND_CTL_NAME_IEC958_DEFAULT "Default"
/** CTL name helper */
#define SND_CTL_NAME_IEC958_MASK "Mask"
/** CTL name helper */
#define SND_CTL_NAME_IEC958_CON_MASK "Con Mask"
/** CTL name helper */
#define SND_CTL_NAME_IEC958_PRO_MASK "Pro Mask"
/** CTL name helper */
#define SND_CTL_NAME_IEC958_PCM_STREAM "PCM Stream"
/** Element name for IEC958 (S/PDIF) */
#define SND_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SND_CTL_NAME_##direction SND_CTL_NAME_IEC958_##what
/** Mask for the major Power State identifier */
#define SND_CTL_POWER_MASK 0xff00
/** ACPI/PCI Power State D0 */
#define SND_CTL_POWER_D0 0x0000
/** ACPI/PCI Power State D1 */
#define SND_CTL_POWER_D1 0x0100
/** ACPI/PCI Power State D2 */
#define SND_CTL_POWER_D2 0x0200
/** ACPI/PCI Power State D3 */
#define SND_CTL_POWER_D3 0x0300
/** ACPI/PCI Power State D3hot */
#define SND_CTL_POWER_D3hot (SND_CTL_POWER_D3|0x0000)
/** ACPI/PCI Power State D3cold */
#define SND_CTL_POWER_D3cold (SND_CTL_POWER_D3|0x0001)
/** TLV type - Container */
#define SND_CTL_TLVT_CONTAINER 0x0000
/** TLV type - basic dB scale */
#define SND_CTL_TLVT_DB_SCALE 0x0001
/** TLV type - linear volume */
#define SND_CTL_TLVT_DB_LINEAR 0x0002
/** TLV type - dB range container */
#define SND_CTL_TLVT_DB_RANGE 0x0003
/** TLV type - dB scale specified by min/max values */
#define SND_CTL_TLVT_DB_MINMAX 0x0004
/** TLV type - dB scale specified by min/max values (with mute) */
#define SND_CTL_TLVT_DB_MINMAX_MUTE 0x0005
/** Mute state */
#define SND_CTL_TLV_DB_GAIN_MUTE -9999999
/** TLV type - fixed channel map positions */
#define SND_CTL_TLVT_CHMAP_FIXED 0x00101
/** TLV type - freely swappable channel map positions */
#define SND_CTL_TLVT_CHMAP_VAR 0x00102
/** TLV type - pair-wise swappable channel map positions */
#define SND_CTL_TLVT_CHMAP_PAIRED 0x00103
/** CTL type */
typedef enum _snd_ctl_type {
/** Kernel level CTL */
SND_CTL_TYPE_HW,
/** Shared memory client CTL */
SND_CTL_TYPE_SHM,
/** INET client CTL (not yet implemented) */
SND_CTL_TYPE_INET,
/** External control plugin */
SND_CTL_TYPE_EXT,
/** Control functionality remapping */
SND_CTL_TYPE_REMAP,
} snd_ctl_type_t;
/** Non blocking mode (flag for open mode) \hideinitializer */
#define SND_CTL_NONBLOCK 0x0001
/** Async notification (flag for open mode) \hideinitializer */
#define SND_CTL_ASYNC 0x0002
/** Read only (flag for open mode) \hideinitializer */
#define SND_CTL_READONLY 0x0004
/** Return EINTR instead blocking (flag for open mode) \hideinitializer */
#define SND_CTL_EINTR 0x0080
/** CTL handle */
typedef struct _snd_ctl snd_ctl_t;
/** Don't destroy the ctl handle when close */
#define SND_SCTL_NOFREE 0x0001
/** SCTL type */
typedef struct _snd_sctl snd_sctl_t;
int snd_card_load(int card);
int snd_card_next(int *card);
int snd_card_get_index(const char *name);
int snd_card_get_name(int card, char **name);
int snd_card_get_longname(int card, char **name);
int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode);
int snd_ctl_open_lconf(snd_ctl_t **ctl, const char *name, int mode, snd_config_t *lconf);
int snd_ctl_open_fallback(snd_ctl_t **ctl, snd_config_t *root, const char *name, const char *orig_name, int mode);
int snd_ctl_close(snd_ctl_t *ctl);
int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
static __inline__ int snd_ctl_abort(snd_ctl_t *ctl) { return snd_ctl_nonblock(ctl, 2); }
int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
snd_async_callback_t callback, void *private_data);
snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler);
int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl);
int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space);
int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe);
int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info);
int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list);
int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info);
int snd_ctl_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *data);
int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *data);
int snd_ctl_elem_lock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
int snd_ctl_elem_unlock(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
int snd_ctl_elem_tlv_read(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
unsigned int *tlv, unsigned int tlv_size);
int snd_ctl_elem_tlv_write(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
const unsigned int *tlv);
int snd_ctl_elem_tlv_command(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
const unsigned int *tlv);
#ifdef __ALSA_HWDEP_H
int snd_ctl_hwdep_next_device(snd_ctl_t *ctl, int * device);
int snd_ctl_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info);
#endif
#ifdef __ALSA_PCM_H
int snd_ctl_pcm_next_device(snd_ctl_t *ctl, int *device);
int snd_ctl_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info);
int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev);
#endif
#ifdef __ALSA_RAWMIDI_H
int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);
int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);
int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);
#endif
#ifdef __ALSA_UMP_H
int snd_ctl_ump_next_device(snd_ctl_t *ctl, int *device);
int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info);
int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info);
#endif
int snd_ctl_set_power_state(snd_ctl_t *ctl, unsigned int state);
int snd_ctl_get_power_state(snd_ctl_t *ctl, unsigned int *state);
int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event);
int snd_ctl_wait(snd_ctl_t *ctl, int timeout);
const char *snd_ctl_name(snd_ctl_t *ctl);
snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type);
const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface);
const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);
unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj);
unsigned int snd_ctl_event_elem_get_numid(const snd_ctl_event_t *obj);
void snd_ctl_event_elem_get_id(const snd_ctl_event_t *obj, snd_ctl_elem_id_t *ptr);
snd_ctl_elem_iface_t snd_ctl_event_elem_get_interface(const snd_ctl_event_t *obj);
unsigned int snd_ctl_event_elem_get_device(const snd_ctl_event_t *obj);
unsigned int snd_ctl_event_elem_get_subdevice(const snd_ctl_event_t *obj);
const char *snd_ctl_event_elem_get_name(const snd_ctl_event_t *obj);
unsigned int snd_ctl_event_elem_get_index(const snd_ctl_event_t *obj);
int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries);
void snd_ctl_elem_list_free_space(snd_ctl_elem_list_t *obj);
char *snd_ctl_ascii_elem_id_get(snd_ctl_elem_id_t *id);
int snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str);
int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
snd_ctl_elem_value_t *dst,
snd_ctl_elem_info_t *info,
const char *value);
size_t snd_ctl_elem_id_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_elem_id_t using standard alloca
* \param ptr returned pointer
*/
#define snd_ctl_elem_id_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_id)
int snd_ctl_elem_id_malloc(snd_ctl_elem_id_t **ptr);
void snd_ctl_elem_id_free(snd_ctl_elem_id_t *obj);
void snd_ctl_elem_id_clear(snd_ctl_elem_id_t *obj);
void snd_ctl_elem_id_copy(snd_ctl_elem_id_t *dst, const snd_ctl_elem_id_t *src);
int snd_ctl_elem_id_compare_numid(const snd_ctl_elem_id_t *id1, const snd_ctl_elem_id_t *id2);
int snd_ctl_elem_id_compare_set(const snd_ctl_elem_id_t *id1, const snd_ctl_elem_id_t *id2);
unsigned int snd_ctl_elem_id_get_numid(const snd_ctl_elem_id_t *obj);
snd_ctl_elem_iface_t snd_ctl_elem_id_get_interface(const snd_ctl_elem_id_t *obj);
unsigned int snd_ctl_elem_id_get_device(const snd_ctl_elem_id_t *obj);
unsigned int snd_ctl_elem_id_get_subdevice(const snd_ctl_elem_id_t *obj);
const char *snd_ctl_elem_id_get_name(const snd_ctl_elem_id_t *obj);
unsigned int snd_ctl_elem_id_get_index(const snd_ctl_elem_id_t *obj);
void snd_ctl_elem_id_set_numid(snd_ctl_elem_id_t *obj, unsigned int val);
void snd_ctl_elem_id_set_interface(snd_ctl_elem_id_t *obj, snd_ctl_elem_iface_t val);
void snd_ctl_elem_id_set_device(snd_ctl_elem_id_t *obj, unsigned int val);
void snd_ctl_elem_id_set_subdevice(snd_ctl_elem_id_t *obj, unsigned int val);
void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val);
void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val);
size_t snd_ctl_card_info_sizeof(void);
/** \hideinitializer
* \brief Allocate an invalid #snd_ctl_card_info_t on the stack.
*
* Allocate space for a card info object on the stack. The allocated
* memory need not be freed, because it is on the stack.
*
* See snd_ctl_card_info_t for details.
*
* \param ptr Pointer to a snd_ctl_elem_value_t pointer. The address
* of the allocated space will returned here.
*/
#define snd_ctl_card_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_card_info)
int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr);
void snd_ctl_card_info_free(snd_ctl_card_info_t *obj);
void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj);
void snd_ctl_card_info_copy(snd_ctl_card_info_t *dst, const snd_ctl_card_info_t *src);
int snd_ctl_card_info_get_card(const snd_ctl_card_info_t *obj);
const char *snd_ctl_card_info_get_id(const snd_ctl_card_info_t *obj);
const char *snd_ctl_card_info_get_driver(const snd_ctl_card_info_t *obj);
const char *snd_ctl_card_info_get_name(const snd_ctl_card_info_t *obj);
const char *snd_ctl_card_info_get_longname(const snd_ctl_card_info_t *obj);
const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj);
const char *snd_ctl_card_info_get_components(const snd_ctl_card_info_t *obj);
size_t snd_ctl_event_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_event_t using standard alloca
* \param ptr returned pointer
*/
#define snd_ctl_event_alloca(ptr) __snd_alloca(ptr, snd_ctl_event)
int snd_ctl_event_malloc(snd_ctl_event_t **ptr);
void snd_ctl_event_free(snd_ctl_event_t *obj);
void snd_ctl_event_clear(snd_ctl_event_t *obj);
void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src);
snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj);
size_t snd_ctl_elem_list_sizeof(void);
/** \hideinitializer
*
* \brief Allocate a #snd_ctl_elem_list_t using standard alloca.
*
* The memory is allocated on the stack and will automatically be
* released when the stack unwinds (i.e. no free() is needed).
*
* \param ptr Pointer to allocated memory.
*/
#define snd_ctl_elem_list_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_list)
int snd_ctl_elem_list_malloc(snd_ctl_elem_list_t **ptr);
void snd_ctl_elem_list_free(snd_ctl_elem_list_t *obj);
void snd_ctl_elem_list_clear(snd_ctl_elem_list_t *obj);
void snd_ctl_elem_list_copy(snd_ctl_elem_list_t *dst, const snd_ctl_elem_list_t *src);
void snd_ctl_elem_list_set_offset(snd_ctl_elem_list_t *obj, unsigned int val);
unsigned int snd_ctl_elem_list_get_used(const snd_ctl_elem_list_t *obj);
unsigned int snd_ctl_elem_list_get_count(const snd_ctl_elem_list_t *obj);
void snd_ctl_elem_list_get_id(const snd_ctl_elem_list_t *obj, unsigned int idx, snd_ctl_elem_id_t *ptr);
unsigned int snd_ctl_elem_list_get_numid(const snd_ctl_elem_list_t *obj, unsigned int idx);
snd_ctl_elem_iface_t snd_ctl_elem_list_get_interface(const snd_ctl_elem_list_t *obj, unsigned int idx);
unsigned int snd_ctl_elem_list_get_device(const snd_ctl_elem_list_t *obj, unsigned int idx);
unsigned int snd_ctl_elem_list_get_subdevice(const snd_ctl_elem_list_t *obj, unsigned int idx);
const char *snd_ctl_elem_list_get_name(const snd_ctl_elem_list_t *obj, unsigned int idx);
unsigned int snd_ctl_elem_list_get_index(const snd_ctl_elem_list_t *obj, unsigned int idx);
size_t snd_ctl_elem_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_elem_info_t using standard alloca
* \param ptr returned pointer
*/
#define snd_ctl_elem_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_info)
int snd_ctl_elem_info_malloc(snd_ctl_elem_info_t **ptr);
void snd_ctl_elem_info_free(snd_ctl_elem_info_t *obj);
void snd_ctl_elem_info_clear(snd_ctl_elem_info_t *obj);
void snd_ctl_elem_info_copy(snd_ctl_elem_info_t *dst, const snd_ctl_elem_info_t *src);
snd_ctl_elem_type_t snd_ctl_elem_info_get_type(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_readable(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_writable(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_volatile(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_tlv_readable(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_tlv_writable(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_tlv_commandable(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_is_user(const snd_ctl_elem_info_t *obj);
pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj);
unsigned int snd_ctl_elem_info_get_count(const snd_ctl_elem_info_t *obj);
long snd_ctl_elem_info_get_min(const snd_ctl_elem_info_t *obj);
long snd_ctl_elem_info_get_max(const snd_ctl_elem_info_t *obj);
long snd_ctl_elem_info_get_step(const snd_ctl_elem_info_t *obj);
long long snd_ctl_elem_info_get_min64(const snd_ctl_elem_info_t *obj);
long long snd_ctl_elem_info_get_max64(const snd_ctl_elem_info_t *obj);
long long snd_ctl_elem_info_get_step64(const snd_ctl_elem_info_t *obj);
unsigned int snd_ctl_elem_info_get_items(const snd_ctl_elem_info_t *obj);
void snd_ctl_elem_info_set_item(snd_ctl_elem_info_t *obj, unsigned int val);
const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj);
int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx);
int snd_ctl_elem_info_set_dimension(snd_ctl_elem_info_t *info,
const int dimension[4]);
void snd_ctl_elem_info_get_id(const snd_ctl_elem_info_t *obj, snd_ctl_elem_id_t *ptr);
unsigned int snd_ctl_elem_info_get_numid(const snd_ctl_elem_info_t *obj);
snd_ctl_elem_iface_t snd_ctl_elem_info_get_interface(const snd_ctl_elem_info_t *obj);
unsigned int snd_ctl_elem_info_get_device(const snd_ctl_elem_info_t *obj);
unsigned int snd_ctl_elem_info_get_subdevice(const snd_ctl_elem_info_t *obj);
const char *snd_ctl_elem_info_get_name(const snd_ctl_elem_info_t *obj);
unsigned int snd_ctl_elem_info_get_index(const snd_ctl_elem_info_t *obj);
void snd_ctl_elem_info_set_id(snd_ctl_elem_info_t *obj, const snd_ctl_elem_id_t *ptr);
void snd_ctl_elem_info_set_numid(snd_ctl_elem_info_t *obj, unsigned int val);
void snd_ctl_elem_info_set_interface(snd_ctl_elem_info_t *obj, snd_ctl_elem_iface_t val);
void snd_ctl_elem_info_set_device(snd_ctl_elem_info_t *obj, unsigned int val);
void snd_ctl_elem_info_set_subdevice(snd_ctl_elem_info_t *obj, unsigned int val);
void snd_ctl_elem_info_set_name(snd_ctl_elem_info_t *obj, const char *val);
void snd_ctl_elem_info_set_index(snd_ctl_elem_info_t *obj, unsigned int val);
void snd_ctl_elem_info_set_read_write(snd_ctl_elem_info_t *obj, int rval, int wval);
void snd_ctl_elem_info_set_tlv_read_write(snd_ctl_elem_info_t *obj, int rval, int wval);
void snd_ctl_elem_info_set_inactive(snd_ctl_elem_info_t *obj, int val);
int snd_ctl_add_integer_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
unsigned int element_count,
unsigned int member_count,
long min, long max, long step);
int snd_ctl_add_integer64_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
unsigned int element_count,
unsigned int member_count,
long long min, long long max,
long long step);
int snd_ctl_add_boolean_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
unsigned int element_count,
unsigned int member_count);
int snd_ctl_add_enumerated_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
unsigned int element_count,
unsigned int member_count,
unsigned int items,
const char *const labels[]);
int snd_ctl_add_bytes_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
unsigned int element_count,
unsigned int member_count);
int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long imin, long imax, long istep);
int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, long long imin, long long imax, long long istep);
int snd_ctl_elem_add_boolean(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count);
int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id, unsigned int count, unsigned int items, const char *const names[]);
int snd_ctl_elem_add_iec958(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id);
int snd_ctl_elem_remove(snd_ctl_t *ctl, snd_ctl_elem_id_t *id);
size_t snd_ctl_elem_value_sizeof(void);
/** \hideinitializer
* \brief Allocate an invalid #snd_ctl_elem_value_t on the stack.
*
* Allocate space for a value object on the stack. The allocated
* memory need not be freed, because it is on the stack.
*
* See snd_ctl_elem_value_t for details.
*
* \param ptr Pointer to a snd_ctl_elem_value_t pointer. The address
* of the allocated space will returned here.
*/
#define snd_ctl_elem_value_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_value)
int snd_ctl_elem_value_malloc(snd_ctl_elem_value_t **ptr);
void snd_ctl_elem_value_free(snd_ctl_elem_value_t *obj);
void snd_ctl_elem_value_clear(snd_ctl_elem_value_t *obj);
void snd_ctl_elem_value_copy(snd_ctl_elem_value_t *dst, const snd_ctl_elem_value_t *src);
int snd_ctl_elem_value_compare(snd_ctl_elem_value_t *left, const snd_ctl_elem_value_t *right);
void snd_ctl_elem_value_get_id(const snd_ctl_elem_value_t *obj, snd_ctl_elem_id_t *ptr);
unsigned int snd_ctl_elem_value_get_numid(const snd_ctl_elem_value_t *obj);
snd_ctl_elem_iface_t snd_ctl_elem_value_get_interface(const snd_ctl_elem_value_t *obj);
unsigned int snd_ctl_elem_value_get_device(const snd_ctl_elem_value_t *obj);
unsigned int snd_ctl_elem_value_get_subdevice(const snd_ctl_elem_value_t *obj);
const char *snd_ctl_elem_value_get_name(const snd_ctl_elem_value_t *obj);
unsigned int snd_ctl_elem_value_get_index(const snd_ctl_elem_value_t *obj);
void snd_ctl_elem_value_set_id(snd_ctl_elem_value_t *obj, const snd_ctl_elem_id_t *ptr);
void snd_ctl_elem_value_set_numid(snd_ctl_elem_value_t *obj, unsigned int val);
void snd_ctl_elem_value_set_interface(snd_ctl_elem_value_t *obj, snd_ctl_elem_iface_t val);
void snd_ctl_elem_value_set_device(snd_ctl_elem_value_t *obj, unsigned int val);
void snd_ctl_elem_value_set_subdevice(snd_ctl_elem_value_t *obj, unsigned int val);
void snd_ctl_elem_value_set_name(snd_ctl_elem_value_t *obj, const char *val);
void snd_ctl_elem_value_set_index(snd_ctl_elem_value_t *obj, unsigned int val);
int snd_ctl_elem_value_get_boolean(const snd_ctl_elem_value_t *obj, unsigned int idx);
long snd_ctl_elem_value_get_integer(const snd_ctl_elem_value_t *obj, unsigned int idx);
long long snd_ctl_elem_value_get_integer64(const snd_ctl_elem_value_t *obj, unsigned int idx);
unsigned int snd_ctl_elem_value_get_enumerated(const snd_ctl_elem_value_t *obj, unsigned int idx);
unsigned char snd_ctl_elem_value_get_byte(const snd_ctl_elem_value_t *obj, unsigned int idx);
void snd_ctl_elem_value_set_boolean(snd_ctl_elem_value_t *obj, unsigned int idx, long val);
void snd_ctl_elem_value_set_integer(snd_ctl_elem_value_t *obj, unsigned int idx, long val);
void snd_ctl_elem_value_set_integer64(snd_ctl_elem_value_t *obj, unsigned int idx, long long val);
void snd_ctl_elem_value_set_enumerated(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned int val);
void snd_ctl_elem_value_set_byte(snd_ctl_elem_value_t *obj, unsigned int idx, unsigned char val);
void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t *obj, void *data, size_t size);
const void * snd_ctl_elem_value_get_bytes(const snd_ctl_elem_value_t *obj);
void snd_ctl_elem_value_get_iec958(const snd_ctl_elem_value_t *obj, snd_aes_iec958_t *ptr);
void snd_ctl_elem_value_set_iec958(snd_ctl_elem_value_t *obj, const snd_aes_iec958_t *ptr);
int snd_tlv_parse_dB_info(unsigned int *tlv, unsigned int tlv_size,
unsigned int **db_tlvp);
int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
long *min, long *max);
int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
long volume, long *db_gain);
int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
long db_gain, long *value, int xdir);
int snd_ctl_get_dB_range(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
long *min, long *max);
int snd_ctl_convert_to_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
long volume, long *db_gain);
int snd_ctl_convert_from_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
long db_gain, long *value, int xdir);
/**
* \defgroup HControl High level Control Interface
* \ingroup Control
* The high level control interface.
* See \ref hcontrol page for more details.
* \{
*/
/** HCTL element handle */
typedef struct _snd_hctl_elem snd_hctl_elem_t;
/** HCTL handle */
typedef struct _snd_hctl snd_hctl_t;
/**
* \brief Compare function for sorting HCTL elements
* \param e1 First element
* \param e2 Second element
* \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
*/
typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1,
const snd_hctl_elem_t *e2);
int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
const snd_hctl_elem_t *c2);
/**
* \brief HCTL callback function
* \param hctl HCTL handle
* \param mask event mask
* \param elem related HCTL element (if any)
* \return 0 on success otherwise a negative error code
*/
typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl,
unsigned int mask,
snd_hctl_elem_t *elem);
/**
* \brief HCTL element callback function
* \param elem HCTL element
* \param mask event mask
* \return 0 on success otherwise a negative error code
*/
typedef int (*snd_hctl_elem_callback_t)(snd_hctl_elem_t *elem,
unsigned int mask);
int snd_hctl_open(snd_hctl_t **hctl, const char *name, int mode);
int snd_hctl_open_ctl(snd_hctl_t **hctlp, snd_ctl_t *ctl);
int snd_hctl_close(snd_hctl_t *hctl);
int snd_hctl_nonblock(snd_hctl_t *hctl, int nonblock);
static __inline__ int snd_hctl_abort(snd_hctl_t *hctl) { return snd_hctl_nonblock(hctl, 2); }
int snd_hctl_poll_descriptors_count(snd_hctl_t *hctl);
int snd_hctl_poll_descriptors(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int space);
int snd_hctl_poll_descriptors_revents(snd_hctl_t *ctl, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
unsigned int snd_hctl_get_count(snd_hctl_t *hctl);
int snd_hctl_set_compare(snd_hctl_t *hctl, snd_hctl_compare_t hsort);
snd_hctl_elem_t *snd_hctl_first_elem(snd_hctl_t *hctl);
snd_hctl_elem_t *snd_hctl_last_elem(snd_hctl_t *hctl);
snd_hctl_elem_t *snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id);
void snd_hctl_set_callback(snd_hctl_t *hctl, snd_hctl_callback_t callback);
void snd_hctl_set_callback_private(snd_hctl_t *hctl, void *data);
void *snd_hctl_get_callback_private(snd_hctl_t *hctl);
int snd_hctl_load(snd_hctl_t *hctl);
int snd_hctl_free(snd_hctl_t *hctl);
int snd_hctl_handle_events(snd_hctl_t *hctl);
const char *snd_hctl_name(snd_hctl_t *hctl);
int snd_hctl_wait(snd_hctl_t *hctl, int timeout);
snd_ctl_t *snd_hctl_ctl(snd_hctl_t *hctl);
snd_hctl_elem_t *snd_hctl_elem_next(snd_hctl_elem_t *elem);
snd_hctl_elem_t *snd_hctl_elem_prev(snd_hctl_elem_t *elem);
int snd_hctl_elem_info(snd_hctl_elem_t *elem, snd_ctl_elem_info_t * info);
int snd_hctl_elem_read(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
int snd_hctl_elem_write(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
int snd_hctl_elem_tlv_read(snd_hctl_elem_t *elem, unsigned int *tlv, unsigned int tlv_size);
int snd_hctl_elem_tlv_write(snd_hctl_elem_t *elem, const unsigned int *tlv);
int snd_hctl_elem_tlv_command(snd_hctl_elem_t *elem, const unsigned int *tlv);
snd_hctl_t *snd_hctl_elem_get_hctl(snd_hctl_elem_t *elem);
void snd_hctl_elem_get_id(const snd_hctl_elem_t *obj, snd_ctl_elem_id_t *ptr);
unsigned int snd_hctl_elem_get_numid(const snd_hctl_elem_t *obj);
snd_ctl_elem_iface_t snd_hctl_elem_get_interface(const snd_hctl_elem_t *obj);
unsigned int snd_hctl_elem_get_device(const snd_hctl_elem_t *obj);
unsigned int snd_hctl_elem_get_subdevice(const snd_hctl_elem_t *obj);
const char *snd_hctl_elem_get_name(const snd_hctl_elem_t *obj);
unsigned int snd_hctl_elem_get_index(const snd_hctl_elem_t *obj);
void snd_hctl_elem_set_callback(snd_hctl_elem_t *obj, snd_hctl_elem_callback_t val);
void * snd_hctl_elem_get_callback_private(const snd_hctl_elem_t *obj);
void snd_hctl_elem_set_callback_private(snd_hctl_elem_t *obj, void * val);
/** \} */
/** \} */
/**
* \defgroup SControl Setup Control Interface
* \ingroup Control
* The setup control interface - set or modify control elements from a configuration file.
* \{
*/
int snd_sctl_build(snd_sctl_t **ctl, snd_ctl_t *handle, snd_config_t *config,
snd_config_t *private_data, int mode);
int snd_sctl_free(snd_sctl_t *handle);
int snd_sctl_install(snd_sctl_t *handle);
int snd_sctl_remove(snd_sctl_t *handle);
/** \} */
/**
* \defgroup Hint Name Hint Interface
* \ingroup Configuration
* The name hint interface - get descriptive information about a device
* (name, description, input/output).
* \{
*/
int snd_device_name_hint(int card, const char *iface, void ***hints);
int snd_device_name_free_hint(void **hints);
char *snd_device_name_get_hint(const void *hint, const char *id);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_CONTROL_H */

289
include/control_external.h Normal file
View file

@ -0,0 +1,289 @@
/**
* \file include/control_external.h
* \brief External control plugin SDK
* \author Takashi Iwai <tiwai@suse.de>
* \date 2005
*
* External control plugin SDK.
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ALSA_CONTROL_EXTERNAL_H
#define __ALSA_CONTROL_EXTERNAL_H
#ifndef __ASOUNDLIB_LOCAL
#include <alsa/asoundlib.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup CtlPlugin_SDK External Control Plugin SDK
* \{
*/
/**
* Define the object entry for external control plugins
*/
#define SND_CTL_PLUGIN_ENTRY(name) _snd_ctl_##name##_open
/**
* Define the symbols of the given control plugin with versions
*/
#define SND_CTL_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_CTL_PLUGIN_ENTRY(name), SND_CONTROL_DLSYM_VERSION);
/**
* Define the control plugin
*/
#define SND_CTL_PLUGIN_DEFINE_FUNC(plugin) \
int SND_CTL_PLUGIN_ENTRY(plugin) (snd_ctl_t **handlep, const char *name,\
snd_config_t *root, snd_config_t *conf, int mode)
/** External control plugin handle */
typedef struct snd_ctl_ext snd_ctl_ext_t;
/** Callback table of control ext */
typedef struct snd_ctl_ext_callback snd_ctl_ext_callback_t;
/** Key to access a control pointer */
typedef unsigned long snd_ctl_ext_key_t;
#ifdef DOC_HIDDEN
/* redefine typedef's for stupid doxygen */
typedef snd_ctl_ext snd_ctl_ext_t;
typedef snd_ctl_ext_callback snd_ctl_ext_callback_t;
#endif
/** Callback to handle TLV commands. */
typedef int (snd_ctl_ext_tlv_rw_t)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int op_flag, unsigned int numid,
unsigned int *tlv, unsigned int tlv_size);
/*
* Protocol version
*/
#define SND_CTL_EXT_VERSION_MAJOR 1 /**< Protocol major version */
#define SND_CTL_EXT_VERSION_MINOR 0 /**< Protocol minor version */
#define SND_CTL_EXT_VERSION_TINY 1 /**< Protocol tiny version */
/**
* external plugin protocol version
*/
#define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\
(SND_CTL_EXT_VERSION_MINOR<<8) |\
(SND_CTL_EXT_VERSION_TINY))
/** Handle of control ext */
struct snd_ctl_ext {
/**
* protocol version; #SND_CTL_EXT_VERSION must be filled here
* before calling #snd_ctl_ext_create()
*/
unsigned int version;
/**
* Index of this card; must be filled before calling #snd_ctl_ext_create()
*/
int card_idx;
/**
* ID string of this card; must be filled before calling #snd_ctl_ext_create()
*/
char id[16];
/**
* Driver name of this card; must be filled before calling #snd_ctl_ext_create()
*/
char driver[16];
/**
* short name of this card; must be filled before calling #snd_ctl_ext_create()
*/
char name[32];
/**
* Long name of this card; must be filled before calling #snd_ctl_ext_create()
*/
char longname[80];
/**
* Mixer name of this card; must be filled before calling #snd_ctl_ext_create()
*/
char mixername[80];
/**
* poll descriptor
*/
int poll_fd;
/**
* callbacks of this plugin; must be filled before calling #snd_pcm_ioplug_create()
*/
const snd_ctl_ext_callback_t *callback;
/**
* private data, which can be used freely in the driver callbacks
*/
void *private_data;
/**
* control handle filled by #snd_ctl_ext_create()
*/
snd_ctl_t *handle;
int nonblock; /**< non-block mode; read-only */
int subscribed; /**< events subscribed; read-only */
/**
* optional TLV data for the control (since protocol 1.0.1)
*/
union {
snd_ctl_ext_tlv_rw_t *c;
const unsigned int *p;
} tlv;
};
/** Callback table of ext. */
struct snd_ctl_ext_callback {
/**
* close the control handle; optional
*/
void (*close)(snd_ctl_ext_t *ext);
/**
* return the total number of elements; required
*/
int (*elem_count)(snd_ctl_ext_t *ext);
/**
* return the element id of the given offset (array index); required
*/
int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id);
/**
* convert the element id to a search key; required
*/
snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id);
/**
* the destructor of the key; optional
*/
void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key);
/**
* get the attribute of the element; required
*/
int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
int *type, unsigned int *acc, unsigned int *count);
/**
* get the element information of integer type
*/
int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
long *imin, long *imax, long *istep);
/**
* get the element information of integer64 type
*/
int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
int64_t *imin, int64_t *imax, int64_t *istep);
/**
* get the element information of enumerated type
*/
int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
/**
* get the name of the enumerated item
*/
int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item,
char *name, size_t name_max_len);
/**
* read the current values of integer type
*/
int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
/**
* read the current values of integer64 type
*/
int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
/**
* read the current values of enumerated type
*/
int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
/**
* read the current values of bytes type
*/
int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
size_t max_bytes);
/**
* read the current values of iec958 type
*/
int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
/**
* update the current values of integer type with the given values
*/
int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
/**
* update the current values of integer64 type with the given values
*/
int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
/**
* update the current values of enumerated type with the given values
*/
int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
/**
* update the current values of bytes type with the given values
*/
int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
size_t max_bytes);
/**
* update the current values of iec958 type with the given values
*/
int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
/**
* subscribe/unsubscribe the event notification; optional
*/
void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe);
/**
* read a pending notification event; optional
*/
int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask);
/**
* return the number of poll descriptors; optional
*/
int (*poll_descriptors_count)(snd_ctl_ext_t *ext);
/**
* fill the poll descriptors; optional
*/
int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space);
/**
* mangle the revents of poll descriptors
*/
int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
};
/**
* The access type bits stored in get_attribute callback
*/
typedef enum snd_ctl_ext_access {
SND_CTL_EXT_ACCESS_READ = (1<<0),
SND_CTL_EXT_ACCESS_WRITE = (1<<1),
SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
SND_CTL_EXT_ACCESS_TLV_READ = (1<<4),
SND_CTL_EXT_ACCESS_TLV_WRITE = (1<<5),
SND_CTL_EXT_ACCESS_TLV_READWRITE = (3<<4),
SND_CTL_EXT_ACCESS_TLV_COMMAND = (1<<6),
SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
SND_CTL_EXT_ACCESS_TLV_CALLBACK = (1<<28),
} snd_ctl_ext_access_t;
/**
* find_elem callback returns this if no matching control element is found
*/
#define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1)
int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode);
int snd_ctl_ext_delete(snd_ctl_ext_t *ext);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_CONTROL_EXTERNAL_H */

56
include/control_plugin.h Normal file
View file

@ -0,0 +1,56 @@
/**
* \file include/control_plugin.h
* \brief Common control plugin code
* \author Jaroslav Kysela <perex@perex.cz>
* \date 2021
*
* Application interface library for the ALSA driver.
* See the \ref control_plugins page for more details.
*
* \warning Using of contents of this header file might be dangerous
* in the sense of compatibility reasons. The contents might be
* freely changed in future.
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ALSA_CONTROL_PLUGIN_H
#define __ALSA_CONTROL_PLUGIN_H
/**
* \defgroup Control_Plugins Primitive Control Plugins
* \ingroup Control
* See the \ref control_plugins page for more details.
* \{
*/
/*
* Control HW
*/
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode);
int _snd_ctl_hw_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_config_t *conf, int mode);
/*
* Control Remap & Map
*/
int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *remap,
snd_config_t *map, snd_ctl_t *child, int mode);
int _snd_ctl_remap_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_config_t *conf, int mode);
/** \} */
#endif /* __ALSA_CONTROL_PLUGIN_H */

90
include/error.h Normal file
View file

@ -0,0 +1,90 @@
/**
* \file include/error.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/error.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_ERROR_H
#define __ALSA_ERROR_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Error Error handling
* Error handling macros and functions.
* \{
*/
#define SND_ERROR_BEGIN 500000 /**< Lower boundary of sound error codes. */
#define SND_ERROR_INCOMPATIBLE_VERSION (SND_ERROR_BEGIN+0) /**< Kernel/library protocols are not compatible. */
const char *snd_strerror(int errnum);
/**
* \brief Error handler callback.
* \param file Source file name.
* \param line Line number.
* \param function Function name.
* \param err Value of \c errno, or 0 if not relevant.
* \param fmt \c printf(3) format.
* \param ... \c printf(3) arguments.
*
* A function of this type is called by the ALSA library when an error occurs.
* This function usually shows the message on the screen, and/or logs it.
*/
typedef void (*snd_lib_error_handler_t)(const char *file, int line, const char *function, int err, const char *fmt, ...) /* __attribute__ ((format (printf, 5, 6))) */;
extern snd_lib_error_handler_t snd_lib_error;
extern int snd_lib_error_set_handler(snd_lib_error_handler_t handler);
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
#define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows a sound error message. */
#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __func__, errno, __VA_ARGS__) /**< Shows a system error message (related to \c errno). */
#else
#define SNDERR(args...) snd_lib_error(__FILE__, __LINE__, __func__, 0, ##args) /**< Shows a sound error message. */
#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __func__, errno, ##args) /**< Shows a system error message (related to \c errno). */
#endif
/** \} */
#ifdef __cplusplus
}
#endif
/** Local error handler function type */
typedef void (*snd_local_error_handler_t)(const char *file, int line,
const char *func, int err,
const char *fmt, va_list arg);
snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func);
#endif /* __ALSA_ERROR_H */

165
include/global.h Normal file
View file

@ -0,0 +1,165 @@
/**
* \file include/global.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/global.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_GLOBAL_H_
#define __ALSA_GLOBAL_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Global Global defines and functions
* Global defines and functions.
* \par
* The ALSA library implementation uses these macros and functions.
* Most applications probably do not need them.
* \{
*/
const char *snd_asoundlib_version(void);
#ifndef ATTRIBUTE_UNUSED
/** do not print warning (gcc) when function parameter is not used */
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
#ifndef __STRING
/** \brief Return 'x' argument as string */
#define __STRING(x) #x
#endif
#ifdef PIC /* dynamic build */
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
/**
* \hideinitializer
* \brief Appends the build version to the name of a versioned dynamic symbol.
*/
#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
#else /* static build */
struct snd_dlsym_link {
struct snd_dlsym_link *next;
const char *dlsym_name;
const void *dlsym_ptr;
};
extern struct snd_dlsym_link *snd_dlsym_start;
/** \hideinitializer \brief Helper macro for #SND_DLSYM_BUILD_VERSION. */
#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
/**
* \hideinitializer
* \brief Appends the build version to the name of a versioned dynamic symbol.
*/
#define SND_DLSYM_BUILD_VERSION(name, version) \
static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = __STRING(name); \
__SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
}
#endif
/** \brief Returns the version of a dynamic symbol as a string. */
#define SND_DLSYM_VERSION(version) __STRING(version)
int snd_dlpath(char *path, size_t path_len, const char *name);
void *snd_dlopen(const char *file, int mode, char *errbuf, size_t errbuflen);
void *snd_dlsym(void *handle, const char *name, const char *version);
int snd_dlclose(void *handle);
/** \brief alloca helper macro. */
#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
/**
* \brief Internal structure for an async notification client handler.
*
* The ALSA library uses a pointer to this structure as a handle to an async
* notification object. Applications don't access its contents directly.
*/
typedef struct _snd_async_handler snd_async_handler_t;
/**
* \brief Async notification callback.
*
* See the #snd_async_add_handler function for details.
*/
typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);
int snd_async_add_handler(snd_async_handler_t **handler, int fd,
snd_async_callback_t callback, void *private_data);
int snd_async_del_handler(snd_async_handler_t *handler);
int snd_async_handler_get_fd(snd_async_handler_t *handler);
int snd_async_handler_get_signo(snd_async_handler_t *handler);
void *snd_async_handler_get_callback_private(snd_async_handler_t *handler);
struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr);
struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area);
int snd_shm_area_destroy(struct snd_shm_area *area);
int snd_user_file(const char *file, char **result);
#ifdef __GLIBC__
#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
struct timeval {
time_t tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
#endif
#endif
/** Timestamp */
typedef struct timeval snd_timestamp_t;
/** Hi-res timestamp */
typedef struct timespec snd_htimestamp_t;
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_GLOBAL_H */

178
include/hwdep.h Normal file
View file

@ -0,0 +1,178 @@
/**
* \file include/hwdep.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/hwdep.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_HWDEP_H
#define __ALSA_HWDEP_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup HwDep Hardware Dependant Interface
* The Hardware Dependant Interface.
* \{
*/
/** dlsym version for interface entry callback */
#define SND_HWDEP_DLSYM_VERSION _dlsym_hwdep_001
/** HwDep information container */
typedef struct _snd_hwdep_info snd_hwdep_info_t;
/** HwDep DSP status container */
typedef struct _snd_hwdep_dsp_status snd_hwdep_dsp_status_t;
/** HwDep DSP image container */
typedef struct _snd_hwdep_dsp_image snd_hwdep_dsp_image_t;
/** HwDep interface */
typedef enum _snd_hwdep_iface {
SND_HWDEP_IFACE_OPL2 = 0, /**< OPL2 raw driver */
SND_HWDEP_IFACE_OPL3, /**< OPL3 raw driver */
SND_HWDEP_IFACE_OPL4, /**< OPL4 raw driver */
SND_HWDEP_IFACE_SB16CSP, /**< SB16CSP driver */
SND_HWDEP_IFACE_EMU10K1, /**< EMU10K1 driver */
SND_HWDEP_IFACE_YSS225, /**< YSS225 driver */
SND_HWDEP_IFACE_ICS2115, /**< ICS2115 driver */
SND_HWDEP_IFACE_SSCAPE, /**< Ensoniq SoundScape ISA card (MC68EC000) */
SND_HWDEP_IFACE_VX, /**< Digigram VX cards */
SND_HWDEP_IFACE_MIXART, /**< Digigram miXart cards */
SND_HWDEP_IFACE_USX2Y, /**< Tascam US122, US224 & US428 usb */
SND_HWDEP_IFACE_EMUX_WAVETABLE, /**< EmuX wavetable */
SND_HWDEP_IFACE_BLUETOOTH, /**< Bluetooth audio */
SND_HWDEP_IFACE_USX2Y_PCM, /**< Tascam US122, US224 & US428 raw USB PCM */
SND_HWDEP_IFACE_PCXHR, /**< Digigram PCXHR */
SND_HWDEP_IFACE_SB_RC, /**< SB Extigy/Audigy2NX remote control */
SND_HWDEP_IFACE_HDA, /**< HD-audio */
SND_HWDEP_IFACE_USB_STREAM, /**< direct access to usb stream */
SND_HWDEP_IFACE_FW_DICE, /**< TC DICE FireWire device */
SND_HWDEP_IFACE_FW_FIREWORKS, /**< Echo Audio Fireworks based device */
SND_HWDEP_IFACE_FW_BEBOB, /**< BridgeCo BeBoB based device */
SND_HWDEP_IFACE_FW_OXFW, /**< Oxford OXFW970/971 based device */
SND_HWDEP_IFACE_FW_DIGI00X, /* Digidesign Digi 002/003 family */
SND_HWDEP_IFACE_FW_TASCAM, /* TASCAM FireWire series */
SND_HWDEP_IFACE_LINE6, /* Line6 USB processors */
SND_HWDEP_IFACE_FW_MOTU, /* MOTU FireWire series */
SND_HWDEP_IFACE_FW_FIREFACE, /* RME Fireface series */
SND_HWDEP_IFACE_LAST = SND_HWDEP_IFACE_FW_FIREFACE, /**< last known hwdep interface */
} snd_hwdep_iface_t;
/** open for reading */
#define SND_HWDEP_OPEN_READ (O_RDONLY)
/** open for writing */
#define SND_HWDEP_OPEN_WRITE (O_WRONLY)
/** open for reading and writing */
#define SND_HWDEP_OPEN_DUPLEX (O_RDWR)
/** open mode flag: open in nonblock mode */
#define SND_HWDEP_OPEN_NONBLOCK (O_NONBLOCK)
/** HwDep handle type */
typedef enum _snd_hwdep_type {
/** Kernel level HwDep */
SND_HWDEP_TYPE_HW,
/** Shared memory client HwDep (not yet implemented) */
SND_HWDEP_TYPE_SHM,
/** INET client HwDep (not yet implemented) */
SND_HWDEP_TYPE_INET
} snd_hwdep_type_t;
/** HwDep handle */
typedef struct _snd_hwdep snd_hwdep_t;
int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode);
int snd_hwdep_close(snd_hwdep_t *hwdep);
int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space);
int snd_hwdep_poll_descriptors_count(snd_hwdep_t *hwdep);
int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock);
int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info);
int snd_hwdep_dsp_status(snd_hwdep_t *hwdep, snd_hwdep_dsp_status_t *status);
int snd_hwdep_dsp_load(snd_hwdep_t *hwdep, snd_hwdep_dsp_image_t *block);
int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg);
ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size);
ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size);
size_t snd_hwdep_info_sizeof(void);
/** allocate #snd_hwdep_info_t container on stack */
#define snd_hwdep_info_alloca(ptr) __snd_alloca(ptr, snd_hwdep_info)
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
void snd_hwdep_info_free(snd_hwdep_info_t *obj);
void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src);
unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj);
int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj);
const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj);
const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj);
snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj);
void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val);
size_t snd_hwdep_dsp_status_sizeof(void);
/** allocate #snd_hwdep_dsp_status_t container on stack */
#define snd_hwdep_dsp_status_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_status)
int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **ptr);
void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *obj);
void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src);
unsigned int snd_hwdep_dsp_status_get_version(const snd_hwdep_dsp_status_t *obj);
const char *snd_hwdep_dsp_status_get_id(const snd_hwdep_dsp_status_t *obj);
unsigned int snd_hwdep_dsp_status_get_num_dsps(const snd_hwdep_dsp_status_t *obj);
unsigned int snd_hwdep_dsp_status_get_dsp_loaded(const snd_hwdep_dsp_status_t *obj);
unsigned int snd_hwdep_dsp_status_get_chip_ready(const snd_hwdep_dsp_status_t *obj);
size_t snd_hwdep_dsp_image_sizeof(void);
/** allocate #snd_hwdep_dsp_image_t container on stack */
#define snd_hwdep_dsp_image_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_image)
int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **ptr);
void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *obj);
void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src);
unsigned int snd_hwdep_dsp_image_get_index(const snd_hwdep_dsp_image_t *obj);
const char *snd_hwdep_dsp_image_get_name(const snd_hwdep_dsp_image_t *obj);
const void *snd_hwdep_dsp_image_get_image(const snd_hwdep_dsp_image_t *obj);
size_t snd_hwdep_dsp_image_get_length(const snd_hwdep_dsp_image_t *obj);
void snd_hwdep_dsp_image_set_index(snd_hwdep_dsp_image_t *obj, unsigned int _index);
void snd_hwdep_dsp_image_set_name(snd_hwdep_dsp_image_t *obj, const char *name);
void snd_hwdep_dsp_image_set_image(snd_hwdep_dsp_image_t *obj, void *buffer);
void snd_hwdep_dsp_image_set_length(snd_hwdep_dsp_image_t *obj, size_t length);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_HWDEP_H */

91
include/input.h Normal file
View file

@ -0,0 +1,91 @@
/**
* \file include/input.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/input.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_INPUT_H
#define __ALSA_INPUT_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Input Input Interface
*
* The input functions present an interface similar to the stdio functions
* on top of different underlying input sources.
*
* The #snd_config_load function uses such an input handle to be able to
* load configurations not only from standard files but also from other
* sources, e.g. from memory buffers.
*
* \{
*/
/**
* \brief Internal structure for an input object.
*
* The ALSA library uses a pointer to this structure as a handle to an
* input object. Applications don't access its contents directly.
*/
typedef struct _snd_input snd_input_t;
/** Input type. */
typedef enum _snd_input_type {
/** Input from a stdio stream. */
SND_INPUT_STDIO,
/** Input from a memory buffer. */
SND_INPUT_BUFFER
} snd_input_type_t;
int snd_input_stdio_open(snd_input_t **inputp, const char *file, const char *mode);
int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close);
int snd_input_buffer_open(snd_input_t **inputp, const char *buffer, ssize_t size);
int snd_input_close(snd_input_t *input);
int snd_input_scanf(snd_input_t *input, const char *format, ...)
#ifndef DOC_HIDDEN
__attribute__ ((format (scanf, 2, 3)))
#endif
;
char *snd_input_gets(snd_input_t *input, char *str, size_t size);
int snd_input_getc(snd_input_t *input);
int snd_input_ungetc(snd_input_t *input, int c);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_INPUT_H */

117
include/list.h Normal file
View file

@ -0,0 +1,117 @@
/* Doubly linked list macros compatible with Linux kernel's version
* Copyright (c) 2015 by Takashi Iwai <tiwai@suse.de>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
#ifndef _LIST_H
#define _LIST_H
#include <stddef.h>
struct list_head {
struct list_head *next;
struct list_head *prev;
};
/* one-shot definition of a list head */
#define LIST_HEAD(x) \
struct list_head x = { &x, &x }
/* initialize a list head explicitly */
static inline void INIT_LIST_HEAD(struct list_head *p)
{
p->next = p->prev = p;
}
#define list_entry_offset(p, type, offset) \
((type *)((char *)(p) - (offset)))
/* list_entry - retrieve the original struct from list_head
* @p: list_head pointer
* @type: struct type
* @member: struct field member containing the list_head
*/
#define list_entry(p, type, member) \
list_entry_offset(p, type, offsetof(type, member))
/* list_for_each - iterate over the linked list
* @p: iterator, a list_head pointer variable
* @list: list_head pointer containing the list
*/
#define list_for_each(p, list) \
for (p = (list)->next; p != (list); p = p->next)
/* list_for_each_safe - iterate over the linked list, safe to delete
* @p: iterator, a list_head pointer variable
* @s: a temporary variable to keep the next, a list_head pointer, too
* @list: list_head pointer containing the list
*/
#define list_for_each_safe(p, s, list) \
for (p = (list)->next; s = p->next, p != (list); p = s)
/* list_add - prepend a list entry at the head
* @p: the new list entry to add
* @list: the list head
*/
static inline void list_add(struct list_head *p, struct list_head *list)
{
struct list_head *first = list->next;
p->next = first;
first->prev = p;
list->next = p;
p->prev = list;
}
/* list_add_tail - append a list entry at the tail
* @p: the new list entry to add
* @list: the list head
*/
static inline void list_add_tail(struct list_head *p, struct list_head *list)
{
struct list_head *last = list->prev;
last->next = p;
p->prev = last;
p->next = list;
list->prev = p;
}
/* list_insert - insert a new list entry between two known consecutive entries
* @p: the new entry to be inserted between prev and next
* @prev: the left-side entry
* @next: the right-side entry
*/
static inline void list_insert(struct list_head *p,
struct list_head *prev,
struct list_head *next)
{
next->prev = p;
p->next = next;
p->prev = prev;
prev->next = p;
}
/* list_del - delete the given list entry */
static inline void list_del(struct list_head *p)
{
p->prev->next = p->next;
p->next->prev = p->prev;
}
/* list_empty - returns 1 if the given list is empty */
static inline int list_empty(const struct list_head *p)
{
return p->next == p;
}
#endif /* _LIST_H */

425
include/local.h Normal file
View file

@ -0,0 +1,425 @@
/*
* ALSA lib - local header file
* Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __LOCAL_H
#define __LOCAL_H
#include "config.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <stdint.h>
/* for timeval and timespec */
#include <time.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H)
#include <sys/endian.h>
#else
#error Header defining endianness not defined
#endif
#ifndef __BYTE_ORDER
#define __BYTE_ORDER BYTE_ORDER
#endif
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN LITTLE_ENDIAN
#endif
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#endif
#include <stdarg.h>
#include <poll.h>
#include <sys/types.h>
#include <errno.h>
#if defined(__linux__)
#include <linux/types.h>
#include <linux/ioctl.h>
#else
#include "type_compat.h"
#endif
#ifdef SUPPORT_RESMGR
#include <resmgr.h>
#endif
#ifdef HAVE_LIBDL
#include <dlfcn.h>
#else
#define RTLD_NOW 0
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define SND_LITTLE_ENDIAN
#define SNDRV_LITTLE_ENDIAN
#define SNDRV_LITTLE_ENDIAN_BITFIELD
#elif __BYTE_ORDER == __BIG_ENDIAN
#define SND_BIG_ENDIAN
#define SNDRV_BIG_ENDIAN
#define SNDRV_BIG_ENDIAN_BITFIELD
#else
#error "Unsupported endian..."
#endif
#ifndef HAVE_LFS
#define stat64 stat
#define lstat64 lstat
#define dirent64 dirent
#define readdir64 readdir
#define scandir64 scandir
#define versionsort64 versionsort
#define alphasort64 alphasort
#define ino64_t ino_t
#define fstat64 fstat
#define stat64 stat
#endif
#define _snd_config_iterator list_head
#define _snd_interval snd_interval
#define _snd_pcm_info snd_pcm_info
#define _snd_pcm_hw_params snd_pcm_hw_params
#define _snd_pcm_sw_params snd_pcm_sw_params
#define _snd_pcm_status snd_pcm_status
#define _snd_ctl_card_info snd_ctl_card_info
#define _snd_ctl_elem_id snd_ctl_elem_id
#define _snd_ctl_elem_list snd_ctl_elem_list
#define _snd_ctl_elem_info snd_ctl_elem_info
#define _snd_ctl_elem_value snd_ctl_elem_value
#define _snd_ctl_event snd_ctl_event
#define _snd_rawmidi_info snd_rawmidi_info
#define _snd_rawmidi_params snd_rawmidi_params
#define _snd_rawmidi_status snd_rawmidi_status
#define _snd_hwdep_info snd_hwdep_info
#define _snd_hwdep_dsp_status snd_hwdep_dsp_status
#define _snd_hwdep_dsp_image snd_hwdep_dsp_image
#define _snd_seq_queue_tempo snd_seq_queue_tempo
#define _snd_seq_client_info snd_seq_client_info
#define _snd_seq_port_info snd_seq_port_info
#define _snd_seq_system_info snd_seq_system_info
#define _snd_seq_queue_info snd_seq_queue_info
#define _snd_seq_queue_status snd_seq_queue_status
#define _snd_seq_queue_timer snd_seq_queue_timer
#define _snd_seq_port_subscribe snd_seq_port_subscribe
#define _snd_seq_query_subscribe snd_seq_query_subs
#define _snd_seq_client_pool snd_seq_client_pool
#define _snd_seq_remove_events snd_seq_remove_events
#define _snd_timer_id snd_timer_id
#define _snd_timer_ginfo snd_timer_ginfo
#define _snd_timer_gparams snd_timer_gparams
#define _snd_timer_gstatus snd_timer_gstatus
#define _snd_timer_select snd_timer_select
#define _snd_timer_info snd_timer_info
#define _snd_timer_params snd_timer_params
#define _snd_timer_status snd_timer_status
#define ALSA_LIBRARY_BUILD
/* rename some types for avoiding conflicts with alsalib's definitions */
#define snd_aes_iec958 sndrv_aes_iec958
#define snd_pcm_uframes_t sndrv_pcm_uframes_t
#define snd_pcm_sframes_t sndrv_pcm_sframes_t
#define snd_pcm_access_t sndrv_pcm_access_t
#define snd_pcm_format_t sndrv_pcm_format_t
#define snd_pcm_subformat_t sndrv_pcm_subformat_t
#define snd_pcm_state_t sndrv_pcm_state_t
#define snd_interval sndrv_interval
#define snd_mask sndrv_mask
#define snd_ctl_elem_type_t sndrv_ctl_elem_type_t
#define snd_ctl_elem_iface_t sndrv_ctl_elem_iface_t
#define snd_ctl_tlv sndrv_ctl_tlv
/* kill and replace kernel-specific types */
#ifndef __user
#define __user
#endif
#ifndef __force
#define __force
#endif
#include <sound/asound.h>
/* take back superfluous renames; some can be kept as is */
#undef snd_aes_iec958
#undef snd_pcm_uframes_t
#undef snd_pcm_sframes_t
#undef snd_pcm_access_t
#undef snd_pcm_format_t
#undef snd_pcm_subformat_t
#undef snd_pcm_state_t
#undef snd_ctl_elem_type_t
#undef snd_ctl_elem_iface_t
#include "asoundef.h"
#include "alsa-symbols.h"
#include "version.h"
#include "global.h"
#include "input.h"
#include "output.h"
#include "error.h"
#include "conf.h"
#include "pcm.h"
#include "pcm_plugin.h"
#include "rawmidi.h"
#include "ump.h"
#include "timer.h"
#include "hwdep.h"
#include "control.h"
#include "mixer.h"
#include "ump_msg.h"
#include "seq_event.h"
#include "seq.h"
/* rename some types for avoiding conflicts with alsalib's definitions */
#define snd_seq_addr sndrv_seq_addr
#define snd_seq_tick_time_t sndrv_seq_tick_time_t
#define snd_seq_real_time sndrv_seq_real_time
#define snd_seq_timestamp sndrv_seq_timestamp
#define snd_seq_event_type_t sndrv_seq_event_type_t
#define snd_seq_event_data sndrv_seq_event_data
#define snd_seq_event sndrv_seq_event
#define snd_seq_ump_event sndrv_seq_ump_event
#define snd_seq_connect sndrv_seq_connect
#define snd_seq_ev_note sndrv_seq_ev_note
#define snd_seq_ev_ctrl sndrv_seq_ev_ctrl
#define snd_seq_ev_raw8 sndrv_seq_ev_raw8
#define snd_seq_ev_raw32 sndrv_seq_ev_raw32
#define snd_seq_ev_ext sndrv_seq_ev_ext
#define snd_seq_result sndrv_seq_result
#define snd_seq_queue_skew sndrv_seq_queue_skew
#define snd_seq_ev_queue_control sndrv_seq_ev_queue_control
#define snd_seq_ev_ump_notify sndrv_seq_ev_ump_notify
#define snd_seq_client_t sndrv_seq_client_t
#define snd_seq_client_type_t sndrv_seq_client_type_t
#include <sound/asequencer.h>
/* take back some renames */
#undef snd_seq_client_t
#undef snd_seq_client_type_t
#include "seqmid.h"
#include "seq_midi_event.h"
#include "list.h"
struct _snd_async_handler {
enum {
SND_ASYNC_HANDLER_GENERIC,
SND_ASYNC_HANDLER_CTL,
SND_ASYNC_HANDLER_PCM,
SND_ASYNC_HANDLER_TIMER,
} type;
int fd;
union {
snd_ctl_t *ctl;
snd_pcm_t *pcm;
snd_timer_t *timer;
} u;
snd_async_callback_t callback;
void *private_data;
struct list_head glist;
struct list_head hlist;
};
typedef enum _snd_set_mode {
SND_CHANGE,
SND_TRY,
SND_TEST,
} snd_set_mode_t;
size_t page_align(size_t size);
size_t page_size(void);
size_t page_ptr(size_t object_offset, size_t object_size, size_t *offset, size_t *mmap_offset);
#define safe_strtoll_base _snd_safe_strtoll_base
int _snd_safe_strtoll_base(const char *str, long long *val, int base);
static inline int safe_strtoll(const char *str, long long *val) { return safe_strtoll_base(str, val, 0); }
#define safe_strtol_base _snd_safe_strtol_base
int _snd_safe_strtol_base(const char *str, long *val, int base);
static inline int safe_strtol(const char *str, long *val) { return safe_strtol_base(str, val, 0); }
#define safe_strtod _snd_safe_strtod
int _snd_safe_strtod(const char *str, double *val);
int snd_send_fd(int sock, void *data, size_t len, int fd);
int snd_receive_fd(int sock, void *data, size_t len, int *fd);
size_t snd_strlcpy(char *dst, const char *src, size_t size);
size_t snd_strlcat(char *dst, const char *src, size_t size);
/*
* error messages
*/
#ifndef NDEBUG
#define CHECK_SANITY(x) x
extern snd_lib_error_handler_t snd_err_msg;
#define SNDMSG(args...) snd_err_msg(__FILE__, __LINE__, __func__, 0, ##args)
#define SYSMSG(args...) snd_err_msg(__FILE__, __LINE__, __func__, errno, ##args)
#else
#define CHECK_SANITY(x) 0 /* not evaluated */
#define SNDMSG(args...) /* nop */
#define SYSMSG(args...) /* nop */
#endif
/*
*/
#define HAVE_GNU_LD
#define HAVE_ELF
#define HAVE_ASM_PREVIOUS_DIRECTIVE
/* Stolen from libc-symbols.h in GNU glibc */
/* When a reference to SYMBOL is encountered, the linker will emit a
warning message MSG. */
#define ASM_NAME(name) __SYMBOL_PREFIX name
#ifdef HAVE_GNU_LD
# ifdef HAVE_ELF
/* We want the .gnu.warning.SYMBOL section to be unallocated. */
# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
# define __make_section_unallocated(section_string) \
asm (".section " section_string "\n\t.previous");
# elif defined HAVE_ASM_POPSECTION_DIRECTIVE
# define __make_section_unallocated(section_string) \
asm (".pushsection " section_string "\n\t.popsection");
# else
# define __make_section_unallocated(section_string)
# endif
/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
section attributes on what looks like a comment to the assembler. */
# ifdef HAVE_SECTION_QUOTES
# define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." ASM_NAME(#symbol)) \
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((section (".gnu.warning." ASM_NAME(#symbol) "\"\n\t#\""))) = msg;
# else
# define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." ASM_NAME(#symbol)) \
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((section (".gnu.warning." ASM_NAME(#symbol) "\n\t#"))) = msg;
# endif
# else
# define link_warning(symbol, msg) \
asm (".stabs \"" msg "\",30,0,0,0\n\t" \
".stabs \"" ASM_NAME(#symbol) "\",1,0,0,0\n");
# endif
#else
/* We will never be heard; they will all die horribly. */
# define link_warning(symbol, msg)
#endif
static inline int snd_open_device(const char *filename, int fmode)
{
int fd;
#ifdef O_CLOEXEC
fmode |= O_CLOEXEC;
#endif
fd = open(filename, fmode);
/* open with resmgr */
#ifdef SUPPORT_RESMGR
if (fd < 0) {
if (errno == EAGAIN || errno == EBUSY)
return fd;
if (! access(filename, F_OK))
fd = rsm_open_device(filename, fmode);
}
#endif
#ifndef O_CLOEXEC
if (fd >= 0)
fcntl(fd, F_SETFD, FD_CLOEXEC);
#endif
return fd;
}
/* make local functions really local */
#define snd_dlobj_cache_get \
snd1_dlobj_cache_get
#define snd_dlobj_cache_get2 \
snd1_dlobj_cache_get2
#define snd_dlobj_cache_put \
snd1_dlobj_cache_put
#define snd_dlobj_cache_cleanup \
snd1_dlobj_cache_cleanup
#define snd_config_set_hop \
snd1_config_set_hop
#define snd_config_check_hop \
snd1_config_check_hop
#define snd_config_search_alias_hooks \
snd1_config_search_alias_hooks
/* dlobj cache */
void *snd_dlobj_cache_get(const char *lib, const char *name, const char *version, int verbose);
void *snd_dlobj_cache_get2(const char *lib, const char *name, const char *version, int verbose);
int snd_dlobj_cache_put(void *open_func);
void snd_dlobj_cache_cleanup(void);
/* for recursive checks */
void snd_config_set_hop(snd_config_t *conf, int hop);
int snd_config_check_hop(snd_config_t *conf);
#define SND_CONF_MAX_HOPS 64
int snd_config_search_alias_hooks(snd_config_t *config,
const char *base, const char *key,
snd_config_t **result);
int _snd_conf_generic_id(const char *id);
int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in,
int override, const char * const *default_include_path);
/* convenience macros */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#ifdef INTERNAL
void *INTERNAL(snd_dlopen)(const char *name, int mode, char *errbuf, size_t errbuflen);
#endif
#ifdef BUILD_UCM
const char *uc_mgr_alibcfg_by_device(snd_config_t **config, const char *name);
static inline int _snd_is_ucm_device(const char *name)
{
return name && name[0] == '_' && name[1] == 'u' && name[2] == 'c' && name[3] == 'm';
}
#else
static inline const char *uc_mgr_alibcfg_by_device(snd_config_t **config, const char *name) { return NULL; }
static inline int _snd_is_ucm_device(const char *name) { return 0; }
#endif
#endif

324
include/mixer.h Normal file
View file

@ -0,0 +1,324 @@
/**
* \file include/mixer.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/mixer.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_MIXER_H
#define __ALSA_MIXER_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Mixer Mixer Interface
* The mixer interface.
* \{
*/
/** Mixer handle */
typedef struct _snd_mixer snd_mixer_t;
/** Mixer elements class handle */
typedef struct _snd_mixer_class snd_mixer_class_t;
/** Mixer element handle */
typedef struct _snd_mixer_elem snd_mixer_elem_t;
/**
* \brief Mixer callback function
* \param ctl Mixer handle
* \param mask event mask
* \param elem related mixer element (if any)
* \return 0 on success otherwise a negative error code
*/
typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
unsigned int mask,
snd_mixer_elem_t *elem);
/**
* \brief Mixer element callback function
* \param elem Mixer element
* \param mask event mask
* \return 0 on success otherwise a negative error code
*/
typedef int (*snd_mixer_elem_callback_t)(snd_mixer_elem_t *elem,
unsigned int mask);
/**
* \brief Compare function for sorting mixer elements
* \param e1 First element
* \param e2 Second element
* \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
*/
typedef int (*snd_mixer_compare_t)(const snd_mixer_elem_t *e1,
const snd_mixer_elem_t *e2);
/**
* \brief Event callback for the mixer class
* \param class_ Mixer class
* \param mask Event mask (SND_CTL_EVENT_*)
* \param helem HCTL element which invoked the event
* \param melem Mixer element associated to HCTL element
* \return zero if success, otherwise a negative error value
*/
typedef int (*snd_mixer_event_t)(snd_mixer_class_t *class_, unsigned int mask,
snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
/** Mixer element type */
typedef enum _snd_mixer_elem_type {
/* Simple mixer elements */
SND_MIXER_ELEM_SIMPLE,
SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE
} snd_mixer_elem_type_t;
int snd_mixer_open(snd_mixer_t **mixer, int mode);
int snd_mixer_close(snd_mixer_t *mixer);
snd_mixer_elem_t *snd_mixer_first_elem(snd_mixer_t *mixer);
snd_mixer_elem_t *snd_mixer_last_elem(snd_mixer_t *mixer);
int snd_mixer_handle_events(snd_mixer_t *mixer);
int snd_mixer_attach(snd_mixer_t *mixer, const char *name);
int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
int snd_mixer_detach(snd_mixer_t *mixer, const char *name);
int snd_mixer_detach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
int snd_mixer_get_hctl(snd_mixer_t *mixer, const char *name, snd_hctl_t **hctl);
int snd_mixer_poll_descriptors_count(snd_mixer_t *mixer);
int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space);
int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_mixer_load(snd_mixer_t *mixer);
void snd_mixer_free(snd_mixer_t *mixer);
int snd_mixer_wait(snd_mixer_t *mixer, int timeout);
int snd_mixer_set_compare(snd_mixer_t *mixer, snd_mixer_compare_t msort);
void snd_mixer_set_callback(snd_mixer_t *obj, snd_mixer_callback_t val);
void * snd_mixer_get_callback_private(const snd_mixer_t *obj);
void snd_mixer_set_callback_private(snd_mixer_t *obj, void * val);
unsigned int snd_mixer_get_count(const snd_mixer_t *obj);
int snd_mixer_class_unregister(snd_mixer_class_t *clss);
snd_mixer_elem_t *snd_mixer_elem_next(snd_mixer_elem_t *elem);
snd_mixer_elem_t *snd_mixer_elem_prev(snd_mixer_elem_t *elem);
void snd_mixer_elem_set_callback(snd_mixer_elem_t *obj, snd_mixer_elem_callback_t val);
void * snd_mixer_elem_get_callback_private(const snd_mixer_elem_t *obj);
void snd_mixer_elem_set_callback_private(snd_mixer_elem_t *obj, void * val);
snd_mixer_elem_type_t snd_mixer_elem_get_type(const snd_mixer_elem_t *obj);
int snd_mixer_class_register(snd_mixer_class_t *class_, snd_mixer_t *mixer);
int snd_mixer_elem_new(snd_mixer_elem_t **elem,
snd_mixer_elem_type_t type,
int compare_weight,
void *private_data,
void (*private_free)(snd_mixer_elem_t *elem));
int snd_mixer_elem_add(snd_mixer_elem_t *elem, snd_mixer_class_t *class_);
int snd_mixer_elem_remove(snd_mixer_elem_t *elem);
void snd_mixer_elem_free(snd_mixer_elem_t *elem);
int snd_mixer_elem_info(snd_mixer_elem_t *elem);
int snd_mixer_elem_value(snd_mixer_elem_t *elem);
int snd_mixer_elem_attach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
int snd_mixer_elem_detach(snd_mixer_elem_t *melem, snd_hctl_elem_t *helem);
int snd_mixer_elem_empty(snd_mixer_elem_t *melem);
void *snd_mixer_elem_get_private(const snd_mixer_elem_t *melem);
size_t snd_mixer_class_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_mixer_class_t using standard alloca
* \param ptr returned pointer
*/
#define snd_mixer_class_alloca(ptr) __snd_alloca(ptr, snd_mixer_class)
int snd_mixer_class_malloc(snd_mixer_class_t **ptr);
void snd_mixer_class_free(snd_mixer_class_t *obj);
void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src);
snd_mixer_t *snd_mixer_class_get_mixer(const snd_mixer_class_t *class_);
snd_mixer_event_t snd_mixer_class_get_event(const snd_mixer_class_t *class_);
void *snd_mixer_class_get_private(const snd_mixer_class_t *class_);
snd_mixer_compare_t snd_mixer_class_get_compare(const snd_mixer_class_t *class_);
int snd_mixer_class_set_event(snd_mixer_class_t *class_, snd_mixer_event_t event);
int snd_mixer_class_set_private(snd_mixer_class_t *class_, void *private_data);
int snd_mixer_class_set_private_free(snd_mixer_class_t *class_, void (*private_free)(snd_mixer_class_t *));
int snd_mixer_class_set_compare(snd_mixer_class_t *class_, snd_mixer_compare_t compare);
/**
* \defgroup SimpleMixer Simple Mixer Interface
* \ingroup Mixer
* The simple mixer interface.
* \{
*/
/* Simple mixer elements API */
/** Mixer simple element channel identifier */
typedef enum _snd_mixer_selem_channel_id {
/** Unknown */
SND_MIXER_SCHN_UNKNOWN = -1,
/** Front left */
SND_MIXER_SCHN_FRONT_LEFT = 0,
/** Front right */
SND_MIXER_SCHN_FRONT_RIGHT,
/** Rear left */
SND_MIXER_SCHN_REAR_LEFT,
/** Rear right */
SND_MIXER_SCHN_REAR_RIGHT,
/** Front center */
SND_MIXER_SCHN_FRONT_CENTER,
/** Woofer */
SND_MIXER_SCHN_WOOFER,
/** Side Left */
SND_MIXER_SCHN_SIDE_LEFT,
/** Side Right */
SND_MIXER_SCHN_SIDE_RIGHT,
/** Rear Center */
SND_MIXER_SCHN_REAR_CENTER,
SND_MIXER_SCHN_LAST = 31,
/** Mono (Front left alias) */
SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT
} snd_mixer_selem_channel_id_t;
/** Mixer simple element - register options - abstraction level */
enum snd_mixer_selem_regopt_abstract {
/** no abstraction - try use all universal controls from driver */
SND_MIXER_SABSTRACT_NONE = 0,
/** basic abstraction - Master,PCM,CD,Aux,Record-Gain etc. */
SND_MIXER_SABSTRACT_BASIC,
};
/** Mixer simple element - register options */
struct snd_mixer_selem_regopt {
/** structure version */
int ver;
/** v1: abstract layer selection */
enum snd_mixer_selem_regopt_abstract abstract;
/** v1: device name (must be NULL when playback_pcm or capture_pcm != NULL) */
const char *device;
/** v1: playback PCM connected to mixer device (NULL == none) */
snd_pcm_t *playback_pcm;
/** v1: capture PCM connected to mixer device (NULL == none) */
snd_pcm_t *capture_pcm;
};
/** Mixer simple element identifier */
typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel);
int snd_mixer_selem_register(snd_mixer_t *mixer,
struct snd_mixer_selem_regopt *options,
snd_mixer_class_t **classp);
void snd_mixer_selem_get_id(snd_mixer_elem_t *element,
snd_mixer_selem_id_t *id);
const char *snd_mixer_selem_get_name(snd_mixer_elem_t *elem);
unsigned int snd_mixer_selem_get_index(snd_mixer_elem_t *elem);
snd_mixer_elem_t *snd_mixer_find_selem(snd_mixer_t *mixer,
const snd_mixer_selem_id_t *id);
int snd_mixer_selem_is_active(snd_mixer_elem_t *elem);
int snd_mixer_selem_is_playback_mono(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_playback_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
int snd_mixer_selem_is_capture_mono(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_capture_channel(snd_mixer_elem_t *obj, snd_mixer_selem_channel_id_t channel);
int snd_mixer_selem_get_capture_group(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_common_volume(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_playback_volume(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_playback_volume_joined(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_capture_volume(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_capture_volume_joined(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_common_switch(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_playback_switch(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_playback_switch_joined(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_capture_switch(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_capture_switch_joined(snd_mixer_elem_t *elem);
int snd_mixer_selem_has_capture_switch_exclusive(snd_mixer_elem_t *elem);
int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
int snd_mixer_selem_get_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
int snd_mixer_selem_get_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
int snd_mixer_selem_get_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
int snd_mixer_selem_get_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long *value);
int snd_mixer_selem_get_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
int snd_mixer_selem_get_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int *value);
int snd_mixer_selem_set_playback_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value);
int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
int snd_mixer_selem_set_playback_volume_all(snd_mixer_elem_t *elem, long value);
int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value);
int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir);
int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir);
int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value);
int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value);
int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value);
int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem,
long *min, long *max);
int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
long *min, long *max);
int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
long min, long max);
int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem,
long *min, long *max);
int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
long *min, long *max);
int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
long min, long max);
int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem);
int snd_mixer_selem_is_enum_playback(snd_mixer_elem_t *elem);
int snd_mixer_selem_is_enum_capture(snd_mixer_elem_t *elem);
int snd_mixer_selem_get_enum_items(snd_mixer_elem_t *elem);
int snd_mixer_selem_get_enum_item_name(snd_mixer_elem_t *elem, unsigned int idx, size_t maxlen, char *str);
int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *idxp);
int snd_mixer_selem_set_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int idx);
size_t snd_mixer_selem_id_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_mixer_selem_id_t using standard alloca
* \param ptr returned pointer
*/
#define snd_mixer_selem_id_alloca(ptr) __snd_alloca(ptr, snd_mixer_selem_id)
int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr);
void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj);
void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src);
const char *snd_mixer_selem_id_get_name(const snd_mixer_selem_id_t *obj);
unsigned int snd_mixer_selem_id_get_index(const snd_mixer_selem_id_t *obj);
void snd_mixer_selem_id_set_name(snd_mixer_selem_id_t *obj, const char *val);
void snd_mixer_selem_id_set_index(snd_mixer_selem_id_t *obj, unsigned int val);
int snd_mixer_selem_id_parse(snd_mixer_selem_id_t *dst, const char *str);
/** \} */
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_MIXER_H */

112
include/mixer_abst.h Normal file
View file

@ -0,0 +1,112 @@
/**
* \file include/mixer_abst.h
* \brief Mixer abstract implementation interface library for the ALSA library
* \author Jaroslav Kysela <perex@perex.cz>
* \date 2005
*
* Mixer abstact implementation interface library for the ALSA library
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ALSA_MIXER_ABST_H
#define __ALSA_MIXER_ABST_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Mixer_Abstract Mixer Abstact Module Interface
* The mixer abstact module interface.
* \{
*/
#define SM_PLAY 0
#define SM_CAPT 1
#define SM_CAP_GVOLUME (1<<1)
#define SM_CAP_GSWITCH (1<<2)
#define SM_CAP_PVOLUME (1<<3)
#define SM_CAP_PVOLUME_JOIN (1<<4)
#define SM_CAP_PSWITCH (1<<5)
#define SM_CAP_PSWITCH_JOIN (1<<6)
#define SM_CAP_CVOLUME (1<<7)
#define SM_CAP_CVOLUME_JOIN (1<<8)
#define SM_CAP_CSWITCH (1<<9)
#define SM_CAP_CSWITCH_JOIN (1<<10)
#define SM_CAP_CSWITCH_EXCL (1<<11)
#define SM_CAP_PENUM (1<<12)
#define SM_CAP_CENUM (1<<13)
/* SM_CAP_* 24-31 => private for module use */
#define SM_OPS_IS_ACTIVE 0
#define SM_OPS_IS_MONO 1
#define SM_OPS_IS_CHANNEL 2
#define SM_OPS_IS_ENUMERATED 3
#define SM_OPS_IS_ENUMCNT 4
#define sm_selem(x) ((sm_selem_t *)((x)->private_data))
#define sm_selem_ops(x) ((sm_selem_t *)((x)->private_data))->ops
typedef struct _sm_selem {
snd_mixer_selem_id_t *id;
struct sm_elem_ops *ops;
unsigned int caps;
unsigned int capture_group;
} sm_selem_t;
typedef struct _sm_class_basic {
char *device;
snd_ctl_t *ctl;
snd_hctl_t *hctl;
snd_ctl_card_info_t *info;
} sm_class_basic_t;
struct sm_elem_ops {
int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val);
int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max);
int (*get_dB_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max);
int (*ask_vol_dB)(snd_mixer_elem_t *elem, int dir, long value, long *dbValue);
int (*ask_dB_vol)(snd_mixer_elem_t *elem, int dir, long dbValue, long *value, int xdir);
int (*get_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
int (*get_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value);
int (*set_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value);
int (*set_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value, int xdir);
int (*get_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int *value);
int (*set_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value);
int (*enum_item_name)(snd_mixer_elem_t *elem, unsigned int item, size_t maxlen, char *buf);
int (*get_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp);
int (*set_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int item);
};
int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2);
int snd_mixer_sbasic_info(const snd_mixer_class_t *mixer_class, sm_class_basic_t *info);
void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *mixer_class);
void snd_mixer_sbasic_set_private(const snd_mixer_class_t *mixer_class, void *private_data);
void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *mixer_class, void (*private_free)(snd_mixer_class_t *mixer_class));
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_MIXER_ABST_H */

93
include/output.h Normal file
View file

@ -0,0 +1,93 @@
/**
* \file include/output.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/input.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_OUTPUT_H
#define __ALSA_OUTPUT_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Output Output Interface
*
* The output functions present an interface similar to the stdio functions
* on top of different underlying output destinations.
*
* Many PCM debugging functions (\c snd_pcm_xxx_dump_xxx) use such an output
* handle to be able to write not only to the screen but also to other
* destinations, e.g. to files or to memory buffers.
*
* \{
*/
/**
* \brief Internal structure for an output object.
*
* The ALSA library uses a pointer to this structure as a handle to an
* output object. Applications don't access its contents directly.
*/
typedef struct _snd_output snd_output_t;
/** Output type. */
typedef enum _snd_output_type {
/** Output to a stdio stream. */
SND_OUTPUT_STDIO,
/** Output to a memory buffer. */
SND_OUTPUT_BUFFER
} snd_output_type_t;
int snd_output_stdio_open(snd_output_t **outputp, const char *file, const char *mode);
int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close);
int snd_output_buffer_open(snd_output_t **outputp);
size_t snd_output_buffer_string(snd_output_t *output, char **buf);
size_t snd_output_buffer_steal(snd_output_t *output, char **buf);
int snd_output_close(snd_output_t *output);
int snd_output_printf(snd_output_t *output, const char *format, ...)
#ifndef DOC_HIDDEN
__attribute__ ((format (printf, 2, 3)))
#endif
;
int snd_output_vprintf(snd_output_t *output, const char *format, va_list args);
int snd_output_puts(snd_output_t *output, const char *str);
int snd_output_putc(snd_output_t *output, int c);
int snd_output_flush(snd_output_t *output);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_OUTPUT_H */

1422
include/pcm.h Normal file

File diff suppressed because it is too large Load diff

72
include/pcm_external.h Normal file
View file

@ -0,0 +1,72 @@
/**
* \file include/pcm_external.h
* \brief External PCM plugin SDK
* \author Takashi Iwai <tiwai@suse.de>
* \date 2005
*
* Extern PCM plugin SDK.
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ALSA_PCM_EXTERNAL_H
#define __ALSA_PCM_EXTERNAL_H
#ifndef __ASOUNDLIB_LOCAL
#include <alsa/asoundlib.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Plugin_SDK External PCM plugin SDK
* \{
*/
/**
* Define the object entry for external PCM plugins
*/
#define SND_PCM_PLUGIN_ENTRY(name) _snd_pcm_##name##_open
/**
* Define the symbols of the given plugin with versions
*/
#define SND_PCM_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_PCM_PLUGIN_ENTRY(name), SND_PCM_DLSYM_VERSION);
/**
* Define the plugin
*/
#define SND_PCM_PLUGIN_DEFINE_FUNC(plugin) \
int SND_PCM_PLUGIN_ENTRY(plugin) (snd_pcm_t **pcmp, const char *name,\
snd_config_t *root, snd_config_t *conf, \
snd_pcm_stream_t stream, int mode)
#include "pcm_ioplug.h"
#include "pcm_extplug.h"
int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int *cardp,
int *cchannelsp, int *hwctlp) __attribute__((deprecated));
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_PCM_EXTERNAL_H */

213
include/pcm_extplug.h Normal file
View file

@ -0,0 +1,213 @@
/**
* \file include/pcm_extplug.h
* \brief External Filter-Plugin SDK
* \author Takashi Iwai <tiwai@suse.de>
* \date 2005
*
* External Filter-Plugin SDK
*/
/*
* ALSA external PCM plugin SDK (draft version)
*
* Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ALSA_PCM_EXTERNAL_H) && !defined(ALSA_LIBRARY_BUILD)
#warning "use #include <alsa/pcm_external.h>, <alsa/pcm_extplug.h> should not be used directly"
#include <alsa/pcm_external.h>
#endif
#ifndef __ALSA_PCM_EXTPLUG_H
#define __ALSA_PCM_EXTPLUG_H
/**
* \defgroup PCM_ExtPlug External Filter plugin SDK
* \ingroup Plugin_SDK
* See the \ref pcm page for more details.
* \{
*/
/** hw constraints for extplug */
enum {
SND_PCM_EXTPLUG_HW_FORMAT, /**< format */
SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */
SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */
};
/** Handle of external filter plugin */
typedef struct snd_pcm_extplug snd_pcm_extplug_t;
/** Callback table of extplug */
typedef struct snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
#ifdef DOC_HIDDEN
/* redefine typedefs for stupid doxygen */
typedef snd_pcm_extplug snd_pcm_extplug_t;
typedef snd_pcm_extplug_callback snd_pcm_extplug_callback_t;
#endif
/*
* Protocol version
*/
#define SND_PCM_EXTPLUG_VERSION_MAJOR 1 /**< Protocol major version */
#define SND_PCM_EXTPLUG_VERSION_MINOR 0 /**< Protocol minor version */
#define SND_PCM_EXTPLUG_VERSION_TINY 2 /**< Protocol tiny version */
/**
* Filter-plugin protocol version
*/
#define SND_PCM_EXTPLUG_VERSION ((SND_PCM_EXTPLUG_VERSION_MAJOR<<16) |\
(SND_PCM_EXTPLUG_VERSION_MINOR<<8) |\
(SND_PCM_EXTPLUG_VERSION_TINY))
/** Handle of extplug */
struct snd_pcm_extplug {
/**
* protocol version; #SND_PCM_EXTPLUG_VERSION must be filled here
* before calling #snd_pcm_extplug_create()
*/
unsigned int version;
/**
* name of this plugin; must be filled before calling #snd_pcm_extplug_create()
*/
const char *name;
/**
* callbacks of this plugin; must be filled before calling #snd_pcm_extplug_create()
*/
const snd_pcm_extplug_callback_t *callback;
/**
* private data, which can be used freely in the driver callbacks
*/
void *private_data;
/**
* PCM handle filled by #snd_pcm_extplug_create()
*/
snd_pcm_t *pcm;
/**
* stream direction; read-only status
*/
snd_pcm_stream_t stream;
/**
* format hw parameter; filled after hw_params is caled
*/
snd_pcm_format_t format;
/**
* subformat hw parameter; filled after hw_params is caled
*/
snd_pcm_subformat_t subformat;
/**
* channels hw parameter; filled after hw_params is caled
*/
unsigned int channels;
/**
* rate hw parameter; filled after hw_params is caled
*/
unsigned int rate;
/**
* slave_format hw parameter; filled after hw_params is caled
*/
snd_pcm_format_t slave_format;
/**
* slave_subformat hw parameter; filled after hw_params is caled
*/
snd_pcm_subformat_t slave_subformat;
/**
* slave_channels hw parameter; filled after hw_params is caled
*/
unsigned int slave_channels;
};
/** Callback table of extplug */
struct snd_pcm_extplug_callback {
/**
* transfer between source and destination; this is a required callback
*/
snd_pcm_sframes_t (*transfer)(snd_pcm_extplug_t *ext,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
snd_pcm_uframes_t size);
/**
* close the PCM; optional
*/
int (*close)(snd_pcm_extplug_t *ext);
/**
* hw_params; optional
*/
int (*hw_params)(snd_pcm_extplug_t *ext, snd_pcm_hw_params_t *params);
/**
* hw_free; optional
*/
int (*hw_free)(snd_pcm_extplug_t *ext);
/**
* dump; optional
*/
void (*dump)(snd_pcm_extplug_t *ext, snd_output_t *out);
/**
* init; optional initialization called at prepare or reset
*/
int (*init)(snd_pcm_extplug_t *ext);
/**
* query the channel maps; optional; since v1.0.2
*/
snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_extplug_t *ext);
/**
* get the channel map; optional; since v1.0.2
*/
snd_pcm_chmap_t *(*get_chmap)(snd_pcm_extplug_t *ext);
/**
* set the channel map; optional; since v1.0.2
*/
int (*set_chmap)(snd_pcm_extplug_t *ext, const snd_pcm_chmap_t *map);
};
int snd_pcm_extplug_create(snd_pcm_extplug_t *ext, const char *name,
snd_config_t *root, snd_config_t *slave_conf,
snd_pcm_stream_t stream, int mode);
int snd_pcm_extplug_delete(snd_pcm_extplug_t *ext);
/* clear hw_parameter setting */
void snd_pcm_extplug_params_reset(snd_pcm_extplug_t *ext);
/* hw_parameter setting */
int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, unsigned int num_list, const unsigned int *list);
int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type, unsigned int min, unsigned int max);
int snd_pcm_extplug_set_param_link(snd_pcm_extplug_t *extplug, int type,
int keep_link);
/**
* set the parameter constraint with a single value
*/
static __inline__ int snd_pcm_extplug_set_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
{
return snd_pcm_extplug_set_param_list(extplug, type, 1, &val);
}
/**
* set the parameter constraint for slave PCM with a single value
*/
static __inline__ int snd_pcm_extplug_set_slave_param(snd_pcm_extplug_t *extplug, int type, unsigned int val)
{
return snd_pcm_extplug_set_slave_param_list(extplug, type, 1, &val);
}
/** \} */
#endif /* __ALSA_PCM_EXTPLUG_H */

252
include/pcm_ioplug.h Normal file
View file

@ -0,0 +1,252 @@
/**
* \file include/pcm_ioplug.h
* \brief External I/O-Plugin SDK
* \author Takashi Iwai <tiwai@suse.de>
* \date 2005
*
* External I/O-Plugin SDK
*/
/*
* ALSA external PCM plugin SDK
*
* Copyright (c) 2005 Takashi Iwai <tiwai@suse.de>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ALSA_PCM_EXTERNAL_H) && !defined(ALSA_LIBRARY_BUILD)
#warning "use #include <alsa/pcm_external.h>, <alsa/pcm_ioplug.h> should not be used directly"
#include <alsa/pcm_external.h>
#endif
#ifndef __ALSA_PCM_IOPLUG_H
#define __ALSA_PCM_IOPLUG_H
/**
* \defgroup PCM_IOPlug External I/O plugin SDK
* \ingroup Plugin_SDK
* See the \ref pcm page for more details.
* \{
*/
/** hw constraints for ioplug */
enum {
SND_PCM_IOPLUG_HW_ACCESS = 0, /**< access type */
SND_PCM_IOPLUG_HW_FORMAT, /**< format */
SND_PCM_IOPLUG_HW_CHANNELS, /**< channels */
SND_PCM_IOPLUG_HW_RATE, /**< rate */
SND_PCM_IOPLUG_HW_PERIOD_BYTES, /**< period bytes */
SND_PCM_IOPLUG_HW_BUFFER_BYTES, /**< buffer bytes */
SND_PCM_IOPLUG_HW_PERIODS, /**< number of periods */
SND_PCM_IOPLUG_HW_PARAMS /**< max number of hw constraints */
};
/** I/O plugin handle */
typedef struct snd_pcm_ioplug snd_pcm_ioplug_t;
/** Callback table of ioplug */
typedef struct snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
#ifdef DOC_HIDDEN
/* redefine typedefs for stupid doxygen */
typedef snd_pcm_ioplug snd_pcm_ioplug_t;
typedef snd_pcm_ioplug_callback snd_pcm_ioplug_callback_t;
#endif
/*
* bit flags for additional conditions
*/
#define SND_PCM_IOPLUG_FLAG_LISTED (1<<0) /**< list up this PCM */
#define SND_PCM_IOPLUG_FLAG_MONOTONIC (1<<1) /**< monotonic timestamps */
/** hw pointer wrap around at boundary instead of buffer_size */
#define SND_PCM_IOPLUG_FLAG_BOUNDARY_WA (1<<2)
/*
* Protocol version
*/
#define SND_PCM_IOPLUG_VERSION_MAJOR 1 /**< Protocol major version */
#define SND_PCM_IOPLUG_VERSION_MINOR 0 /**< Protocol minor version */
#define SND_PCM_IOPLUG_VERSION_TINY 2 /**< Protocol tiny version */
/**
* IO-plugin protocol version
*/
#define SND_PCM_IOPLUG_VERSION ((SND_PCM_IOPLUG_VERSION_MAJOR<<16) |\
(SND_PCM_IOPLUG_VERSION_MINOR<<8) |\
(SND_PCM_IOPLUG_VERSION_TINY))
/** Handle of ioplug */
struct snd_pcm_ioplug {
/**
* protocol version; #SND_PCM_IOPLUG_VERSION must be filled here
* before calling #snd_pcm_ioplug_create()
*/
unsigned int version;
/**
* name of this plugin; must be filled before calling #snd_pcm_ioplug_create()
*/
const char *name;
unsigned int flags; /**< SND_PCM_IOPLUG_FLAG_XXX */
int poll_fd; /**< poll file descriptor */
unsigned int poll_events; /**< poll events */
unsigned int mmap_rw; /**< pseudo mmap mode */
/**
* callbacks of this plugin; must be filled before calling #snd_pcm_ioplug_create()
*/
const snd_pcm_ioplug_callback_t *callback;
/**
* private data, which can be used freely in the driver callbacks
*/
void *private_data;
/**
* PCM handle filled by #snd_pcm_ioplug_create()
*/
snd_pcm_t *pcm;
snd_pcm_stream_t stream; /**< stream direcion; read-only */
snd_pcm_state_t state; /**< current PCM state; read-only */
volatile snd_pcm_uframes_t appl_ptr; /**< application pointer; read-only */
volatile snd_pcm_uframes_t hw_ptr; /**< hw pointer; read-only */
int nonblock; /**< non-block mode; read-only */
snd_pcm_access_t access; /**< access type; filled after hw_params is called */
snd_pcm_format_t format; /**< PCM format; filled after hw_params is called */
unsigned int channels; /**< number of channels; filled after hw_params is called */
unsigned int rate; /**< rate; filled after hw_params is called */
snd_pcm_uframes_t period_size; /**< period size; filled after hw_params is called */
snd_pcm_uframes_t buffer_size; /**< buffer size; filled after hw_params is called */
};
/** Callback table of ioplug */
struct snd_pcm_ioplug_callback {
/**
* start the PCM; required, called inside mutex lock
*/
int (*start)(snd_pcm_ioplug_t *io);
/**
* stop the PCM; required, called inside mutex lock
*/
int (*stop)(snd_pcm_ioplug_t *io);
/**
* get the current DMA position; required, called inside mutex lock
* \return buffer position up to buffer_size or
* when #SND_PCM_IOPLUG_FLAG_BOUNDARY_WA flag is set up to boundary or
* a negative error code for Xrun
*/
snd_pcm_sframes_t (*pointer)(snd_pcm_ioplug_t *io);
/**
* transfer the data; optional, called inside mutex lock
*/
snd_pcm_sframes_t (*transfer)(snd_pcm_ioplug_t *io,
const snd_pcm_channel_area_t *areas,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t size);
/**
* close the PCM; optional
*/
int (*close)(snd_pcm_ioplug_t *io);
/**
* hw_params; optional
*/
int (*hw_params)(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params);
/**
* hw_free; optional
*/
int (*hw_free)(snd_pcm_ioplug_t *io);
/**
* sw_params; optional
*/
int (*sw_params)(snd_pcm_ioplug_t *io, snd_pcm_sw_params_t *params);
/**
* prepare; optional
*/
int (*prepare)(snd_pcm_ioplug_t *io);
/**
* drain; optional
*/
int (*drain)(snd_pcm_ioplug_t *io);
/**
* toggle pause; optional, called inside mutex lock
*/
int (*pause)(snd_pcm_ioplug_t *io, int enable);
/**
* resume; optional
*/
int (*resume)(snd_pcm_ioplug_t *io);
/**
* poll descriptors count; optional
*/
int (*poll_descriptors_count)(snd_pcm_ioplug_t *io);
/**
* poll descriptors; optional
*/
int (*poll_descriptors)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int space);
/**
* mangle poll events; optional
*/
int (*poll_revents)(snd_pcm_ioplug_t *io, struct pollfd *pfd, unsigned int nfds, unsigned short *revents);
/**
* dump; optional
*/
void (*dump)(snd_pcm_ioplug_t *io, snd_output_t *out);
/**
* get the delay for the running PCM; optional; since v1.0.1
*/
int (*delay)(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp);
/**
* query the channel maps; optional; since v1.0.2
*/
snd_pcm_chmap_query_t **(*query_chmaps)(snd_pcm_ioplug_t *io);
/**
* get the channel map; optional; since v1.0.2
*/
snd_pcm_chmap_t *(*get_chmap)(snd_pcm_ioplug_t *io);
/**
* set the channel map; optional; since v1.0.2
*/
int (*set_chmap)(snd_pcm_ioplug_t *io, const snd_pcm_chmap_t *map);
};
int snd_pcm_ioplug_create(snd_pcm_ioplug_t *io, const char *name,
snd_pcm_stream_t stream, int mode);
int snd_pcm_ioplug_delete(snd_pcm_ioplug_t *io);
/* update poll_fd and mmap_rw */
int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug);
/* get a mmap area (for mmap_rw only) */
const snd_pcm_channel_area_t *snd_pcm_ioplug_mmap_areas(snd_pcm_ioplug_t *ioplug);
/* clear hw_parameter setting */
void snd_pcm_ioplug_params_reset(snd_pcm_ioplug_t *io);
/* hw_parameter setting */
int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
/* change PCM status */
int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
/* calucalte the available frames */
snd_pcm_uframes_t snd_pcm_ioplug_avail(const snd_pcm_ioplug_t * const ioplug,
const snd_pcm_uframes_t hw_ptr,
const snd_pcm_uframes_t appl_ptr);
snd_pcm_uframes_t snd_pcm_ioplug_hw_avail(const snd_pcm_ioplug_t * const ioplug,
const snd_pcm_uframes_t hw_ptr,
const snd_pcm_uframes_t appl_ptr);
/** \} */
#endif /* __ALSA_PCM_IOPLUG_H */

238
include/pcm_old.h Normal file
View file

@ -0,0 +1,238 @@
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#error "use #include <alsa/asoundlib.h>, <alsa/pcm_old.h> should not be used directly"
#endif
/*
* Old ALSA 0.9.x API
*/
#define ___symbol_version(name, version) \
__asm__ (".symver " #name "," #name "@" version)
#ifdef ALSA_PCM_OLD_HW_PARAMS_API
___symbol_version(snd_pcm_hw_params_get_access, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_access_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_access_last, "ALSA_0.9");
int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
___symbol_version(snd_pcm_hw_params_get_format, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_format_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_format_last, "ALSA_0.9");
int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
___symbol_version(snd_pcm_hw_params_get_subformat, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_subformat_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_subformat_last, "ALSA_0.9");
int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
___symbol_version(snd_pcm_hw_params_get_channels, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_channels_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_channels_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_channels_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_channels_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_channels_last, "ALSA_0.9");
int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
___symbol_version(snd_pcm_hw_params_get_rate, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_rate_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_rate_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_rate_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_rate_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_rate_last, "ALSA_0.9");
int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
___symbol_version(snd_pcm_hw_params_get_period_time, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_time_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_time_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_time_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_time_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_time_last, "ALSA_0.9");
int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
___symbol_version(snd_pcm_hw_params_get_period_size, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_size_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_period_size_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_size_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_size_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_period_size_last, "ALSA_0.9");
snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);
int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir);
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
___symbol_version(snd_pcm_hw_params_get_periods, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_periods_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_periods_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_periods_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_periods_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_periods_last, "ALSA_0.9");
int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
___symbol_version(snd_pcm_hw_params_get_buffer_time, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_time_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_time_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_time_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_time_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_time_last, "ALSA_0.9");
int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
___symbol_version(snd_pcm_hw_params_get_buffer_size, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_size_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_buffer_size_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_size_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_size_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_buffer_size_last, "ALSA_0.9");
snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params);
snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params);
snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max);
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
___symbol_version(snd_pcm_hw_params_get_tick_time, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_tick_time_min, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_get_tick_time_max, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_tick_time_near, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_tick_time_first, "ALSA_0.9");
___symbol_version(snd_pcm_hw_params_set_tick_time_last, "ALSA_0.9");
int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir);
int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
#endif /* ALSA_PCM_OLD_HW_PARAMS_API */
#ifdef ALSA_PCM_OLD_SW_PARAMS_API
___symbol_version(snd_pcm_sw_params_get_tstamp_mode, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_sleep_min, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_avail_min, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_xfer_align, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_start_threshold, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_stop_threshold, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_silence_threshold, "ALSA_0.9");
___symbol_version(snd_pcm_sw_params_get_silence_size, "ALSA_0.9");
int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params);
int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val);
unsigned int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params);
int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params);
int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params);
int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *params);
int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params);
int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params);
int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params);
#endif /* ALSA_PCM_OLD_SW_PARAMS_API */

216
include/pcm_plugin.h Normal file
View file

@ -0,0 +1,216 @@
/**
* \file include/pcm_plugin.h
* \brief Common PCM plugin code
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Jaroslav Kysela <perex@perex.cz>
* \date 2000-2001
*
* Application interface library for the ALSA driver.
* See the \ref pcm_plugins page for more details.
*
* \warning Using of contents of this header file might be dangerous
* in the sense of compatibility reasons. The contents might be
* freely changed in future.
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ALSA_PCM_PLUGIN_H
#define __ALSA_PCM_PLUGIN_H
/**
* \defgroup PCM_Plugins PCM Plugins
* \ingroup PCM
* See the \ref pcm_plugins page for more details.
* \{
*/
#define SND_PCM_PLUGIN_RATE_MIN 4000 /**< minimal rate for the rate plugin */
#define SND_PCM_PLUGIN_RATE_MAX 768000 /**< maximal rate for the rate plugin */
/* ROUTE_FLOAT should be set to 0 for machines without FP unit - like iPAQ */
#ifdef HAVE_SOFT_FLOAT
#define SND_PCM_PLUGIN_ROUTE_FLOAT 0 /**< use integers for route plugin */
#else
#define SND_PCM_PLUGIN_ROUTE_FLOAT 1 /**< use floats for route plugin */
#endif
#define SND_PCM_PLUGIN_ROUTE_RESOLUTION 16 /**< integer resolution for route plugin */
#if SND_PCM_PLUGIN_ROUTE_FLOAT
/** route ttable entry type */
typedef float snd_pcm_route_ttable_entry_t;
#define SND_PCM_PLUGIN_ROUTE_HALF 0.5 /**< half value */
#define SND_PCM_PLUGIN_ROUTE_FULL 1.0 /**< full value */
#else
/** route ttable entry type */
typedef int snd_pcm_route_ttable_entry_t;
#define SND_PCM_PLUGIN_ROUTE_HALF (SND_PCM_PLUGIN_ROUTE_RESOLUTION / 2) /**< half value */
#define SND_PCM_PLUGIN_ROUTE_FULL SND_PCM_PLUGIN_ROUTE_RESOLUTION /**< full value */
#endif
/*
* Hardware plugin
*/
int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
int card, int device, int subdevice,
snd_pcm_stream_t stream, int mode,
int mmap_emulation, int sync_ptr_ioctl);
int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Copy plugin
*/
int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_t *slave, int close_slave);
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Linear conversion plugin
*/
int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, snd_pcm_t *slave,
int close_slave);
int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Linear<->Float conversion plugin
*/
int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, snd_pcm_t *slave,
int close_slave);
int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Linear<->mu-Law conversion plugin
*/
int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, snd_pcm_t *slave,
int close_slave);
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Linear<->a-Law conversion plugin
*/
int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, snd_pcm_t *slave,
int close_slave);
int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Linear<->Ima-ADPCM conversion plugin
*/
int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, snd_pcm_t *slave,
int close_slave);
int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* IEC958 subframe conversion plugin
*/
int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, snd_pcm_t *slave,
int close_slave,
const unsigned char *status_bits,
const unsigned char *preamble_vals,
int hdmi_mode);
int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Route plugin for linear formats
*/
int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *ttable,
unsigned int tt_csize, unsigned int tt_ssize,
unsigned int *tt_cused, unsigned int *tt_sused,
int schannels);
int snd_pcm_route_determine_ttable(snd_config_t *tt,
unsigned int *tt_csize,
unsigned int *tt_ssize);
int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, int schannels,
snd_pcm_route_ttable_entry_t *ttable,
unsigned int tt_ssize,
unsigned int tt_cused, unsigned int tt_sused,
snd_pcm_t *slave, int close_slave);
int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Rate plugin for linear formats
*/
int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_format_t sformat, unsigned int srate,
const snd_config_t *converter,
snd_pcm_t *slave, int close_slave);
int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Hooks plugin
*/
int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_t *slave, int close_slave);
int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* LADSPA plugin
*/
int snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
const char *ladspa_path,
unsigned int channels,
snd_config_t *ladspa_pplugins,
snd_config_t *ladspa_cplugins,
snd_pcm_t *slave, int close_slave);
int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/*
* Jack plugin
*/
int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *playback_conf,
snd_config_t *capture_conf,
snd_pcm_stream_t stream, int mode);
int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode);
/** \} */
#endif /* __ALSA_PCM_PLUGIN_H */

194
include/pcm_rate.h Normal file
View file

@ -0,0 +1,194 @@
/**
* \file include/pcm_rate.h
* \brief External Rate-Converter-Plugin SDK
* \author Takashi Iwai <tiwai@suse.de>
* \date 2006
*
* External Rate-Converter-Plugin SDK
*/
/*
* ALSA external PCM rate-converter plugin SDK (draft version)
*
* Copyright (c) 2006 Takashi Iwai <tiwai@suse.de>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __ALSA_PCM_RATE_H
#define __ALSA_PCM_RATE_H
#ifndef __ASOUNDLIB_LOCAL
#include <alsa/asoundlib.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* Protocol version
*/
#define SND_PCM_RATE_PLUGIN_VERSION 0x010003
/** hw_params information for a single side */
typedef struct snd_pcm_rate_side_info {
snd_pcm_format_t format;
unsigned int rate;
snd_pcm_uframes_t buffer_size;
snd_pcm_uframes_t period_size;
} snd_pcm_rate_side_info_t;
/** hw_params information */
typedef struct snd_pcm_rate_info {
struct snd_pcm_rate_side_info in;
struct snd_pcm_rate_side_info out;
unsigned int channels;
} snd_pcm_rate_info_t;
enum {
SND_PCM_RATE_FLAG_INTERLEAVED = (1U << 0), /** only interleaved format */
SND_PCM_RATE_FLAG_SYNC_FORMATS = (1U << 1), /** both input and output formats have to be identical */
};
/** Callback table of rate-converter */
typedef struct snd_pcm_rate_ops {
/**
* close the converter; optional
*/
void (*close)(void *obj);
/**
* initialize the converter, called at hw_params
*/
int (*init)(void *obj, snd_pcm_rate_info_t *info);
/**
* free the converter; optional
*/
void (*free)(void *obj);
/**
* reset the converter, called at prepare; optional
*/
void (*reset)(void *obj);
/**
* adjust the pitch, called at sw_params; optional
*/
int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
/**
* convert the data
*/
void (*convert)(void *obj,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset, unsigned int src_frames);
/**
* convert an s16 interleaved-data array; exclusive with convert
*/
void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
const int16_t *src, unsigned int src_frames);
/**
* compute the frame size for input
*/
snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
/**
* compute the frame size for output
*/
snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
/**
* the protocol version the plugin supports;
* new field since version 0x010002
*/
unsigned int version;
/**
* return the supported min / max sample rates;
* new ops since version 0x010002
*/
int (*get_supported_rates)(void *obj, unsigned int *rate_min,
unsigned int *rate_max);
/**
* show some status messages for verbose mode;
* new ops since version 0x010002
*/
void (*dump)(void *obj, snd_output_t *out);
/**
* get the supported input and output formats (optional);
* new ops since version 0x010003
*/
int (*get_supported_formats)(void *obj, uint64_t *in_formats,
uint64_t *out_formats,
unsigned int *flags);
} snd_pcm_rate_ops_t;
/** open function type */
typedef int (*snd_pcm_rate_open_func_t)(unsigned int version, void **objp,
snd_pcm_rate_ops_t *opsp);
typedef int (*snd_pcm_rate_open_conf_func_t)(unsigned int version, void **objp,
snd_pcm_rate_ops_t *opsp, const snd_config_t *conf);
/**
* Define the object entry for external PCM rate-converter plugins
*/
#define SND_PCM_RATE_PLUGIN_ENTRY(name) _snd_pcm_rate_##name##_open
#define SND_PCM_RATE_PLUGIN_CONF_ENTRY(name) _snd_pcm_rate_##name##_open_conf
#ifndef DOC_HIDDEN
/* old rate_ops for protocol version 0x010001 */
typedef struct snd_pcm_rate_old_ops {
void (*close)(void *obj);
int (*init)(void *obj, snd_pcm_rate_info_t *info);
void (*free)(void *obj);
void (*reset)(void *obj);
int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
void (*convert)(void *obj,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset, unsigned int src_frames);
void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
const int16_t *src, unsigned int src_frames);
snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
} snd_pcm_rate_old_ops_t;
/* old rate_ops for protocol version 0x010002 */
typedef struct snd_pcm_rate_v2_ops {
void (*close)(void *obj);
int (*init)(void *obj, snd_pcm_rate_info_t *info);
void (*free)(void *obj);
void (*reset)(void *obj);
int (*adjust_pitch)(void *obj, snd_pcm_rate_info_t *info);
void (*convert)(void *obj,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset, unsigned int src_frames);
void (*convert_s16)(void *obj, int16_t *dst, unsigned int dst_frames,
const int16_t *src, unsigned int src_frames);
snd_pcm_uframes_t (*input_frames)(void *obj, snd_pcm_uframes_t frames);
snd_pcm_uframes_t (*output_frames)(void *obj, snd_pcm_uframes_t frames);
unsigned int version;
int (*get_supported_rates)(void *obj, unsigned int *rate_min,
unsigned int *rate_max);
void (*dump)(void *obj, snd_output_t *out);
} snd_pcm_rate_v2_ops_t;
#endif
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_PCM_RATE_H */

190
include/rawmidi.h Normal file
View file

@ -0,0 +1,190 @@
/**
* \file include/rawmidi.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/rawmidi.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_RAWMIDI_H
#define __ALSA_RAWMIDI_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup RawMidi RawMidi Interface
* The RawMidi Interface. See \ref rawmidi page for more details.
* \{
*/
/** dlsym version for interface entry callback */
#define SND_RAWMIDI_DLSYM_VERSION _dlsym_rawmidi_001
/** RawMidi information container */
typedef struct _snd_rawmidi_info snd_rawmidi_info_t;
/** RawMidi settings container */
typedef struct _snd_rawmidi_params snd_rawmidi_params_t;
/** RawMidi status container */
typedef struct _snd_rawmidi_status snd_rawmidi_status_t;
/** RawMidi stream (direction) */
typedef enum _snd_rawmidi_stream {
/** Output stream */
SND_RAWMIDI_STREAM_OUTPUT = 0,
/** Input stream */
SND_RAWMIDI_STREAM_INPUT,
SND_RAWMIDI_STREAM_LAST = SND_RAWMIDI_STREAM_INPUT
} snd_rawmidi_stream_t;
/** Append (flag to open mode) \hideinitializer */
#define SND_RAWMIDI_APPEND 0x0001
/** Non blocking mode (flag to open mode) \hideinitializer */
#define SND_RAWMIDI_NONBLOCK 0x0002
/** Write sync mode (Flag to open mode) \hideinitializer */
#define SND_RAWMIDI_SYNC 0x0004
/** RawMidi handle */
typedef struct _snd_rawmidi snd_rawmidi_t;
/** RawMidi type */
typedef enum _snd_rawmidi_type {
/** Kernel level RawMidi */
SND_RAWMIDI_TYPE_HW,
/** Shared memory client RawMidi (not yet implemented) */
SND_RAWMIDI_TYPE_SHM,
/** INET client RawMidi (not yet implemented) */
SND_RAWMIDI_TYPE_INET,
/** Virtual (sequencer) RawMidi */
SND_RAWMIDI_TYPE_VIRTUAL
} snd_rawmidi_type_t;
/** Type of clock used with rawmidi timestamp */
typedef enum _snd_rawmidi_clock {
SND_RAWMIDI_CLOCK_NONE = 0,
SND_RAWMIDI_CLOCK_REALTIME = 1,
SND_RAWMIDI_CLOCK_MONOTONIC = 2,
SND_RAWMIDI_CLOCK_MONOTONIC_RAW = 3,
} snd_rawmidi_clock_t;
/** Select the read mode (standard or with timestamps) */
typedef enum _snd_rawmidi_read_mode {
SND_RAWMIDI_READ_STANDARD = 0,
SND_RAWMIDI_READ_TSTAMP = 1,
} snd_rawmidi_read_mode_t;
/** rawmidi info bit flags */
#define SND_RAWMIDI_INFO_UMP 0x00000008 /**< rawmidi is UMP */
#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010 /**< the selected substream is inactive */
int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
const char *name, int mode);
int snd_rawmidi_open_lconf(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
const char *name, int mode, snd_config_t *lconf);
int snd_rawmidi_close(snd_rawmidi_t *rmidi);
int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi);
int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space);
int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revent);
int snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock);
size_t snd_rawmidi_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_rawmidi_info_t using standard alloca
* \param ptr returned pointer
*/
#define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info)
int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
void snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
unsigned int snd_rawmidi_info_get_device(const snd_rawmidi_info_t *obj);
unsigned int snd_rawmidi_info_get_subdevice(const snd_rawmidi_info_t *obj);
snd_rawmidi_stream_t snd_rawmidi_info_get_stream(const snd_rawmidi_info_t *obj);
int snd_rawmidi_info_get_card(const snd_rawmidi_info_t *obj);
unsigned int snd_rawmidi_info_get_flags(const snd_rawmidi_info_t *obj);
const char *snd_rawmidi_info_get_id(const snd_rawmidi_info_t *obj);
const char *snd_rawmidi_info_get_name(const snd_rawmidi_info_t *obj);
const char *snd_rawmidi_info_get_subdevice_name(const snd_rawmidi_info_t *obj);
unsigned int snd_rawmidi_info_get_subdevices_count(const snd_rawmidi_info_t *obj);
unsigned int snd_rawmidi_info_get_subdevices_avail(const snd_rawmidi_info_t *obj);
int snd_rawmidi_info_get_tied_device(const snd_rawmidi_info_t *obj);
void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
size_t snd_rawmidi_params_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_rawmidi_params_t using standard alloca
* \param ptr returned pointer
*/
#define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params)
int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
void snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
int snd_rawmidi_params_set_buffer_size(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
size_t snd_rawmidi_params_get_buffer_size(const snd_rawmidi_params_t *params);
int snd_rawmidi_params_set_avail_min(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, size_t val);
size_t snd_rawmidi_params_get_avail_min(const snd_rawmidi_params_t *params);
int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params, int val);
int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
int snd_rawmidi_params_set_read_mode(const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, snd_rawmidi_read_mode_t val);
snd_rawmidi_read_mode_t snd_rawmidi_params_get_read_mode(const snd_rawmidi_params_t *params);
int snd_rawmidi_params_set_clock_type(const snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params, snd_rawmidi_clock_t val);
snd_rawmidi_clock_t snd_rawmidi_params_get_clock_type(const snd_rawmidi_params_t *params);
int snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params);
int snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params);
size_t snd_rawmidi_status_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_rawmidi_status_t using standard alloca
* \param ptr returned pointer
*/
#define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status)
int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
void snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);
void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_htimestamp_t *ptr);
size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj);
size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj);
int snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status);
int snd_rawmidi_drain(snd_rawmidi_t *rmidi);
int snd_rawmidi_drop(snd_rawmidi_t *rmidi);
ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size);
ssize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size);
ssize_t snd_rawmidi_tread(snd_rawmidi_t *rmidi, struct timespec *tstamp, void *buffer, size_t size);
const char *snd_rawmidi_name(snd_rawmidi_t *rmidi);
snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi);
snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __RAWMIDI_H */

177
include/search.h Normal file
View file

@ -0,0 +1,177 @@
/* Declarations for System V style searching functions.
Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _SEARCH_H
#define _SEARCH_H 1
#include <features.h>
#define __need_size_t
#include <stddef.h>
__BEGIN_DECLS
#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
/* Prototype structure for a linked-list data structure.
This is the type used by the `insque' and `remque' functions. */
# ifdef __USE_GNU
struct qelem
{
struct qelem *q_forw;
struct qelem *q_back;
char q_data[1];
};
# endif
/* Insert ELEM into a doubly-linked list, after PREV. */
extern void insque __P ((void *__elem, void *__prev));
/* Unlink ELEM from the doubly-linked list that it is in. */
extern void remque __P ((void *__elem));
#endif
/* For use with hsearch(3). */
#ifndef __COMPAR_FN_T
# define __COMPAR_FN_T
typedef int (*__compar_fn_t) __PMT ((__const __ptr_t, __const __ptr_t));
# ifdef __USE_GNU
typedef __compar_fn_t comparison_fn_t;
# endif
#endif
/* Action which shall be performed in the call the hsearch. */
typedef enum
{
FIND,
ENTER
}
ACTION;
typedef struct entry
{
char *key;
void *data;
}
ENTRY;
/* Opaque type for internal use. */
struct _ENTRY;
/* Family of hash table handling functions. The functions also
have reentrant counterparts ending with _r. The non-reentrant
functions all work on a single internal hashing table. */
/* Search for entry matching ITEM.key in internal hash table. If
ACTION is `FIND' return found entry or signal error by returning
NULL. If ACTION is `ENTER' replace existing data (if any) with
ITEM.data. */
extern ENTRY *hsearch __P ((ENTRY __item, ACTION __action));
/* Create a new hashing table which will at most contain NEL elements. */
extern int hcreate __P ((size_t __nel));
/* Destroy current internal hashing table. */
extern void hdestroy __P ((void));
#ifdef __USE_GNU
/* Data type for reentrant functions. */
struct hsearch_data
{
struct _ENTRY *table;
unsigned int size;
unsigned int filled;
};
/* Reentrant versions which can handle multiple hashing tables at the
same time. */
extern int hsearch_r __P ((ENTRY __item, ACTION __action, ENTRY **__retval,
struct hsearch_data *__htab));
extern int hcreate_r __P ((size_t __nel, struct hsearch_data *__htab));
extern void hdestroy_r __P ((struct hsearch_data *__htab));
#endif
/* The tsearch routines are very interesting. They make many
assumptions about the compiler. It assumes that the first field
in node must be the "key" field, which points to the datum.
Everything depends on that. */
/* For tsearch */
typedef enum
{
preorder,
postorder,
endorder,
leaf
}
VISIT;
/* Search for an entry matching the given KEY in the tree pointed to
by *ROOTP and insert a new element if not found. */
extern void *tsearch __PMT ((__const void *__key, void **__rootp,
__compar_fn_t __compar));
/* Search for an entry matching the given KEY in the tree pointed to
by *ROOTP. If no matching entry is available return NULL. */
extern void *tfind __PMT ((__const void *__key, void *__const *__rootp,
__compar_fn_t __compar));
/* Remove the element matching KEY from the tree pointed to by *ROOTP. */
extern void *tdelete __PMT ((__const void *__key, void **__rootp,
__compar_fn_t __compar));
#ifndef __ACTION_FN_T
# define __ACTION_FN_T
typedef void (*__action_fn_t) __PMT ((__const void *__nodep,
VISIT __value,
int __level));
#endif
/* Walk through the whole tree and call the ACTION callback for every node
or leaf. */
extern void twalk __PMT ((__const void *__root, __action_fn_t __action));
#ifdef __USE_GNU
/* Callback type for function to free a tree node. If the keys are atomic
data this function should do nothing. */
typedef void (*__free_fn_t) __PMT ((void *__nodep));
/* Destroy the whole tree, call FREEFCT for each node or leaf. */
extern void tdestroy __PMT ((void *__root, __free_fn_t __freefct));
#endif
/* Perform linear search for KEY by comparing by COMPAR in an array
[BASE,BASE+NMEMB*SIZE). */
extern void *lfind __PMT ((__const void *__key, __const void *__base,
size_t *__nmemb, size_t __size,
__compar_fn_t __compar));
/* Perform linear search for KEY by comparing by COMPAR function in
array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */
extern void *lsearch __PMT ((__const void *__key, void *__base,
size_t *__nmemb, size_t __size,
__compar_fn_t __compar));
__END_DECLS
#endif /* search.h */

797
include/seq.h Normal file
View file

@ -0,0 +1,797 @@
/**
* \file include/seq.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*/
/*
* Application interface library for the ALSA driver
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/seq.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_SEQ_H
#define __ALSA_SEQ_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Sequencer MIDI Sequencer
* MIDI Sequencer Interface.
* See \ref seq page for more details.
* \{
*/
/** dlsym version for interface entry callback */
#define SND_SEQ_DLSYM_VERSION _dlsym_seq_001
/** Sequencer handle */
typedef struct _snd_seq snd_seq_t;
/**
* sequencer opening stream types
*/
#define SND_SEQ_OPEN_OUTPUT 1 /**< open for output (write) */
#define SND_SEQ_OPEN_INPUT 2 /**< open for input (read) */
#define SND_SEQ_OPEN_DUPLEX (SND_SEQ_OPEN_OUTPUT|SND_SEQ_OPEN_INPUT) /**< open for both input and output (read/write) */
/**
* sequencer opening mode
*/
#define SND_SEQ_NONBLOCK 0x0001 /**< non-blocking mode (flag to open mode) */
/** sequencer handle type */
typedef enum _snd_seq_type {
SND_SEQ_TYPE_HW, /**< hardware */
SND_SEQ_TYPE_SHM, /**< shared memory (NYI) */
SND_SEQ_TYPE_INET /**< network (NYI) */
} snd_seq_type_t;
/** special client (port) ids */
#define SND_SEQ_ADDRESS_UNKNOWN 253 /**< unknown source */
#define SND_SEQ_ADDRESS_SUBSCRIBERS 254 /**< send event to all subscribed ports */
#define SND_SEQ_ADDRESS_BROADCAST 255 /**< send event to all queues/clients/ports/channels */
/** known client numbers */
#define SND_SEQ_CLIENT_SYSTEM 0 /**< system client */
/*
*/
int snd_seq_open(snd_seq_t **handle, const char *name, int streams, int mode);
int snd_seq_open_lconf(snd_seq_t **handle, const char *name, int streams, int mode, snd_config_t *lconf);
const char *snd_seq_name(snd_seq_t *seq);
snd_seq_type_t snd_seq_type(snd_seq_t *seq);
int snd_seq_close(snd_seq_t *handle);
int snd_seq_poll_descriptors_count(snd_seq_t *handle, short events);
int snd_seq_poll_descriptors(snd_seq_t *handle, struct pollfd *pfds, unsigned int space, short events);
int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_seq_nonblock(snd_seq_t *handle, int nonblock);
int snd_seq_client_id(snd_seq_t *handle);
size_t snd_seq_get_output_buffer_size(snd_seq_t *handle);
size_t snd_seq_get_input_buffer_size(snd_seq_t *handle);
int snd_seq_set_output_buffer_size(snd_seq_t *handle, size_t size);
int snd_seq_set_input_buffer_size(snd_seq_t *handle, size_t size);
/** system information container */
typedef struct _snd_seq_system_info snd_seq_system_info_t;
size_t snd_seq_system_info_sizeof(void);
/** allocate a #snd_seq_system_info_t container on stack */
#define snd_seq_system_info_alloca(ptr) \
__snd_alloca(ptr, snd_seq_system_info)
int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);
void snd_seq_system_info_free(snd_seq_system_info_t *ptr);
void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);
int snd_seq_system_info_get_queues(const snd_seq_system_info_t *info);
int snd_seq_system_info_get_clients(const snd_seq_system_info_t *info);
int snd_seq_system_info_get_ports(const snd_seq_system_info_t *info);
int snd_seq_system_info_get_channels(const snd_seq_system_info_t *info);
int snd_seq_system_info_get_cur_clients(const snd_seq_system_info_t *info);
int snd_seq_system_info_get_cur_queues(const snd_seq_system_info_t *info);
int snd_seq_system_info(snd_seq_t *handle, snd_seq_system_info_t *info);
/** \} */
/**
* \defgroup SeqClient Sequencer Client Interface
* Sequencer Client Interface
* \ingroup Sequencer
* \{
*/
/** client information container */
typedef struct _snd_seq_client_info snd_seq_client_info_t;
/** client types */
typedef enum snd_seq_client_type {
SND_SEQ_USER_CLIENT = 1, /**< user client */
SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */
} snd_seq_client_type_t;
/** client MIDI version */
enum {
SND_SEQ_CLIENT_LEGACY_MIDI = 0, /**< Legacy client */
SND_SEQ_CLIENT_UMP_MIDI_1_0 = 1, /**< UMP MIDI 1.0 */
SND_SEQ_CLIENT_UMP_MIDI_2_0 = 2 /**< UMP MIDI 2.0 */
};
size_t snd_seq_client_info_sizeof(void);
/** allocate a #snd_seq_client_info_t container on stack */
#define snd_seq_client_info_alloca(ptr) \
__snd_alloca(ptr, snd_seq_client_info)
int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);
void snd_seq_client_info_free(snd_seq_client_info_t *ptr);
void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);
int snd_seq_client_info_get_client(const snd_seq_client_info_t *info);
snd_seq_client_type_t snd_seq_client_info_get_type(const snd_seq_client_info_t *info);
const char *snd_seq_client_info_get_name(snd_seq_client_info_t *info);
int snd_seq_client_info_get_broadcast_filter(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_error_bounce(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_card(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_pid(const snd_seq_client_info_t *info);
const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_num_ports(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_event_lost(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_midi_version(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_ump_group_enabled(const snd_seq_client_info_t *info,
int group);
int snd_seq_client_info_get_ump_groupless_enabled(const snd_seq_client_info_t *info);
int snd_seq_client_info_get_ump_conversion(const snd_seq_client_info_t *info);
void snd_seq_client_info_set_client(snd_seq_client_info_t *info, int client);
void snd_seq_client_info_set_name(snd_seq_client_info_t *info, const char *name);
void snd_seq_client_info_set_broadcast_filter(snd_seq_client_info_t *info, int val);
void snd_seq_client_info_set_error_bounce(snd_seq_client_info_t *info, int val);
void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned char *filter);
void snd_seq_client_info_set_midi_version(snd_seq_client_info_t *info, int midi_version);
void snd_seq_client_info_set_ump_group_enabled(snd_seq_client_info_t *info,
int group, int enable);
void snd_seq_client_info_set_ump_groupless_enabled(snd_seq_client_info_t *info,
int enable);
void snd_seq_client_info_set_ump_conversion(snd_seq_client_info_t *info, int enable);
void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info);
void snd_seq_client_info_event_filter_add(snd_seq_client_info_t *info, int event_type);
void snd_seq_client_info_event_filter_del(snd_seq_client_info_t *info, int event_type);
int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int event_type);
int snd_seq_get_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_info_t *info);
int snd_seq_set_client_info(snd_seq_t *handle, snd_seq_client_info_t *info);
int snd_seq_query_next_client(snd_seq_t *handle, snd_seq_client_info_t *info);
int snd_seq_get_ump_endpoint_info(snd_seq_t *seq, int client, void *info);
int snd_seq_get_ump_block_info(snd_seq_t *seq, int client, int blk, void *info);
int snd_seq_set_ump_endpoint_info(snd_seq_t *seq, const void *info);
int snd_seq_set_ump_block_info(snd_seq_t *seq, int blk, const void *info);
/*
*/
/** client pool information container */
typedef struct _snd_seq_client_pool snd_seq_client_pool_t;
size_t snd_seq_client_pool_sizeof(void);
/** allocate a #snd_seq_client_pool_t container on stack */
#define snd_seq_client_pool_alloca(ptr) \
__snd_alloca(ptr, snd_seq_client_pool)
int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);
void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);
void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);
int snd_seq_client_pool_get_client(const snd_seq_client_pool_t *info);
size_t snd_seq_client_pool_get_output_pool(const snd_seq_client_pool_t *info);
size_t snd_seq_client_pool_get_input_pool(const snd_seq_client_pool_t *info);
size_t snd_seq_client_pool_get_output_room(const snd_seq_client_pool_t *info);
size_t snd_seq_client_pool_get_output_free(const snd_seq_client_pool_t *info);
size_t snd_seq_client_pool_get_input_free(const snd_seq_client_pool_t *info);
void snd_seq_client_pool_set_output_pool(snd_seq_client_pool_t *info, size_t size);
void snd_seq_client_pool_set_input_pool(snd_seq_client_pool_t *info, size_t size);
void snd_seq_client_pool_set_output_room(snd_seq_client_pool_t *info, size_t size);
int snd_seq_get_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
int snd_seq_set_client_pool(snd_seq_t *handle, snd_seq_client_pool_t *info);
/** \} */
/**
* \defgroup SeqPort Sequencer Port Interface
* Sequencer Port Interface
* \ingroup Sequencer
* \{
*/
/** port information container */
typedef struct _snd_seq_port_info snd_seq_port_info_t;
/** known port numbers */
#define SND_SEQ_PORT_SYSTEM_TIMER 0 /**< system timer port */
#define SND_SEQ_PORT_SYSTEM_ANNOUNCE 1 /**< system announce port */
/** port capabilities (32 bits) */
#define SND_SEQ_PORT_CAP_READ (1<<0) /**< readable from this port */
#define SND_SEQ_PORT_CAP_WRITE (1<<1) /**< writable to this port */
#define SND_SEQ_PORT_CAP_SYNC_READ (1<<2) /**< allow read subscriptions */
#define SND_SEQ_PORT_CAP_SYNC_WRITE (1<<3) /**< allow write subscriptions */
#define SND_SEQ_PORT_CAP_DUPLEX (1<<4) /**< allow read/write duplex */
#define SND_SEQ_PORT_CAP_SUBS_READ (1<<5) /**< allow read subscription */
#define SND_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /**< allow write subscription */
#define SND_SEQ_PORT_CAP_NO_EXPORT (1<<7) /**< routing not allowed */
#define SND_SEQ_PORT_CAP_INACTIVE (1<<8) /**< inactive port */
#define SND_SEQ_PORT_CAP_UMP_ENDPOINT (1<<9) /**< UMP Endpoint port */
/** port direction */
#define SND_SEQ_PORT_DIR_UNKNOWN 0 /**< Unknown */
#define SND_SEQ_PORT_DIR_INPUT 1 /**< Input only; sink, receiver */
#define SND_SEQ_PORT_DIR_OUTPUT 2 /**< Output only; source, transmitter */
#define SND_SEQ_PORT_DIR_BIDIRECTION 3 /**< Input/output bidirectional */
/* port type */
/** Messages sent from/to this port have device-specific semantics. */
#define SND_SEQ_PORT_TYPE_SPECIFIC (1<<0)
/** This port understands MIDI messages. */
#define SND_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1)
/** This port is compatible with the General MIDI specification. */
#define SND_SEQ_PORT_TYPE_MIDI_GM (1<<2)
/** This port is compatible with the Roland GS standard. */
#define SND_SEQ_PORT_TYPE_MIDI_GS (1<<3)
/** This port is compatible with the Yamaha XG specification. */
#define SND_SEQ_PORT_TYPE_MIDI_XG (1<<4)
/** This port is compatible with the Roland MT-32. */
#define SND_SEQ_PORT_TYPE_MIDI_MT32 (1<<5)
/** This port is compatible with the General MIDI 2 specification. */
#define SND_SEQ_PORT_TYPE_MIDI_GM2 (1<<6)
/** This port is a UMP port. */
#define SND_SEQ_PORT_TYPE_MIDI_UMP (1<<7)
/** This port understands SND_SEQ_EVENT_SAMPLE_xxx messages
(these are not MIDI messages). */
#define SND_SEQ_PORT_TYPE_SYNTH (1<<10)
/** Instruments can be downloaded to this port
(with SND_SEQ_EVENT_INSTR_xxx messages sent directly). */
#define SND_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11)
/** Instruments can be downloaded to this port
(with SND_SEQ_EVENT_INSTR_xxx messages sent directly or through a queue). */
#define SND_SEQ_PORT_TYPE_SAMPLE (1<<12)
/** This port is implemented in hardware. */
#define SND_SEQ_PORT_TYPE_HARDWARE (1<<16)
/** This port is implemented in software. */
#define SND_SEQ_PORT_TYPE_SOFTWARE (1<<17)
/** Messages sent to this port will generate sounds. */
#define SND_SEQ_PORT_TYPE_SYNTHESIZER (1<<18)
/** This port may connect to other devices
(whose characteristics are not known). */
#define SND_SEQ_PORT_TYPE_PORT (1<<19)
/** This port belongs to an application, such as a sequencer or editor. */
#define SND_SEQ_PORT_TYPE_APPLICATION (1<<20)
size_t snd_seq_port_info_sizeof(void);
/** allocate a #snd_seq_port_info_t container on stack */
#define snd_seq_port_info_alloca(ptr) \
__snd_alloca(ptr, snd_seq_port_info)
int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);
void snd_seq_port_info_free(snd_seq_port_info_t *ptr);
void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);
int snd_seq_port_info_get_client(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_port(const snd_seq_port_info_t *info);
const snd_seq_addr_t *snd_seq_port_info_get_addr(const snd_seq_port_info_t *info);
const char *snd_seq_port_info_get_name(const snd_seq_port_info_t *info);
unsigned int snd_seq_port_info_get_capability(const snd_seq_port_info_t *info);
unsigned int snd_seq_port_info_get_type(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_midi_channels(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_midi_voices(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_direction(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_ump_group(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_ump_is_midi1(const snd_seq_port_info_t *info);
void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
void snd_seq_port_info_set_addr(snd_seq_port_info_t *info, const snd_seq_addr_t *addr);
void snd_seq_port_info_set_name(snd_seq_port_info_t *info, const char *name);
void snd_seq_port_info_set_capability(snd_seq_port_info_t *info, unsigned int capability);
void snd_seq_port_info_set_type(snd_seq_port_info_t *info, unsigned int type);
void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels);
void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);
void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);
void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);
void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);
void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);
void snd_seq_port_info_set_direction(snd_seq_port_info_t *info, int direction);
void snd_seq_port_info_set_ump_group(snd_seq_port_info_t *info, int ump_group);
void snd_seq_port_info_set_ump_is_midi1(snd_seq_port_info_t *info, int is_midi1);
int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
int snd_seq_delete_port(snd_seq_t *handle, int port);
int snd_seq_get_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
int snd_seq_get_any_port_info(snd_seq_t *handle, int client, int port, snd_seq_port_info_t *info);
int snd_seq_set_port_info(snd_seq_t *handle, int port, snd_seq_port_info_t *info);
int snd_seq_query_next_port(snd_seq_t *handle, snd_seq_port_info_t *info);
/** \} */
/**
* \defgroup SeqSubscribe Sequencer Port Subscription
* Sequencer Port Subscription
* \ingroup Sequencer
* \{
*/
/** port subscription container */
typedef struct _snd_seq_port_subscribe snd_seq_port_subscribe_t;
size_t snd_seq_port_subscribe_sizeof(void);
/** allocate a #snd_seq_port_subscribe_t container on stack */
#define snd_seq_port_subscribe_alloca(ptr) \
__snd_alloca(ptr, snd_seq_port_subscribe)
int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);
void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);
void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);
const snd_seq_addr_t *snd_seq_port_subscribe_get_sender(const snd_seq_port_subscribe_t *info);
const snd_seq_addr_t *snd_seq_port_subscribe_get_dest(const snd_seq_port_subscribe_t *info);
int snd_seq_port_subscribe_get_queue(const snd_seq_port_subscribe_t *info);
int snd_seq_port_subscribe_get_exclusive(const snd_seq_port_subscribe_t *info);
int snd_seq_port_subscribe_get_time_update(const snd_seq_port_subscribe_t *info);
int snd_seq_port_subscribe_get_time_real(const snd_seq_port_subscribe_t *info);
void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
void snd_seq_port_subscribe_set_dest(snd_seq_port_subscribe_t *info, const snd_seq_addr_t *addr);
void snd_seq_port_subscribe_set_queue(snd_seq_port_subscribe_t *info, int q);
void snd_seq_port_subscribe_set_exclusive(snd_seq_port_subscribe_t *info, int val);
void snd_seq_port_subscribe_set_time_update(snd_seq_port_subscribe_t *info, int val);
void snd_seq_port_subscribe_set_time_real(snd_seq_port_subscribe_t *info, int val);
int snd_seq_get_port_subscription(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
int snd_seq_subscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
int snd_seq_unsubscribe_port(snd_seq_t *handle, snd_seq_port_subscribe_t *sub);
/*
*/
/** subscription query container */
typedef struct _snd_seq_query_subscribe snd_seq_query_subscribe_t;
/** type of query subscription */
typedef enum {
SND_SEQ_QUERY_SUBS_READ, /**< query read subscriptions */
SND_SEQ_QUERY_SUBS_WRITE /**< query write subscriptions */
} snd_seq_query_subs_type_t;
size_t snd_seq_query_subscribe_sizeof(void);
/** allocate a #snd_seq_query_subscribe_t container on stack */
#define snd_seq_query_subscribe_alloca(ptr) \
__snd_alloca(ptr, snd_seq_query_subscribe)
int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);
void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);
void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);
int snd_seq_query_subscribe_get_client(const snd_seq_query_subscribe_t *info);
int snd_seq_query_subscribe_get_port(const snd_seq_query_subscribe_t *info);
const snd_seq_addr_t *snd_seq_query_subscribe_get_root(const snd_seq_query_subscribe_t *info);
snd_seq_query_subs_type_t snd_seq_query_subscribe_get_type(const snd_seq_query_subscribe_t *info);
int snd_seq_query_subscribe_get_index(const snd_seq_query_subscribe_t *info);
int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info);
const snd_seq_addr_t *snd_seq_query_subscribe_get_addr(const snd_seq_query_subscribe_t *info);
int snd_seq_query_subscribe_get_queue(const snd_seq_query_subscribe_t *info);
int snd_seq_query_subscribe_get_exclusive(const snd_seq_query_subscribe_t *info);
int snd_seq_query_subscribe_get_time_update(const snd_seq_query_subscribe_t *info);
int snd_seq_query_subscribe_get_time_real(const snd_seq_query_subscribe_t *info);
void snd_seq_query_subscribe_set_client(snd_seq_query_subscribe_t *info, int client);
void snd_seq_query_subscribe_set_port(snd_seq_query_subscribe_t *info, int port);
void snd_seq_query_subscribe_set_root(snd_seq_query_subscribe_t *info, const snd_seq_addr_t *addr);
void snd_seq_query_subscribe_set_type(snd_seq_query_subscribe_t *info, snd_seq_query_subs_type_t type);
void snd_seq_query_subscribe_set_index(snd_seq_query_subscribe_t *info, int _index);
int snd_seq_query_port_subscribers(snd_seq_t *seq, snd_seq_query_subscribe_t * subs);
/** \} */
/**
* \defgroup SeqQueue Sequencer Queue Interface
* Sequencer Queue Interface
* \ingroup Sequencer
* \{
*/
/** queue information container */
typedef struct _snd_seq_queue_info snd_seq_queue_info_t;
/** queue status container */
typedef struct _snd_seq_queue_status snd_seq_queue_status_t;
/** queue tempo container */
typedef struct _snd_seq_queue_tempo snd_seq_queue_tempo_t;
/** queue timer information container */
typedef struct _snd_seq_queue_timer snd_seq_queue_timer_t;
/** special queue ids */
#define SND_SEQ_QUEUE_DIRECT 253 /**< direct dispatch */
size_t snd_seq_queue_info_sizeof(void);
/** allocate a #snd_seq_queue_info_t container on stack */
#define snd_seq_queue_info_alloca(ptr) \
__snd_alloca(ptr, snd_seq_queue_info)
int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);
void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);
void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);
int snd_seq_queue_info_get_queue(const snd_seq_queue_info_t *info);
const char *snd_seq_queue_info_get_name(const snd_seq_queue_info_t *info);
int snd_seq_queue_info_get_owner(const snd_seq_queue_info_t *info);
int snd_seq_queue_info_get_locked(const snd_seq_queue_info_t *info);
unsigned int snd_seq_queue_info_get_flags(const snd_seq_queue_info_t *info);
void snd_seq_queue_info_set_name(snd_seq_queue_info_t *info, const char *name);
void snd_seq_queue_info_set_owner(snd_seq_queue_info_t *info, int owner);
void snd_seq_queue_info_set_locked(snd_seq_queue_info_t *info, int locked);
void snd_seq_queue_info_set_flags(snd_seq_queue_info_t *info, unsigned int flags);
int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info);
int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name);
int snd_seq_alloc_queue(snd_seq_t *handle);
int snd_seq_free_queue(snd_seq_t *handle, int q);
int snd_seq_get_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
int snd_seq_set_queue_info(snd_seq_t *seq, int q, snd_seq_queue_info_t *info);
int snd_seq_query_named_queue(snd_seq_t *seq, const char *name);
int snd_seq_get_queue_usage(snd_seq_t *handle, int q);
int snd_seq_set_queue_usage(snd_seq_t *handle, int q, int used);
/*
*/
size_t snd_seq_queue_status_sizeof(void);
/** allocate a #snd_seq_queue_status_t container on stack */
#define snd_seq_queue_status_alloca(ptr) \
__snd_alloca(ptr, snd_seq_queue_status)
int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);
void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);
void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);
int snd_seq_queue_status_get_queue(const snd_seq_queue_status_t *info);
int snd_seq_queue_status_get_events(const snd_seq_queue_status_t *info);
snd_seq_tick_time_t snd_seq_queue_status_get_tick_time(const snd_seq_queue_status_t *info);
const snd_seq_real_time_t *snd_seq_queue_status_get_real_time(const snd_seq_queue_status_t *info);
unsigned int snd_seq_queue_status_get_status(const snd_seq_queue_status_t *info);
int snd_seq_get_queue_status(snd_seq_t *handle, int q, snd_seq_queue_status_t *status);
/*
*/
size_t snd_seq_queue_tempo_sizeof(void);
/** allocate a #snd_seq_queue_tempo_t container on stack */
#define snd_seq_queue_tempo_alloca(ptr) \
__snd_alloca(ptr, snd_seq_queue_tempo)
int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);
void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);
void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);
int snd_seq_queue_tempo_get_queue(const snd_seq_queue_tempo_t *info);
unsigned int snd_seq_queue_tempo_get_tempo(const snd_seq_queue_tempo_t *info);
int snd_seq_queue_tempo_get_ppq(const snd_seq_queue_tempo_t *info);
unsigned int snd_seq_queue_tempo_get_skew(const snd_seq_queue_tempo_t *info);
unsigned int snd_seq_queue_tempo_get_skew_base(const snd_seq_queue_tempo_t *info);
unsigned int snd_seq_queue_tempo_get_tempo_base(const snd_seq_queue_tempo_t *info);
void snd_seq_queue_tempo_set_tempo(snd_seq_queue_tempo_t *info, unsigned int tempo);
void snd_seq_queue_tempo_set_ppq(snd_seq_queue_tempo_t *info, int ppq);
void snd_seq_queue_tempo_set_skew(snd_seq_queue_tempo_t *info, unsigned int skew);
void snd_seq_queue_tempo_set_skew_base(snd_seq_queue_tempo_t *info, unsigned int base);
void snd_seq_queue_tempo_set_tempo_base(snd_seq_queue_tempo_t *info, unsigned int tempo_base);
int snd_seq_get_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
int snd_seq_set_queue_tempo(snd_seq_t *handle, int q, snd_seq_queue_tempo_t *tempo);
int snd_seq_has_queue_tempo_base(snd_seq_t *handle);
/*
*/
/** sequencer timer sources */
typedef enum {
SND_SEQ_TIMER_ALSA = 0, /* ALSA timer */
SND_SEQ_TIMER_MIDI_CLOCK = 1, /* Midi Clock (CLOCK event) */
SND_SEQ_TIMER_MIDI_TICK = 2 /* Midi Timer Tick (TICK event */
} snd_seq_queue_timer_type_t;
size_t snd_seq_queue_timer_sizeof(void);
/** allocate a #snd_seq_queue_timer_t container on stack */
#define snd_seq_queue_timer_alloca(ptr) \
__snd_alloca(ptr, snd_seq_queue_timer)
int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);
void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);
void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);
int snd_seq_queue_timer_get_queue(const snd_seq_queue_timer_t *info);
snd_seq_queue_timer_type_t snd_seq_queue_timer_get_type(const snd_seq_queue_timer_t *info);
const snd_timer_id_t *snd_seq_queue_timer_get_id(const snd_seq_queue_timer_t *info);
unsigned int snd_seq_queue_timer_get_resolution(const snd_seq_queue_timer_t *info);
void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_timer_type_t type);
void snd_seq_queue_timer_set_id(snd_seq_queue_timer_t *info, const snd_timer_id_t *id);
void snd_seq_queue_timer_set_resolution(snd_seq_queue_timer_t *info, unsigned int resolution);
int snd_seq_get_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
int snd_seq_set_queue_timer(snd_seq_t *handle, int q, snd_seq_queue_timer_t *timer);
/** \} */
/**
* \defgroup SeqEvent Sequencer Event API
* Sequencer Event API
* \ingroup Sequencer
* \{
*/
int snd_seq_free_event(snd_seq_event_t *ev);
ssize_t snd_seq_event_length(snd_seq_event_t *ev);
int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);
int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);
int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer);
int snd_seq_drain_output(snd_seq_t *handle);
int snd_seq_event_output_pending(snd_seq_t *seq);
int snd_seq_extract_output(snd_seq_t *handle, snd_seq_event_t **ev);
int snd_seq_drop_output(snd_seq_t *handle);
int snd_seq_drop_output_buffer(snd_seq_t *handle);
int snd_seq_drop_input(snd_seq_t *handle);
int snd_seq_drop_input_buffer(snd_seq_t *handle);
/** event removal conditionals */
typedef struct _snd_seq_remove_events snd_seq_remove_events_t;
/** Remove conditional flags */
#define SND_SEQ_REMOVE_INPUT (1<<0) /**< Flush input queues */
#define SND_SEQ_REMOVE_OUTPUT (1<<1) /**< Flush output queues */
#define SND_SEQ_REMOVE_DEST (1<<2) /**< Restrict by destination q:client:port */
#define SND_SEQ_REMOVE_DEST_CHANNEL (1<<3) /**< Restrict by channel */
#define SND_SEQ_REMOVE_TIME_BEFORE (1<<4) /**< Restrict to before time */
#define SND_SEQ_REMOVE_TIME_AFTER (1<<5) /**< Restrict to time or after */
#define SND_SEQ_REMOVE_TIME_TICK (1<<6) /**< Time is in ticks */
#define SND_SEQ_REMOVE_EVENT_TYPE (1<<7) /**< Restrict to event type */
#define SND_SEQ_REMOVE_IGNORE_OFF (1<<8) /**< Do not flush off events */
#define SND_SEQ_REMOVE_TAG_MATCH (1<<9) /**< Restrict to events with given tag */
size_t snd_seq_remove_events_sizeof(void);
/** allocate a #snd_seq_remove_events_t container on stack */
#define snd_seq_remove_events_alloca(ptr) \
__snd_alloca(ptr, snd_seq_remove_events)
int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);
void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);
void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);
unsigned int snd_seq_remove_events_get_condition(const snd_seq_remove_events_t *info);
int snd_seq_remove_events_get_queue(const snd_seq_remove_events_t *info);
const snd_seq_timestamp_t *snd_seq_remove_events_get_time(const snd_seq_remove_events_t *info);
const snd_seq_addr_t *snd_seq_remove_events_get_dest(const snd_seq_remove_events_t *info);
int snd_seq_remove_events_get_channel(const snd_seq_remove_events_t *info);
int snd_seq_remove_events_get_event_type(const snd_seq_remove_events_t *info);
int snd_seq_remove_events_get_tag(const snd_seq_remove_events_t *info);
void snd_seq_remove_events_set_condition(snd_seq_remove_events_t *info, unsigned int flags);
void snd_seq_remove_events_set_queue(snd_seq_remove_events_t *info, int queue);
void snd_seq_remove_events_set_time(snd_seq_remove_events_t *info, const snd_seq_timestamp_t *time);
void snd_seq_remove_events_set_dest(snd_seq_remove_events_t *info, const snd_seq_addr_t *addr);
void snd_seq_remove_events_set_channel(snd_seq_remove_events_t *info, int channel);
void snd_seq_remove_events_set_event_type(snd_seq_remove_events_t *info, int type);
void snd_seq_remove_events_set_tag(snd_seq_remove_events_t *info, int tag);
int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
int snd_seq_ump_event_output(snd_seq_t *seq, snd_seq_ump_event_t *ev);
int snd_seq_ump_event_output_buffer(snd_seq_t *seq, snd_seq_ump_event_t *ev);
int snd_seq_ump_extract_output(snd_seq_t *seq, snd_seq_ump_event_t **ev_res);
int snd_seq_ump_event_output_direct(snd_seq_t *seq, snd_seq_ump_event_t *ev);
int snd_seq_ump_event_input(snd_seq_t *seq, snd_seq_ump_event_t **ev);
/** \} */
/**
* \defgroup SeqMisc Sequencer Miscellaneous
* Sequencer Miscellaneous
* \ingroup Sequencer
* \{
*/
void snd_seq_set_bit(int nr, void *array);
void snd_seq_unset_bit(int nr, void *array);
int snd_seq_change_bit(int nr, void *array);
int snd_seq_get_bit(int nr, void *array);
/** \} */
/**
* \defgroup SeqEvType Sequencer Event Type Checks
* Sequencer Event Type Checks
* \ingroup Sequencer
* \{
*/
/* event type macros */
enum {
SND_SEQ_EVFLG_RESULT,
SND_SEQ_EVFLG_NOTE,
SND_SEQ_EVFLG_CONTROL,
SND_SEQ_EVFLG_QUEUE,
SND_SEQ_EVFLG_SYSTEM,
SND_SEQ_EVFLG_MESSAGE,
SND_SEQ_EVFLG_CONNECTION,
SND_SEQ_EVFLG_SAMPLE,
SND_SEQ_EVFLG_USERS,
SND_SEQ_EVFLG_INSTR,
SND_SEQ_EVFLG_QUOTE,
SND_SEQ_EVFLG_NONE,
SND_SEQ_EVFLG_RAW,
SND_SEQ_EVFLG_FIXED,
SND_SEQ_EVFLG_VARIABLE,
SND_SEQ_EVFLG_VARUSR
};
enum {
SND_SEQ_EVFLG_NOTE_ONEARG,
SND_SEQ_EVFLG_NOTE_TWOARG
};
enum {
SND_SEQ_EVFLG_QUEUE_NOARG,
SND_SEQ_EVFLG_QUEUE_TICK,
SND_SEQ_EVFLG_QUEUE_TIME,
SND_SEQ_EVFLG_QUEUE_VALUE
};
/**
* Exported event type table
*
* This table is referred by snd_seq_ev_is_xxx.
*/
extern const unsigned int snd_seq_event_types[];
#define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */
#define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */
/** check the event type */
#define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x))
/** event type check: result events */
#define snd_seq_ev_is_result_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT)
/** event type check: note events */
#define snd_seq_ev_is_note_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE)
/** event type check: control events */
#define snd_seq_ev_is_control_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL)
/** event type check: channel specific events */
#define snd_seq_ev_is_channel_type(ev) \
(snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL)))
/** event type check: queue control events */
#define snd_seq_ev_is_queue_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE)
/** event type check: system status messages */
#define snd_seq_ev_is_message_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE)
/** event type check: system status messages */
#define snd_seq_ev_is_subscribe_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION)
/** event type check: sample messages */
#define snd_seq_ev_is_sample_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE)
/** event type check: user-defined messages */
#define snd_seq_ev_is_user_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS)
/** event type check: instrument layer events */
#define snd_seq_ev_is_instr_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR)
/** event type check: fixed length events */
#define snd_seq_ev_is_fixed_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED)
/** event type check: variable length events */
#define snd_seq_ev_is_variable_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE)
/** event type check: user pointer events */
#define snd_seq_ev_is_varusr_type(ev) \
snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR)
/** event type check: reserved for kernel */
#define snd_seq_ev_is_reserved(ev) \
(! snd_seq_event_types[(ev)->type])
/**
* macros to check event flags
*/
/** prior events */
#define snd_seq_ev_is_prior(ev) \
(((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH)
/** get the data length type */
#define snd_seq_ev_length_type(ev) \
((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK)
/** fixed length events */
#define snd_seq_ev_is_fixed(ev) \
(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED)
/** variable length events */
#define snd_seq_ev_is_variable(ev) \
(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE)
/** variable length on user-space */
#define snd_seq_ev_is_varusr(ev) \
(snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR)
/** time-stamp type */
#define snd_seq_ev_timestamp_type(ev) \
((ev)->flags & SND_SEQ_TIME_STAMP_MASK)
/** event is in tick time */
#define snd_seq_ev_is_tick(ev) \
(snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK)
/** event is in real-time */
#define snd_seq_ev_is_real(ev) \
(snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL)
/** time-mode type */
#define snd_seq_ev_timemode_type(ev) \
((ev)->flags & SND_SEQ_TIME_MODE_MASK)
/** scheduled in absolute time */
#define snd_seq_ev_is_abstime(ev) \
(snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS)
/** scheduled in relative time */
#define snd_seq_ev_is_reltime(ev) \
(snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL)
/** direct dispatched events */
#define snd_seq_ev_is_direct(ev) \
((ev)->queue == SND_SEQ_QUEUE_DIRECT)
/** UMP events */
#define snd_seq_ev_is_ump(ev) \
((ev)->flags & SND_SEQ_EVENT_UMP)
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_SEQ_H */

361
include/seq_event.h Normal file
View file

@ -0,0 +1,361 @@
/**
* \file include/seq_event.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/seq_event.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_SEQ_EVENT_H
#define __ALSA_SEQ_EVENT_H
/**
* \defgroup SeqEvents Sequencer Event Definitions
* Sequencer Event Definitions
* \ingroup Sequencer
* \{
*/
/**
* Sequencer event data type
*/
typedef unsigned char snd_seq_event_type_t;
/** Sequencer event type */
enum snd_seq_event_type {
/** system status; event data type = #snd_seq_result_t */
SND_SEQ_EVENT_SYSTEM = 0,
/** returned result status; event data type = #snd_seq_result_t */
SND_SEQ_EVENT_RESULT,
/** note on and off with duration; event data type = #snd_seq_ev_note_t */
SND_SEQ_EVENT_NOTE = 5,
/** note on; event data type = #snd_seq_ev_note_t */
SND_SEQ_EVENT_NOTEON,
/** note off; event data type = #snd_seq_ev_note_t */
SND_SEQ_EVENT_NOTEOFF,
/** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */
SND_SEQ_EVENT_KEYPRESS,
/** controller; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_CONTROLLER = 10,
/** program change; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_PGMCHANGE,
/** channel pressure; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_CHANPRESS,
/** pitchwheel; event data type = #snd_seq_ev_ctrl_t; data is from -8192 to 8191) */
SND_SEQ_EVENT_PITCHBEND,
/** 14 bit controller value; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_CONTROL14,
/** 14 bit NRPN; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_NONREGPARAM,
/** 14 bit RPN; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_REGPARAM,
/** SPP with LSB and MSB values; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_SONGPOS = 20,
/** Song Select with song ID number; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_SONGSEL,
/** midi time code quarter frame; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_QFRAME,
/** SMF Time Signature event; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_TIMESIGN,
/** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */
SND_SEQ_EVENT_KEYSIGN,
/** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_START = 30,
/** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_CONTINUE,
/** MIDI Real Time Stop message; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_STOP,
/** Set tick queue position; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_SETPOS_TICK,
/** Set real-time queue position; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_SETPOS_TIME,
/** (SMF) Tempo event; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_TEMPO,
/** MIDI Real Time Clock message; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_CLOCK,
/** MIDI Real Time Tick message; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_TICK,
/** Queue timer skew; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_QUEUE_SKEW,
/** Sync position changed; event data type = #snd_seq_ev_queue_control_t */
SND_SEQ_EVENT_SYNC_POS,
/** Tune request; event data type = none */
SND_SEQ_EVENT_TUNE_REQUEST = 40,
/** Reset to power-on state; event data type = none */
SND_SEQ_EVENT_RESET,
/** Active sensing event; event data type = none */
SND_SEQ_EVENT_SENSING,
/** Echo-back event; event data type = any type */
SND_SEQ_EVENT_ECHO = 50,
/** OSS emulation raw event; event data type = any type */
SND_SEQ_EVENT_OSS,
/** New client has connected; event data type = #snd_seq_addr_t */
SND_SEQ_EVENT_CLIENT_START = 60,
/** Client has left the system; event data type = #snd_seq_addr_t */
SND_SEQ_EVENT_CLIENT_EXIT,
/** Client status/info has changed; event data type = #snd_seq_addr_t */
SND_SEQ_EVENT_CLIENT_CHANGE,
/** New port was created; event data type = #snd_seq_addr_t */
SND_SEQ_EVENT_PORT_START,
/** Port was deleted from system; event data type = #snd_seq_addr_t */
SND_SEQ_EVENT_PORT_EXIT,
/** Port status/info has changed; event data type = #snd_seq_addr_t */
SND_SEQ_EVENT_PORT_CHANGE,
/** Ports connected; event data type = #snd_seq_connect_t */
SND_SEQ_EVENT_PORT_SUBSCRIBED,
/** Ports disconnected; event data type = #snd_seq_connect_t */
SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
/** UMP Endpoint info has changed; event data type = #snd_seq_ev_ump_notify_t */
SND_SEQ_EVENT_UMP_EP_CHANGE,
/** UMP Block info has changed; event data type = #snd_seq_ev_ump_notify_t */
SND_SEQ_EVENT_UMP_BLOCK_CHANGE,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR0 = 90,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR1,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR2,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR3,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR4,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR5,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR6,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR7,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR8,
/** user-defined event; event data type = any (fixed size) */
SND_SEQ_EVENT_USR9,
/** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_SYSEX = 130,
/** error event; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_BOUNCE,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR0 = 135,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR1,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR2,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR3,
/** reserved for user apps; event data type = #snd_seq_ev_ext_t */
SND_SEQ_EVENT_USR_VAR4,
/** NOP; ignored in any case */
SND_SEQ_EVENT_NONE = 255
};
/** Sequencer event address */
typedef struct snd_seq_addr {
unsigned char client; /**< Client id */
unsigned char port; /**< Port id */
} snd_seq_addr_t;
/** Connection (subscription) between ports */
typedef struct snd_seq_connect {
snd_seq_addr_t sender; /**< sender address */
snd_seq_addr_t dest; /**< destination address */
} snd_seq_connect_t;
/** Real-time data record */
typedef struct snd_seq_real_time {
unsigned int tv_sec; /**< seconds */
unsigned int tv_nsec; /**< nanoseconds */
} snd_seq_real_time_t;
/** (MIDI) Tick-time data record */
typedef unsigned int snd_seq_tick_time_t;
/** unioned time stamp */
typedef union snd_seq_timestamp {
snd_seq_tick_time_t tick; /**< tick-time */
struct snd_seq_real_time time; /**< real-time */
} snd_seq_timestamp_t;
/**
* Event mode flags
*
* NOTE: only 8 bits available!
*/
#define SND_SEQ_TIME_STAMP_TICK (0<<0) /**< timestamp in clock ticks */
#define SND_SEQ_TIME_STAMP_REAL (1<<0) /**< timestamp in real time */
#define SND_SEQ_TIME_STAMP_MASK (1<<0) /**< mask for timestamp bits */
#define SND_SEQ_TIME_MODE_ABS (0<<1) /**< absolute timestamp */
#define SND_SEQ_TIME_MODE_REL (1<<1) /**< relative to current time */
#define SND_SEQ_TIME_MODE_MASK (1<<1) /**< mask for time mode bits */
#define SND_SEQ_EVENT_LENGTH_FIXED (0<<2) /**< fixed event size */
#define SND_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /**< variable event size */
#define SND_SEQ_EVENT_LENGTH_VARUSR (2<<2) /**< variable event size - user memory space */
#define SND_SEQ_EVENT_LENGTH_MASK (3<<2) /**< mask for event length bits */
#define SND_SEQ_PRIORITY_NORMAL (0<<4) /**< normal priority */
#define SND_SEQ_PRIORITY_HIGH (1<<4) /**< event should be processed before others */
#define SND_SEQ_PRIORITY_MASK (1<<4) /**< mask for priority bits */
#define SND_SEQ_EVENT_UMP (1<<5) /**< UMP packet event */
/** Note event */
typedef struct snd_seq_ev_note {
unsigned char channel; /**< channel number */
unsigned char note; /**< note */
unsigned char velocity; /**< velocity */
unsigned char off_velocity; /**< note-off velocity; only for #SND_SEQ_EVENT_NOTE */
unsigned int duration; /**< duration until note-off; only for #SND_SEQ_EVENT_NOTE */
} snd_seq_ev_note_t;
/** Controller event */
typedef struct snd_seq_ev_ctrl {
unsigned char channel; /**< channel number */
unsigned char unused[3]; /**< reserved */
unsigned int param; /**< control parameter */
signed int value; /**< control value */
} snd_seq_ev_ctrl_t;
/** generic set of bytes (12x8 bit) */
typedef struct snd_seq_ev_raw8 {
unsigned char d[12]; /**< 8 bit value */
} snd_seq_ev_raw8_t;
/** generic set of integers (3x32 bit) */
typedef struct snd_seq_ev_raw32 {
unsigned int d[3]; /**< 32 bit value */
} snd_seq_ev_raw32_t;
/** external stored data */
struct snd_seq_ev_ext {
unsigned int len; /**< length of data */
void *ptr; /**< pointer to data (note: can be 64-bit) */
} __attribute__((packed));
/** external stored data */
typedef struct snd_seq_ev_ext snd_seq_ev_ext_t;
#ifdef DOC_HIDDEN
/* redefine typedef for stupid doxygen */
typedef snd_seq_ev_ext snd_seq_ev_ext_t;
#endif
/** Result events */
typedef struct snd_seq_result {
int event; /**< processed event type */
int result; /**< status */
} snd_seq_result_t;
/** Queue skew values */
typedef struct snd_seq_queue_skew {
unsigned int value; /**< skew value */
unsigned int base; /**< skew base */
} snd_seq_queue_skew_t;
/** queue timer control */
typedef struct snd_seq_ev_queue_control {
unsigned char queue; /**< affected queue */
unsigned char unused[3]; /**< reserved */
union {
signed int value; /**< affected value (e.g. tempo) */
snd_seq_timestamp_t time; /**< time */
unsigned int position; /**< sync position */
snd_seq_queue_skew_t skew; /**< queue skew */
unsigned int d32[2]; /**< any data */
unsigned char d8[8]; /**< any data */
} param; /**< data value union */
} snd_seq_ev_queue_control_t;
/** UMP info change notify */
typedef struct snd_seq_ev_ump_notify {
unsigned char client; /**< Client number */
unsigned char block; /**< Block number (optional) */
} snd_seq_ev_ump_notify_t;
/** Sequencer event data */
typedef union snd_seq_event_data {
snd_seq_ev_note_t note; /**< note information */
snd_seq_ev_ctrl_t control; /**< MIDI control information */
snd_seq_ev_raw8_t raw8; /**< raw8 data */
snd_seq_ev_raw32_t raw32; /**< raw32 data */
snd_seq_ev_ext_t ext; /**< external data */
snd_seq_ev_queue_control_t queue; /**< queue control */
snd_seq_timestamp_t time; /**< timestamp */
snd_seq_addr_t addr; /**< address */
snd_seq_connect_t connect; /**< connect information */
snd_seq_result_t result; /**< operation result code */
snd_seq_ev_ump_notify_t ump_notify; /**< UMP info change notification */
} snd_seq_event_data_t;
/** Sequencer event */
typedef struct snd_seq_event {
snd_seq_event_type_t type; /**< event type */
unsigned char flags; /**< event flags */
unsigned char tag; /**< tag */
unsigned char queue; /**< schedule queue */
snd_seq_timestamp_t time; /**< schedule time */
snd_seq_addr_t source; /**< source address */
snd_seq_addr_t dest; /**< destination address */
snd_seq_event_data_t data; /**< event data... */
} snd_seq_event_t;
/** UMP sequencer event; compatible with legacy sequencer event */
typedef struct snd_seq_ump_event {
snd_seq_event_type_t type; /**< event type */
unsigned char flags; /**< event flags */
unsigned char tag; /**< tag */
unsigned char queue; /**< schedule queue */
snd_seq_timestamp_t time; /**< schedule time */
snd_seq_addr_t source; /**< source address */
snd_seq_addr_t dest; /**< destination address */
union {
snd_seq_event_data_t data; /**< (shared) legacy data */
unsigned int ump[4]; /**< UMP data bytes */
};
} snd_seq_ump_event_t;
/** \} */
#endif /* __ALSA_SEQ_EVENT_H */

71
include/seq_midi_event.h Normal file
View file

@ -0,0 +1,71 @@
/**
* \file include/seq_midi_event.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/seq_midi_event.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_SEQ_MIDI_EVENT_H
#define __ALSA_SEQ_MIDI_EVENT_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup MIDI_Event Sequencer event <-> MIDI byte stream coder
* \ingroup Sequencer
* Sequencer event <-> MIDI byte stream coder
* \{
*/
/** container for sequencer midi event parsers */
typedef struct snd_midi_event snd_midi_event_t;
int snd_midi_event_new(size_t bufsize, snd_midi_event_t **rdev);
int snd_midi_event_resize_buffer(snd_midi_event_t *dev, size_t bufsize);
void snd_midi_event_free(snd_midi_event_t *dev);
void snd_midi_event_init(snd_midi_event_t *dev);
void snd_midi_event_reset_encode(snd_midi_event_t *dev);
void snd_midi_event_reset_decode(snd_midi_event_t *dev);
void snd_midi_event_no_status(snd_midi_event_t *dev, int on);
/* encode from byte stream - return number of written bytes if success */
long snd_midi_event_encode(snd_midi_event_t *dev, const unsigned char *buf, long count, snd_seq_event_t *ev);
int snd_midi_event_encode_byte(snd_midi_event_t *dev, int c, snd_seq_event_t *ev);
/* decode from event to bytes - return number of written bytes if success */
long snd_midi_event_decode(snd_midi_event_t *dev, unsigned char *buf, long count, const snd_seq_event_t *ev);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_SEQ_MIDI_EVENT_H */

543
include/seqmid.h Normal file
View file

@ -0,0 +1,543 @@
/**
* \file include/seqmid.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/seqmid.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_SEQMID_H
#define __ALSA_SEQMID_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup SeqMiddle Sequencer Middle Level Interface
* Sequencer Middle Level Interface
* \ingroup Sequencer
* \{
*/
/**
* \brief initialize event record
* \param ev event record pointer
*
* This macro clears the given event record pointer to the default status.
*/
static inline void snd_seq_ev_clear(snd_seq_event_t *ev)
{
memset(ev, 0, sizeof(*ev));
}
/**
* \brief initialize event record for UMP
* \param ev event record pointer
*
* This macro clears the given UMP event record pointer to the default status.
*/
static inline void snd_seq_ump_ev_clear(snd_seq_ump_event_t *ev)
{
memset(ev, 0, sizeof(*ev));
}
/**
* \brief set the tag for given event
* \param ev event record
* \param t event tag
*
* This macro sets the tag to the given event record.
*/
#define snd_seq_ev_set_tag(ev,t) \
((ev)->tag = (t))
/**
* \brief set the explicit destination
* \param ev event record
* \param c destination client id
* \param p destination port id
*
* This macro sets the client and port id numbers to the given event record.
*
* \sa snd_seq_ev_set_subs()
*/
#define snd_seq_ev_set_dest(ev,c,p) \
((ev)->dest.client = (c), (ev)->dest.port = (p))
/**
* \brief set broadcasting to subscribers
* \param ev event record
*
* This macro sets the destination as the subscribers.
*
* \sa snd_seq_ev_set_dest()
*/
#define snd_seq_ev_set_subs(ev) \
((ev)->dest.client = SND_SEQ_ADDRESS_SUBSCRIBERS,\
(ev)->dest.port = SND_SEQ_ADDRESS_UNKNOWN)
/**
* \brief set broadcasting to all clients/ports
* \param ev event record
*
* This macro sets the destination as the broadcasting.
*
* \sa snd_seq_ev_set_dest()
*/
#define snd_seq_ev_set_broadcast(ev) \
((ev)->dest.client = SND_SEQ_ADDRESS_BROADCAST,\
(ev)->dest.port = SND_SEQ_ADDRESS_BROADCAST)
/**
* \brief set the source port
* \param ev event record
* \param p source port id
*
* This macro sets the source port id number.
*/
#define snd_seq_ev_set_source(ev,p) \
((ev)->source.port = (p))
/**
* \brief set direct passing mode (without queued)
* \param ev event instance
*
* This macro sets the event to the direct passing mode
* to be delivered immediately without queueing.
*
* \sa snd_seq_ev_schedule_tick(), snd_seq_ev_schedule_real()
*/
#define snd_seq_ev_set_direct(ev) \
((ev)->queue = SND_SEQ_QUEUE_DIRECT)
/**
* \brief set tick-scheduling mode on queue
* \param ev event instance
* \param q queue id to schedule
* \param relative relative time-stamp if non-zero
* \param ttick tick time-stamp to be delivered
*
* This macro sets the scheduling of the event in the
* MIDI tick mode.
*
* \sa snd_seq_ev_schedule_real(), snd_seq_ev_set_direct()
*/
#define snd_seq_ev_schedule_tick(ev, q, relative, ttick) \
((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
(ev)->flags |= SND_SEQ_TIME_STAMP_TICK,\
(ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
(ev)->time.tick = (ttick),\
(ev)->queue = (q))
/**
* \brief set real-time-scheduling mode on queue
* \param ev event instance
* \param q queue id to schedule
* \param relative relative time-stamp if non-zero
* \param rtime time-stamp to be delivered
*
* This macro sets the scheduling of the event in the
* realtime mode.
*
* \sa snd_seq_ev_schedule_tick(), snd_seq_ev_set_direct()
*/
#define snd_seq_ev_schedule_real(ev, q, relative, rtime) \
((ev)->flags &= ~(SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK),\
(ev)->flags |= SND_SEQ_TIME_STAMP_REAL,\
(ev)->flags |= (relative) ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS,\
(ev)->time.time = *(rtime),\
(ev)->queue = (q))
/**
* \brief set event priority
* \param ev event instance
* \param high_prior 1 for high priority mode
*/
#define snd_seq_ev_set_priority(ev, high_prior) \
((ev)->flags &= ~SND_SEQ_PRIORITY_MASK,\
(ev)->flags |= (high_prior) ? SND_SEQ_PRIORITY_HIGH : SND_SEQ_PRIORITY_NORMAL)
/**
* \brief set fixed data
* \param ev event instance
*
* Sets the event length mode as fixed size.
*
* \sa snd_seq_ev_set_variable(), snd_seq_ev_set_varusr()
*/
#define snd_seq_ev_set_fixed(ev) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_FIXED)
/**
* \brief set variable data
* \param ev event instance
* \param datalen length of the external data
* \param dataptr pointer of the external data
*
* Sets the event length mode as variable length and stores the data.
*
* \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_varusr()
*/
#define snd_seq_ev_set_variable(ev, datalen, dataptr) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_VARIABLE,\
(ev)->data.ext.len = (datalen),\
(ev)->data.ext.ptr = (dataptr))
/**
* \brief set varusr data
* \param ev event instance
* \param datalen length of the external data
* \param dataptr pointer of the external data
*
* Sets the event length mode as variable user-space data and stores the data.
*
* \sa snd_seq_ev_set_fixed(), snd_seq_ev_set_variable()
*/
#define snd_seq_ev_set_varusr(ev, datalen, dataptr) \
((ev)->flags &= ~SND_SEQ_EVENT_LENGTH_MASK,\
(ev)->flags |= SND_SEQ_EVENT_LENGTH_VARUSR,\
(ev)->data.ext.len = (datalen),\
(ev)->data.ext.ptr = (dataptr))
/**
* \brief set queue controls
* \param ev event record
* \param typ event type
* \param q queue id
* \param val control value
*/
#define snd_seq_ev_set_queue_control(ev, typ, q, val) \
((ev)->type = (typ),\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.value = (val))
/**
* \brief set the start queue event
* \param ev event record
* \param q queue id to start
*
* \sa snd_seq_ev_set_queue_stop(), snd_seq_ev_set_queue_continue()
*/
#define snd_seq_ev_set_queue_start(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_START, q, 0)
/**
* \brief set the stop queue event
* \param ev event record
* \param q queue id to stop
*
* \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_continue()
*/
#define snd_seq_ev_set_queue_stop(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_STOP, q, 0)
/**
* \brief set the stop queue event
* \param ev event record
* \param q queue id to continue
*
* \sa snd_seq_ev_set_queue_start(), snd_seq_ev_set_queue_stop()
*/
#define snd_seq_ev_set_queue_continue(ev, q) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_CONTINUE, q, 0)
/**
* \brief set the stop queue event
* \param ev event record
* \param q queue id to change tempo
* \param val the new tempo value
*/
#define snd_seq_ev_set_queue_tempo(ev, q, val) \
snd_seq_ev_set_queue_control(ev, SND_SEQ_EVENT_TEMPO, q, val)
/**
* \brief set the real-time position of a queue
* \param ev event record
* \param q queue id to change tempo
* \param rtime the new real-time pointer
*/
#define snd_seq_ev_set_queue_pos_real(ev, q, rtime) \
((ev)->type = SND_SEQ_EVENT_SETPOS_TIME,\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.time.time = *(rtime))
/**
* \brief set the tick-time position of a queue
* \param ev event record
* \param q queue id to change tempo
* \param ttime the new tick-time
*/
#define snd_seq_ev_set_queue_pos_tick(ev, q, ttime) \
((ev)->type = SND_SEQ_EVENT_SETPOS_TICK,\
snd_seq_ev_set_dest(ev, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_TIMER),\
(ev)->data.queue.queue = (q),\
(ev)->data.queue.param.time.tick = (ttime))
/**
* \brief set the event UMP flag
* \param ev event record
*/
static inline void snd_seq_ev_set_ump(snd_seq_ump_event_t *ev)
{
ev->flags |= SND_SEQ_EVENT_UMP;
ev->type = 0; /* unused for UMP */
}
/**
* \brief set the event UMP flag and fill UMP raw bytes
* \param ev event record
* \param data UMP packet data
* \param bytes UMP packet size in bytes
*/
static inline int snd_seq_ev_set_ump_data(snd_seq_ump_event_t *ev, void *data, size_t bytes)
{
if (bytes > 16)
return -EINVAL;
snd_seq_ev_set_ump(ev);
memcpy(ev->ump, data, bytes);
return 0;
}
/* set and send a queue control event */
int snd_seq_control_queue(snd_seq_t *seq, int q, int type, int value, snd_seq_event_t *ev);
/**
* \brief start the specified queue
* \param seq sequencer handle
* \param q queue id to start
* \param ev optional event record (see #snd_seq_control_queue)
*/
#define snd_seq_start_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_START, 0, ev)
/**
* \brief stop the specified queue
* \param seq sequencer handle
* \param q queue id to stop
* \param ev optional event record (see #snd_seq_control_queue)
*/
#define snd_seq_stop_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_STOP, 0, ev)
/**
* \brief continue the specified queue
* \param seq sequencer handle
* \param q queue id to continue
* \param ev optional event record (see #snd_seq_control_queue)
*/
#define snd_seq_continue_queue(seq, q, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_CONTINUE, 0, ev)
/**
* \brief change the tempo of the specified queue
* \param seq sequencer handle
* \param q queue id
* \param tempo the new tempo value
* \param ev optional event record (see #snd_seq_control_queue)
*/
#define snd_seq_change_queue_tempo(seq, q, tempo, ev) \
snd_seq_control_queue(seq, q, SND_SEQ_EVENT_TEMPO, tempo, ev)
/* create a port - simple version - return the port number */
int snd_seq_create_simple_port(snd_seq_t *seq, const char *name,
unsigned int caps, unsigned int type);
/* delete the port */
int snd_seq_delete_simple_port(snd_seq_t *seq, int port);
/* simple subscription between this port and another port
(w/o exclusive & time conversion)
*/
int snd_seq_connect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
int snd_seq_connect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
int snd_seq_disconnect_from(snd_seq_t *seq, int my_port, int src_client, int src_port);
int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest_port);
/*
* set client information
*/
int snd_seq_set_client_name(snd_seq_t *seq, const char *name);
int snd_seq_set_client_event_filter(snd_seq_t *seq, int event_type);
int snd_seq_set_client_midi_version(snd_seq_t *seq, int midi_version);
int snd_seq_set_client_ump_conversion(snd_seq_t *seq, int enable);
int snd_seq_set_client_pool_output(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_output_room(snd_seq_t *seq, size_t size);
int snd_seq_set_client_pool_input(snd_seq_t *seq, size_t size);
/* sync output queue */
int snd_seq_sync_output_queue(snd_seq_t *seq);
/*
* parse the given string and get the sequencer address
*/
int snd_seq_parse_address(snd_seq_t *seq, snd_seq_addr_t *addr, const char *str);
/*
* reset client input/output pool
*/
int snd_seq_reset_pool_output(snd_seq_t *seq);
int snd_seq_reset_pool_input(snd_seq_t *seq);
/**
* \brief set note event
* \param ev event record
* \param ch channel number
* \param key note key
* \param vel velocity
* \param dur duration (in tick or msec)
*/
#define snd_seq_ev_set_note(ev, ch, key, vel, dur) \
((ev)->type = SND_SEQ_EVENT_NOTE,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel),\
(ev)->data.note.duration = (dur))
/**
* \brief set note-on event
* \param ev event record
* \param ch channel number
* \param key note key
* \param vel velocity
*/
#define snd_seq_ev_set_noteon(ev, ch, key, vel) \
((ev)->type = SND_SEQ_EVENT_NOTEON,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
/**
* \brief set note-off event
* \param ev event record
* \param ch channel number
* \param key note key
* \param vel velocity
*/
#define snd_seq_ev_set_noteoff(ev, ch, key, vel) \
((ev)->type = SND_SEQ_EVENT_NOTEOFF,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
/**
* \brief set key-pressure event
* \param ev event record
* \param ch channel number
* \param key note key
* \param vel velocity
*/
#define snd_seq_ev_set_keypress(ev,ch,key,vel) \
((ev)->type = SND_SEQ_EVENT_KEYPRESS,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.note.channel = (ch),\
(ev)->data.note.note = (key),\
(ev)->data.note.velocity = (vel))
/**
* \brief set MIDI controller event
* \param ev event record
* \param ch channel number
* \param cc controller number
* \param val control value
*/
#define snd_seq_ev_set_controller(ev,ch,cc,val) \
((ev)->type = SND_SEQ_EVENT_CONTROLLER,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.param = (cc),\
(ev)->data.control.value = (val))
/**
* \brief set program change event
* \param ev event record
* \param ch channel number
* \param val program number
*/
#define snd_seq_ev_set_pgmchange(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_PGMCHANGE,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
/**
* \brief set pitch-bend event
* \param ev event record
* \param ch channel number
* \param val pitch bend; zero centered from -8192 to 8191
*/
#define snd_seq_ev_set_pitchbend(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_PITCHBEND,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
/**
* \brief set channel pressure event
* \param ev event record
* \param ch channel number
* \param val channel pressure value
*/
#define snd_seq_ev_set_chanpress(ev,ch,val) \
((ev)->type = SND_SEQ_EVENT_CHANPRESS,\
snd_seq_ev_set_fixed(ev),\
(ev)->data.control.channel = (ch),\
(ev)->data.control.value = (val))
/**
* \brief set sysex event
* \param ev event record
* \param datalen length of sysex data
* \param dataptr sysex data pointer
*
* the sysex data must contain the start byte 0xf0 and the end byte 0xf7.
*/
#define snd_seq_ev_set_sysex(ev,datalen,dataptr) \
((ev)->type = SND_SEQ_EVENT_SYSEX,\
snd_seq_ev_set_variable(ev, datalen, dataptr))
/* Helper API functions for UMP endpoint and block creations */
int snd_seq_create_ump_endpoint(snd_seq_t *seq,
const snd_ump_endpoint_info_t *info,
unsigned int num_groups);
int snd_seq_create_ump_block(snd_seq_t *seq, int blkid,
const snd_ump_block_info_t *info);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_SEQMID_H */

View file

@ -0,0 +1,9 @@
SUBDIRS = uapi
alsasoundincludedir = ${includedir}/alsa/sound
alsasoundinclude_HEADERS = asound_fm.h hdsp.h hdspm.h sb16_csp.h \
sscape_ioctl.h emu10k1.h asoc.h tlv.h \
type_compat.h
noinst_HEADERS = asound.h asequencer.h

View file

@ -0,0 +1 @@
#include <alsa/sound/uapi/asequencer.h>

1
include/sound/asoc.h Normal file
View file

@ -0,0 +1 @@
#include <alsa/sound/uapi/asoc.h>

4
include/sound/asound.h Normal file
View file

@ -0,0 +1,4 @@
/* workaround for building with old glibc / kernel headers */
#include <alsa/sound/type_compat.h>
#include <alsa/sound/uapi/asound.h>

View file

@ -0,0 +1 @@
#include <alsa/sound/uapi/asound_fm.h>

11
include/sound/emu10k1.h Normal file
View file

@ -0,0 +1,11 @@
#include <alsa/sound/type_compat.h>
#include <alsa/sound/uapi/emu10k1.h>
#ifndef __emu10k1_type_defined
#define __emu10k1_type_defined
typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;
typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;
typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;
typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;
typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;
typedef struct emu10k1_ctl_elem_id emu10k1_ctl_elem_id_t;
#endif

12
include/sound/hdsp.h Normal file
View file

@ -0,0 +1,12 @@
#include <alsa/sound/type_compat.h>
#include <alsa/sound/uapi/hdsp.h>
#ifndef __hdsp_type_defined
#define __hdsp_type_defined
typedef enum HDSP_IO_Type HDSP_IO_Type;
typedef struct hdsp_peak_rms hdsp_peak_rms_t;
typedef struct hdsp_config_info hdsp_config_info_t;
typedef struct hdsp_firmware hdsp_firmware_t;
typedef struct hdsp_version hdsp_version_t;
typedef struct hdsp_mixer hdsp_mixer_t;
typedef struct hdsp_9632_aeb hdsp_9632_aeb_t;
#endif

10
include/sound/hdspm.h Normal file
View file

@ -0,0 +1,10 @@
#include <alsa/sound/type_compat.h>
#include <alsa/sound/uapi/hdspm.h>
#ifndef __hdspm_type_defined
#define __hdspm_type_defined
typedef struct hdspm_peak_rms hdspm_peak_rms_t;
typedef struct hdspm_config_info hdspm_config_info_t;
typedef struct hdspm_version hdspm_version_t;
typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
typedef struct hdspm_mixer hdspm_mixer_t;
#endif

5
include/sound/sb16_csp.h Normal file
View file

@ -0,0 +1,5 @@
#include <alsa/sound/uapi/sb16_csp.h>
#ifndef __sb16_csp_type_defined
#define __sb16_csp_type_defined
typedef struct snd_sb_csp_microcode snd_sb_csp_microcode_t;
#endif

View file

@ -0,0 +1 @@
#include <alsa/sound/uapi/sscape_ioctl.h>

1
include/sound/tlv.h Normal file
View file

@ -0,0 +1 @@
#include <alsa/sound/uapi/tlv.h>

View file

@ -0,0 +1,59 @@
#ifndef __SOUND_TYPE_COMPAT_H
#define __SOUND_TYPE_COMPAT_H
#ifndef DOC_HIDDEN
#include <stdint.h>
#if defined(__linux__)
#include <linux/types.h>
#else
typedef uint8_t __u8;
typedef uint16_t __u16;
typedef uint32_t __u32;
typedef uint64_t __u64;
typedef int8_t __s8;
typedef int16_t __s16;
typedef int32_t __s32;
typedef int64_t __s64;
#if defined(__sun)
#include <sys/byteorder.h>
#define __cpu_to_le32 LE_32(x)
#define __cpu_to_be32 BE_32(x)
#define __cpu_to_le16 LE_16(x)
#define __cpu_to_be16 BE_16(x)
#else
#include <sys/endian.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define __cpu_to_le32(x) (x)
#define __cpu_to_be32(x) bswap_32(x)
#define __cpu_to_le16(x) (x)
#define __cpu_to_be16(x) bswap_16(x)
#else
#define __cpu_to_le32(x) bswap_32(x)
#define __cpu_to_be32(x) (x)
#define __cpu_to_le16(x) bswap_16(x)
#define __cpu_to_be16(x) (x)
#endif
#endif
#define __le32_to_cpu __cpu_to_le32
#define __be32_to_cpu __cpu_to_be32
#define __le16_to_cpu __cpu_to_le16
#define __be16_to_cpu __cpu_to_be16
#endif
#ifndef __kernel_long_t
#define __kernel_long_t long
#endif
#ifndef __user
#define __user
#endif
#ifndef __packed
#define __packed __attribute__((__packed__))
#endif
#endif /* DOC_HIDDEN */
#endif /* __SOUND_TYPE_COMPAT_H */

View file

@ -0,0 +1,6 @@
alsasounduapiincludedir = ${includedir}/alsa/sound/uapi
alsasounduapiinclude_HEADERS = asound_fm.h hdsp.h hdspm.h sb16_csp.h \
sscape_ioctl.h emu10k1.h asoc.h tlv.h
noinst_HEADERS = asound.h asequencer.h

View file

@ -0,0 +1,661 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* Main header file for the ALSA sequencer
* Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
* (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
*/
#ifndef __SOUND_ASEQUENCER_H
#define __SOUND_ASEQUENCER_H
#include <sound/asound.h>
/** version of the sequencer */
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 5)
/**
* definition of sequencer event types
*/
/** system messages
* event data type = #snd_seq_result
*/
#define SNDRV_SEQ_EVENT_SYSTEM 0
#define SNDRV_SEQ_EVENT_RESULT 1
/** note messages (channel specific)
* event data type = #snd_seq_ev_note
*/
#define SNDRV_SEQ_EVENT_NOTE 5
#define SNDRV_SEQ_EVENT_NOTEON 6
#define SNDRV_SEQ_EVENT_NOTEOFF 7
#define SNDRV_SEQ_EVENT_KEYPRESS 8
/** control messages (channel specific)
* event data type = #snd_seq_ev_ctrl
*/
#define SNDRV_SEQ_EVENT_CONTROLLER 10
#define SNDRV_SEQ_EVENT_PGMCHANGE 11
#define SNDRV_SEQ_EVENT_CHANPRESS 12
#define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */
#define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */
#define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */
#define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */
/** synchronisation messages
* event data type = #snd_seq_ev_ctrl
*/
#define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */
#define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */
#define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */
#define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */
#define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */
/** timer messages
* event data type = snd_seq_ev_queue_control
*/
#define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */
#define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */
#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */
#define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */
#define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */
#define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */
#define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */
#define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */
#define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */
/** others
* event data type = none
*/
#define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */
#define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */
#define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */
/** echo back, kernel private messages
* event data type = any type
*/
#define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */
#define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */
/** system status messages (broadcast for subscribers)
* event data type = snd_seq_addr
*/
#define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */
#define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */
#define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */
#define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */
#define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */
#define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */
/** port connection changes
* event data type = snd_seq_connect
*/
#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
#define SNDRV_SEQ_EVENT_UMP_EP_CHANGE 68 /* UMP EP info has changed */
#define SNDRV_SEQ_EVENT_UMP_BLOCK_CHANGE 69 /* UMP block info has changed */
/* 70-89: synthesizer events - obsoleted */
/** user-defined events with fixed length
* event data type = any
*/
#define SNDRV_SEQ_EVENT_USR0 90
#define SNDRV_SEQ_EVENT_USR1 91
#define SNDRV_SEQ_EVENT_USR2 92
#define SNDRV_SEQ_EVENT_USR3 93
#define SNDRV_SEQ_EVENT_USR4 94
#define SNDRV_SEQ_EVENT_USR5 95
#define SNDRV_SEQ_EVENT_USR6 96
#define SNDRV_SEQ_EVENT_USR7 97
#define SNDRV_SEQ_EVENT_USR8 98
#define SNDRV_SEQ_EVENT_USR9 99
/* 100-118: instrument layer - obsoleted */
/* 119-129: reserved */
/* 130-139: variable length events
* event data type = snd_seq_ev_ext
* (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set)
*/
#define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */
#define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */
/* 132-134: reserved */
#define SNDRV_SEQ_EVENT_USR_VAR0 135
#define SNDRV_SEQ_EVENT_USR_VAR1 136
#define SNDRV_SEQ_EVENT_USR_VAR2 137
#define SNDRV_SEQ_EVENT_USR_VAR3 138
#define SNDRV_SEQ_EVENT_USR_VAR4 139
/* 150-151: kernel events with quote - DO NOT use in user clients */
#define SNDRV_SEQ_EVENT_KERNEL_ERROR 150
#define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */
/* 152-191: reserved */
/* 192-254: hardware specific events */
/* 255: special event */
#define SNDRV_SEQ_EVENT_NONE 255
typedef unsigned char snd_seq_event_type_t;
/** event address */
struct snd_seq_addr {
unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */
unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */
};
/** port connection */
struct snd_seq_connect {
struct snd_seq_addr sender;
struct snd_seq_addr dest;
};
#define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */
#define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */
#define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */
#define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */
/* event mode flag - NOTE: only 8 bits available! */
#define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */
#define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */
#define SNDRV_SEQ_TIME_STAMP_MASK (1<<0)
#define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */
#define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */
#define SNDRV_SEQ_TIME_MODE_MASK (1<<1)
#define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */
#define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */
#define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */
#define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2)
#define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */
#define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */
#define SNDRV_SEQ_PRIORITY_MASK (1<<4)
#define SNDRV_SEQ_EVENT_UMP (1<<5) /* event holds a UMP packet */
/* note event */
struct snd_seq_ev_note {
unsigned char channel;
unsigned char note;
unsigned char velocity;
unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */
unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */
};
/* controller event */
struct snd_seq_ev_ctrl {
unsigned char channel;
unsigned char unused1, unused2, unused3; /* pad */
unsigned int param;
signed int value;
};
/* generic set of bytes (12x8 bit) */
struct snd_seq_ev_raw8 {
unsigned char d[12]; /* 8 bit value */
};
/* generic set of integers (3x32 bit) */
struct snd_seq_ev_raw32 {
unsigned int d[3]; /* 32 bit value */
};
/* external stored data */
struct snd_seq_ev_ext {
unsigned int len; /* length of data */
void *ptr; /* pointer to data (note: maybe 64-bit) */
} __attribute__((packed));
struct snd_seq_result {
int event; /* processed event type */
int result;
};
struct snd_seq_real_time {
unsigned int tv_sec; /* seconds */
unsigned int tv_nsec; /* nanoseconds */
};
typedef unsigned int snd_seq_tick_time_t; /* midi ticks */
union snd_seq_timestamp {
snd_seq_tick_time_t tick;
struct snd_seq_real_time time;
};
struct snd_seq_queue_skew {
unsigned int value;
unsigned int base;
};
/* queue timer control */
struct snd_seq_ev_queue_control {
unsigned char queue; /* affected queue */
unsigned char pad[3]; /* reserved */
union {
signed int value; /* affected value (e.g. tempo) */
union snd_seq_timestamp time; /* time */
unsigned int position; /* sync position */
struct snd_seq_queue_skew skew;
unsigned int d32[2];
unsigned char d8[8];
} param;
};
/* quoted event - inside the kernel only */
struct snd_seq_ev_quote {
struct snd_seq_addr origin; /* original sender */
unsigned short value; /* optional data */
struct snd_seq_event *event; /* quoted event */
} __attribute__((packed));
/* UMP info change notify */
struct snd_seq_ev_ump_notify {
unsigned char client; /* Client number */
unsigned char block; /* Block number (optional) */
};
union snd_seq_event_data { /* event data... */
struct snd_seq_ev_note note;
struct snd_seq_ev_ctrl control;
struct snd_seq_ev_raw8 raw8;
struct snd_seq_ev_raw32 raw32;
struct snd_seq_ev_ext ext;
struct snd_seq_ev_queue_control queue;
union snd_seq_timestamp time;
struct snd_seq_addr addr;
struct snd_seq_connect connect;
struct snd_seq_result result;
struct snd_seq_ev_quote quote;
struct snd_seq_ev_ump_notify ump_notify;
};
/* sequencer event */
struct snd_seq_event {
snd_seq_event_type_t type; /* event type */
unsigned char flags; /* event flags */
char tag;
unsigned char queue; /* schedule queue */
union snd_seq_timestamp time; /* schedule time */
struct snd_seq_addr source; /* source address */
struct snd_seq_addr dest; /* destination address */
union snd_seq_event_data data;
};
/* (compatible) event for UMP-capable clients */
struct snd_seq_ump_event {
snd_seq_event_type_t type; /* event type */
unsigned char flags; /* event flags */
char tag;
unsigned char queue; /* schedule queue */
union snd_seq_timestamp time; /* schedule time */
struct snd_seq_addr source; /* source address */
struct snd_seq_addr dest; /* destination address */
union {
union snd_seq_event_data data;
unsigned int ump[4];
};
};
/*
* bounce event - stored as variable size data
*/
struct snd_seq_event_bounce {
int err;
struct snd_seq_event event;
/* external data follows here. */
};
/* system information */
struct snd_seq_system_info {
int queues; /* maximum queues count */
int clients; /* maximum clients count */
int ports; /* maximum ports per client */
int channels; /* maximum channels per port */
int cur_clients; /* current clients */
int cur_queues; /* current queues */
char reserved[24];
};
/* system running information */
struct snd_seq_running_info {
unsigned char client; /* client id */
unsigned char big_endian; /* 1 = big-endian */
unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */
unsigned char pad; /* reserved */
unsigned char reserved[12];
};
/* known client numbers */
#define SNDRV_SEQ_CLIENT_SYSTEM 0
/* internal client numbers */
#define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */
#define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */
/* client types */
typedef int __bitwise snd_seq_client_type_t;
#define NO_CLIENT ((snd_seq_client_type_t) 0)
#define USER_CLIENT ((snd_seq_client_type_t) 1)
#define KERNEL_CLIENT ((snd_seq_client_type_t) 2)
/* event filter flags */
#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
#define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */
#define SNDRV_SEQ_FILTER_BOUNCE (1U<<2) /* accept bounce event in error */
#define SNDRV_SEQ_FILTER_NO_CONVERT (1U<<30) /* don't convert UMP events */
#define SNDRV_SEQ_FILTER_USE_EVENT (1U<<31) /* use event filter */
struct snd_seq_client_info {
int client; /* client number to inquire */
snd_seq_client_type_t type; /* client type */
char name[64]; /* client name */
unsigned int filter; /* filter flags */
unsigned char multicast_filter[8]; /* multicast filter bitmap */
unsigned char event_filter[32]; /* event filter bitmap */
int num_ports; /* RO: number of ports */
int event_lost; /* number of lost events */
int card; /* RO: card number[kernel] */
int pid; /* RO: pid[user] */
unsigned int midi_version; /* MIDI version */
unsigned int group_filter; /* UMP group filter bitmap
* (bit 0 = groupless messages,
* bit 1-16 = messages for groups 1-16)
*/
char reserved[48]; /* for future use */
};
/* MIDI version numbers in client info */
#define SNDRV_SEQ_CLIENT_LEGACY_MIDI 0 /* Legacy client */
#define SNDRV_SEQ_CLIENT_UMP_MIDI_1_0 1 /* UMP MIDI 1.0 */
#define SNDRV_SEQ_CLIENT_UMP_MIDI_2_0 2 /* UMP MIDI 2.0 */
/* client pool size */
struct snd_seq_client_pool {
int client; /* client number to inquire */
int output_pool; /* outgoing (write) pool size */
int input_pool; /* incoming (read) pool size */
int output_room; /* minimum free pool size for select/blocking mode */
int output_free; /* unused size */
int input_free; /* unused size */
char reserved[64];
};
/* Remove events by specified criteria */
#define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */
#define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */
#define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */
#define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */
#define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */
#define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */
#define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */
#define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */
#define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */
#define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */
struct snd_seq_remove_events {
unsigned int remove_mode; /* Flags that determine what gets removed */
union snd_seq_timestamp time;
unsigned char queue; /* Queue for REMOVE_DEST */
struct snd_seq_addr dest; /* Address for REMOVE_DEST */
unsigned char channel; /* Channel for REMOVE_DEST */
int type; /* For REMOVE_EVENT_TYPE */
char tag; /* Tag for REMOVE_TAG */
int reserved[10]; /* To allow for future binary compatibility */
};
/* known port numbers */
#define SNDRV_SEQ_PORT_SYSTEM_TIMER 0
#define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1
/* port capabilities (32 bits) */
#define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */
#define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */
#define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)
#define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)
#define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)
#define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */
#define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */
#define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */
#define SNDRV_SEQ_PORT_CAP_INACTIVE (1<<8) /* inactive port */
#define SNDRV_SEQ_PORT_CAP_UMP_ENDPOINT (1<<9) /* MIDI 2.0 UMP Endpoint port */
/* port type */
#define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */
#define SNDRV_SEQ_PORT_TYPE_MIDI_UMP (1<<7) /* UMP */
/* other standards...*/
#define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */
#define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */
#define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */
/*...*/
#define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */
#define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */
#define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */
#define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */
#define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */
/* misc. conditioning flags */
#define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)
#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
#define SNDRV_SEQ_PORT_FLG_IS_MIDI1 (1<<3) /* Keep MIDI 1.0 protocol */
/* port direction */
#define SNDRV_SEQ_PORT_DIR_UNKNOWN 0
#define SNDRV_SEQ_PORT_DIR_INPUT 1
#define SNDRV_SEQ_PORT_DIR_OUTPUT 2
#define SNDRV_SEQ_PORT_DIR_BIDIRECTION 3
struct snd_seq_port_info {
struct snd_seq_addr addr; /* client/port numbers */
char name[64]; /* port name */
unsigned int capability; /* port capability bits */
unsigned int type; /* port type bits */
int midi_channels; /* channels per MIDI port */
int midi_voices; /* voices per MIDI port */
int synth_voices; /* voices per SYNTH port */
int read_use; /* R/O: subscribers for output (from this port) */
int write_use; /* R/O: subscribers for input (to this port) */
void *kernel; /* reserved for kernel use (must be NULL) */
unsigned int flags; /* misc. conditioning */
unsigned char time_queue; /* queue # for timestamping */
unsigned char direction; /* port usage direction (r/w/bidir) */
unsigned char ump_group; /* 0 = UMP EP (no conversion), 1-16 = UMP group number */
char reserved[57]; /* for future use */
};
/* queue flags */
#define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */
/* queue information */
struct snd_seq_queue_info {
int queue; /* queue id */
/*
* security settings, only owner of this queue can start/stop timer
* etc. if the queue is locked for other clients
*/
int owner; /* client id for owner of the queue */
unsigned locked:1; /* timing queue locked for other queues */
char name[64]; /* name of this queue */
unsigned int flags; /* flags */
char reserved[60]; /* for future use */
};
/* queue info/status */
struct snd_seq_queue_status {
int queue; /* queue id */
int events; /* read-only - queue size */
snd_seq_tick_time_t tick; /* current tick */
struct snd_seq_real_time time; /* current time */
int running; /* running state of queue */
int flags; /* various flags */
char reserved[64]; /* for the future */
};
/* queue tempo */
struct snd_seq_queue_tempo {
int queue; /* sequencer queue */
unsigned int tempo; /* current tempo, us/tick (or different time-base below) */
int ppq; /* time resolution, ticks/quarter */
unsigned int skew_value; /* queue skew */
unsigned int skew_base; /* queue skew base */
unsigned short tempo_base; /* tempo base in nsec unit; either 10 or 1000 */
char reserved[22]; /* for the future */
};
/* sequencer timer sources */
#define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */
#define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */
#define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */
/* queue timer info */
struct snd_seq_queue_timer {
int queue; /* sequencer queue */
int type; /* source timer type */
union {
struct {
struct snd_timer_id id; /* ALSA's timer ID */
unsigned int resolution; /* resolution in Hz */
} alsa;
} u;
char reserved[64]; /* for the future use */
};
struct snd_seq_queue_client {
int queue; /* sequencer queue */
int client; /* sequencer client */
int used; /* queue is used with this client
(must be set for accepting events) */
/* per client watermarks */
char reserved[64]; /* for future use */
};
#define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */
#define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)
#define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)
struct snd_seq_port_subscribe {
struct snd_seq_addr sender; /* sender address */
struct snd_seq_addr dest; /* destination address */
unsigned int voices; /* number of voices to be allocated (0 = don't care) */
unsigned int flags; /* modes */
unsigned char queue; /* input time-stamp queue (optional) */
unsigned char pad[3]; /* reserved */
char reserved[64];
};
/* type of query subscription */
#define SNDRV_SEQ_QUERY_SUBS_READ 0
#define SNDRV_SEQ_QUERY_SUBS_WRITE 1
struct snd_seq_query_subs {
struct snd_seq_addr root; /* client/port id to be searched */
int type; /* READ or WRITE */
int index; /* 0..N-1 */
int num_subs; /* R/O: number of subscriptions on this port */
struct snd_seq_addr addr; /* R/O: result */
unsigned char queue; /* R/O: result */
unsigned int flags; /* R/O: result */
char reserved[64]; /* for future use */
};
/*
* UMP-specific information
*/
/* type of UMP info query */
#define SNDRV_SEQ_CLIENT_UMP_INFO_ENDPOINT 0
#define SNDRV_SEQ_CLIENT_UMP_INFO_BLOCK 1
struct snd_seq_client_ump_info {
int client; /* client number to inquire/set */
int type; /* type to inquire/set */
unsigned char info[512]; /* info (either UMP ep or block info) */
} __attribute__((packed));
/*
* IOCTL commands
*/
#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
#define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)
#define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)
#define SNDRV_SEQ_IOCTL_USER_PVERSION _IOW('S', 0x04, int)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_UMP_INFO _IOWR('S', 0x12, struct snd_seq_client_ump_info)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_UMP_INFO _IOWR('S', 0x13, struct snd_seq_client_ump_info)
#define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)
#define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)
#define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)
#define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)
#define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)
#define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)
#define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)
#define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)
#define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)
#define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)
#define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)
#endif /* __SOUND_ASEQUENCER_H */

640
include/sound/uapi/asoc.h Normal file
View file

@ -0,0 +1,640 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
*
* Copyright (C) 2012 Texas Instruments Inc.
* Copyright (C) 2015 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
* algorithms, equalisers, DAIs, widgets etc.
*/
#ifndef __LINUX_UAPI_SND_ASOC_H
#define __LINUX_UAPI_SND_ASOC_H
#if defined(__linux__)
#include <linux/types.h>
#endif
/*
* Maximum number of channels topology kcontrol can represent.
*/
#define SND_SOC_TPLG_MAX_CHAN 8
/*
* Maximum number of PCM formats capability
*/
#define SND_SOC_TPLG_MAX_FORMATS 16
/*
* Maximum number of PCM stream configs
*/
#define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
/*
* Maximum number of physical link's hardware configs
*/
#define SND_SOC_TPLG_HW_CONFIG_MAX 8
/* individual kcontrol info types - can be mixed with other types */
#define SND_SOC_TPLG_CTL_VOLSW 1
#define SND_SOC_TPLG_CTL_VOLSW_SX 2
#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3
#define SND_SOC_TPLG_CTL_ENUM 4
#define SND_SOC_TPLG_CTL_BYTES 5
#define SND_SOC_TPLG_CTL_ENUM_VALUE 6
#define SND_SOC_TPLG_CTL_RANGE 7
#define SND_SOC_TPLG_CTL_STROBE 8
/* individual widget kcontrol info types - can be mixed with other types */
#define SND_SOC_TPLG_DAPM_CTL_VOLSW 64
#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65
#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66
#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67
#define SND_SOC_TPLG_DAPM_CTL_PIN 68
/* DAPM widget types - add new items to the end */
#define SND_SOC_TPLG_DAPM_INPUT 0
#define SND_SOC_TPLG_DAPM_OUTPUT 1
#define SND_SOC_TPLG_DAPM_MUX 2
#define SND_SOC_TPLG_DAPM_MIXER 3
#define SND_SOC_TPLG_DAPM_PGA 4
#define SND_SOC_TPLG_DAPM_OUT_DRV 5
#define SND_SOC_TPLG_DAPM_ADC 6
#define SND_SOC_TPLG_DAPM_DAC 7
#define SND_SOC_TPLG_DAPM_SWITCH 8
#define SND_SOC_TPLG_DAPM_PRE 9
#define SND_SOC_TPLG_DAPM_POST 10
#define SND_SOC_TPLG_DAPM_AIF_IN 11
#define SND_SOC_TPLG_DAPM_AIF_OUT 12
#define SND_SOC_TPLG_DAPM_DAI_IN 13
#define SND_SOC_TPLG_DAPM_DAI_OUT 14
#define SND_SOC_TPLG_DAPM_DAI_LINK 15
#define SND_SOC_TPLG_DAPM_BUFFER 16
#define SND_SOC_TPLG_DAPM_SCHEDULER 17
#define SND_SOC_TPLG_DAPM_EFFECT 18
#define SND_SOC_TPLG_DAPM_SIGGEN 19
#define SND_SOC_TPLG_DAPM_SRC 20
#define SND_SOC_TPLG_DAPM_ASRC 21
#define SND_SOC_TPLG_DAPM_ENCODER 22
#define SND_SOC_TPLG_DAPM_DECODER 23
#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER
/* Header magic number and string sizes */
#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */
/* string sizes */
#define SND_SOC_TPLG_NUM_TEXTS 16
/* ABI version */
#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */
#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */
/* Max size of TLV data */
#define SND_SOC_TPLG_TLV_SIZE 32
/*
* File and Block header data types.
* Add new generic and vendor types to end of list.
* Generic types are handled by the core whilst vendors types are passed
* to the component drivers for handling.
*/
#define SND_SOC_TPLG_TYPE_MIXER 1
#define SND_SOC_TPLG_TYPE_BYTES 2
#define SND_SOC_TPLG_TYPE_ENUM 3
#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4
#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5
#define SND_SOC_TPLG_TYPE_DAI_LINK 6
#define SND_SOC_TPLG_TYPE_PCM 7
#define SND_SOC_TPLG_TYPE_MANIFEST 8
#define SND_SOC_TPLG_TYPE_CODEC_LINK 9
#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
#define SND_SOC_TPLG_TYPE_PDATA 11
#define SND_SOC_TPLG_TYPE_DAI 12
#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
/* vendor block IDs - please add new vendor types to end */
#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001
#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002
#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003
#define SND_SOC_TPLG_STREAM_PLAYBACK 0
#define SND_SOC_TPLG_STREAM_CAPTURE 1
/* vendor tuple types */
#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
/* DAI flags */
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
/* DAI clock gating */
#define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0
#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1
#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2
/* DAI mclk_direction */
#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */
#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */
/* DAI physical PCM data formats.
* Add new formats to the end of the list.
*/
#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */
#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */
#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */
#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */
#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */
#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */
#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */
/* left and right justified also known as MSB and LSB respectively */
#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
/* DAI link flags */
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
/* DAI topology BCLK parameter
* For the backwards capability, by default codec is bclk provider
*/
#define SND_SOC_TPLG_BCLK_CP 0 /* codec is bclk provider */
#define SND_SOC_TPLG_BCLK_CC 1 /* codec is bclk consumer */
/* keep previous definitions for compatibility */
#define SND_SOC_TPLG_BCLK_CM SND_SOC_TPLG_BCLK_CP
#define SND_SOC_TPLG_BCLK_CS SND_SOC_TPLG_BCLK_CC
/* DAI topology FSYNC parameter
* For the backwards capability, by default codec is fsync provider
*/
#define SND_SOC_TPLG_FSYNC_CP 0 /* codec is fsync provider */
#define SND_SOC_TPLG_FSYNC_CC 1 /* codec is fsync consumer */
/* keep previous definitions for compatibility */
#define SND_SOC_TPLG_FSYNC_CM SND_SOC_TPLG_FSYNC_CP
#define SND_SOC_TPLG_FSYNC_CS SND_SOC_TPLG_FSYNC_CC
/*
* Block Header.
* This header precedes all object and object arrays below.
*/
struct snd_soc_tplg_hdr {
__le32 magic; /* magic number */
__le32 abi; /* ABI version */
__le32 version; /* optional vendor specific version details */
__le32 type; /* SND_SOC_TPLG_TYPE_ */
__le32 size; /* size of this structure */
__le32 vendor_type; /* optional vendor specific type info */
__le32 payload_size; /* data bytes, excluding this header */
__le32 index; /* identifier for block */
__le32 count; /* number of elements in block */
} __attribute__((packed));
/* vendor tuple for uuid */
struct snd_soc_tplg_vendor_uuid_elem {
__le32 token;
char uuid[16];
} __attribute__((packed));
/* vendor tuple for a bool/byte/short/word value */
struct snd_soc_tplg_vendor_value_elem {
__le32 token;
__le32 value;
} __attribute__((packed));
/* vendor tuple for string */
struct snd_soc_tplg_vendor_string_elem {
__le32 token;
char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
} __attribute__((packed));
struct snd_soc_tplg_vendor_array {
__le32 size; /* size in bytes of the array, including all elements */
__le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
__le32 num_elems; /* number of elements in array */
union {
struct snd_soc_tplg_vendor_uuid_elem uuid[0];
struct snd_soc_tplg_vendor_value_elem value[0];
struct snd_soc_tplg_vendor_string_elem string[0];
};
} __attribute__((packed));
/*
* Private data.
* All topology objects may have private data that can be used by the driver or
* firmware. Core will ignore this data.
*/
struct snd_soc_tplg_private {
__le32 size; /* in bytes of private data */
union {
char data[0];
struct snd_soc_tplg_vendor_array array[0];
};
} __attribute__((packed));
/*
* Kcontrol TLV data.
*/
struct snd_soc_tplg_tlv_dbscale {
__le32 min;
__le32 step;
__le32 mute;
} __attribute__((packed));
struct snd_soc_tplg_ctl_tlv {
__le32 size; /* in bytes of this structure */
__le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
union {
__le32 data[SND_SOC_TPLG_TLV_SIZE];
struct snd_soc_tplg_tlv_dbscale scale;
};
} __attribute__((packed));
/*
* Kcontrol channel data
*/
struct snd_soc_tplg_channel {
__le32 size; /* in bytes of this structure */
__le32 reg;
__le32 shift;
__le32 id; /* ID maps to Left, Right, LFE etc */
} __attribute__((packed));
/*
* Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
* Kcontrol ops need get/put/info.
* Bytes ext ops need get/put.
*/
struct snd_soc_tplg_io_ops {
__le32 get;
__le32 put;
__le32 info;
} __attribute__((packed));
/*
* kcontrol header
*/
struct snd_soc_tplg_ctl_hdr {
__le32 size; /* in bytes of this structure */
__le32 type;
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le32 access;
struct snd_soc_tplg_io_ops ops;
struct snd_soc_tplg_ctl_tlv tlv;
} __attribute__((packed));
/*
* Stream Capabilities
*/
struct snd_soc_tplg_stream_caps {
__le32 size; /* in bytes of this structure */
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
__le32 rates; /* supported rates SNDRV_PCM_RATE_* */
__le32 rate_min; /* min rate */
__le32 rate_max; /* max rate */
__le32 channels_min; /* min channels */
__le32 channels_max; /* max channels */
__le32 periods_min; /* min number of periods */
__le32 periods_max; /* max number of periods */
__le32 period_size_min; /* min period size bytes */
__le32 period_size_max; /* max period size bytes */
__le32 buffer_size_min; /* min buffer size bytes */
__le32 buffer_size_max; /* max buffer size bytes */
__le32 sig_bits; /* number of bits of content */
} __attribute__((packed));
/*
* FE or BE Stream configuration supported by SW/FW
*/
struct snd_soc_tplg_stream {
__le32 size; /* in bytes of this structure */
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */
__le64 format; /* SNDRV_PCM_FMTBIT_* */
__le32 rate; /* SNDRV_PCM_RATE_* */
__le32 period_bytes; /* size of period in bytes */
__le32 buffer_bytes; /* size of buffer in bytes */
__le32 channels; /* channels */
} __attribute__((packed));
/*
* Describes a physical link's runtime supported hardware config,
* i.e. hardware audio formats.
*/
struct snd_soc_tplg_hw_config {
__le32 size; /* in bytes of this structure */
__le32 id; /* unique ID - - used to match */
__le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */
__u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
__u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */
__u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
__u8 bclk_provider; /* SND_SOC_TPLG_BCLK_ value */
__u8 fsync_provider; /* SND_SOC_TPLG_FSYNC_ value */
__u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
__le16 reserved; /* for 32bit alignment */
__le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
__le32 bclk_rate; /* BCLK freqency in Hz */
__le32 fsync_rate; /* frame clock in Hz */
__le32 tdm_slots; /* number of TDM slots in use */
__le32 tdm_slot_width; /* width in bits for each slot */
__le32 tx_slots; /* bit mask for active Tx slots */
__le32 rx_slots; /* bit mask for active Rx slots */
__le32 tx_channels; /* number of Tx channels */
__le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
__le32 rx_channels; /* number of Rx channels */
__le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
} __attribute__((packed));
/*
* Manifest. List totals for each payload type. Not used in parsing, but will
* be passed to the component driver before any other objects in order for any
* global component resource allocations.
*
* File block representation for manifest :-
* +-----------------------------------+----+
* | struct snd_soc_tplg_hdr | 1 |
* +-----------------------------------+----+
* | struct snd_soc_tplg_manifest | 1 |
* +-----------------------------------+----+
*/
struct snd_soc_tplg_manifest {
__le32 size; /* in bytes of this structure */
__le32 control_elems; /* number of control elements */
__le32 widget_elems; /* number of widget elements */
__le32 graph_elems; /* number of graph elements */
__le32 pcm_elems; /* number of PCM elements */
__le32 dai_link_elems; /* number of DAI link elements */
__le32 dai_elems; /* number of physical DAI elements */
__le32 reserved[20]; /* reserved for new ABI element types */
struct snd_soc_tplg_private priv;
} __attribute__((packed));
/*
* Mixer kcontrol.
*
* File block representation for mixer kcontrol :-
* +-----------------------------------+----+
* | struct snd_soc_tplg_hdr | 1 |
* +-----------------------------------+----+
* | struct snd_soc_tplg_mixer_control | N |
* +-----------------------------------+----+
*/
struct snd_soc_tplg_mixer_control {
struct snd_soc_tplg_ctl_hdr hdr;
__le32 size; /* in bytes of this structure */
__le32 min;
__le32 max;
__le32 platform_max;
__le32 invert;
__le32 num_channels;
struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
struct snd_soc_tplg_private priv;
} __attribute__((packed));
/*
* Enumerated kcontrol
*
* File block representation for enum kcontrol :-
* +-----------------------------------+----+
* | struct snd_soc_tplg_hdr | 1 |
* +-----------------------------------+----+
* | struct snd_soc_tplg_enum_control | N |
* +-----------------------------------+----+
*/
struct snd_soc_tplg_enum_control {
struct snd_soc_tplg_ctl_hdr hdr;
__le32 size; /* in bytes of this structure */
__le32 num_channels;
struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
__le32 items;
__le32 mask;
__le32 count;
char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
struct snd_soc_tplg_private priv;
} __attribute__((packed));
/*
* Bytes kcontrol
*
* File block representation for bytes kcontrol :-
* +-----------------------------------+----+
* | struct snd_soc_tplg_hdr | 1 |
* +-----------------------------------+----+
* | struct snd_soc_tplg_bytes_control | N |
* +-----------------------------------+----+
*/
struct snd_soc_tplg_bytes_control {
struct snd_soc_tplg_ctl_hdr hdr;
__le32 size; /* in bytes of this structure */
__le32 max;
__le32 mask;
__le32 base;
__le32 num_regs;
struct snd_soc_tplg_io_ops ext_ops;
struct snd_soc_tplg_private priv;
} __attribute__((packed));
/*
* DAPM Graph Element
*
* File block representation for DAPM graph elements :-
* +-------------------------------------+----+
* | struct snd_soc_tplg_hdr | 1 |
* +-------------------------------------+----+
* | struct snd_soc_tplg_dapm_graph_elem | N |
* +-------------------------------------+----+
*/
struct snd_soc_tplg_dapm_graph_elem {
char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
} __attribute__((packed));
/*
* DAPM Widget.
*
* File block representation for DAPM widget :-
* +-------------------------------------+-----+
* | struct snd_soc_tplg_hdr | 1 |
* +-------------------------------------+-----+
* | struct snd_soc_tplg_dapm_widget | N |
* +-------------------------------------+-----+
* | struct snd_soc_tplg_enum_control | 0|1 |
* | struct snd_soc_tplg_mixer_control | 0|N |
* +-------------------------------------+-----+
*
* Optional enum or mixer control can be appended to the end of each widget
* in the block.
*/
struct snd_soc_tplg_dapm_widget {
__le32 size; /* in bytes of this structure */
__le32 id; /* SND_SOC_DAPM_CTL */
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le32 reg; /* negative reg = no direct dapm */
__le32 shift; /* bits to shift */
__le32 mask; /* non-shifted mask */
__le32 subseq; /* sort within widget type */
__le32 invert; /* invert the power bit */
__le32 ignore_suspend; /* kept enabled over suspend */
__le16 event_flags;
__le16 event_type;
__le32 num_kcontrols;
struct snd_soc_tplg_private priv;
/*
* kcontrols that relate to this widget
* follow here after widget private data
*/
} __attribute__((packed));
/*
* Describes SW/FW specific features of PCM (FE DAI & DAI link).
*
* File block representation for PCM :-
* +-----------------------------------+-----+
* | struct snd_soc_tplg_hdr | 1 |
* +-----------------------------------+-----+
* | struct snd_soc_tplg_pcm | N |
* +-----------------------------------+-----+
*/
struct snd_soc_tplg_pcm {
__le32 size; /* in bytes of this structure */
char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le32 pcm_id; /* unique ID - used to match with DAI link */
__le32 dai_id; /* unique ID - used to match */
__le32 playback; /* supports playback mode */
__le32 capture; /* supports capture mode */
__le32 compress; /* 1 = compressed; 0 = PCM */
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
__le32 num_streams; /* number of streams */
struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
__le32 flag_mask; /* bitmask of flags to configure */
__le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
struct snd_soc_tplg_private priv;
} __attribute__((packed));
/*
* Describes the physical link runtime supported configs or params
*
* File block representation for physical link config :-
* +-----------------------------------+-----+
* | struct snd_soc_tplg_hdr | 1 |
* +-----------------------------------+-----+
* | struct snd_soc_tplg_link_config | N |
* +-----------------------------------+-----+
*/
struct snd_soc_tplg_link_config {
__le32 size; /* in bytes of this structure */
__le32 id; /* unique ID - used to match */
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
__le32 num_streams; /* number of streams */
struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
__le32 num_hw_configs; /* number of hw configs */
__le32 default_hw_config_id; /* default hw config ID for init */
__le32 flag_mask; /* bitmask of flags to configure */
__le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
struct snd_soc_tplg_private priv;
} __attribute__((packed));
/*
* Describes SW/FW specific features of physical DAI.
* It can be used to configure backend DAIs for DPCM.
*
* File block representation for physical DAI :-
* +-----------------------------------+-----+
* | struct snd_soc_tplg_hdr | 1 |
* +-----------------------------------+-----+
* | struct snd_soc_tplg_dai | N |
* +-----------------------------------+-----+
*/
struct snd_soc_tplg_dai {
__le32 size; /* in bytes of this structure */
char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
__le32 dai_id; /* unique ID - used to match */
__le32 playback; /* supports playback mode */
__le32 capture; /* supports capture mode */
struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
__le32 flag_mask; /* bitmask of flags to configure */
__le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */
struct snd_soc_tplg_private priv;
} __attribute__((packed));
/*
* Old version of ABI structs, supported for backward compatibility.
*/
/* Manifest v4 */
struct snd_soc_tplg_manifest_v4 {
__le32 size; /* in bytes of this structure */
__le32 control_elems; /* number of control elements */
__le32 widget_elems; /* number of widget elements */
__le32 graph_elems; /* number of graph elements */
__le32 pcm_elems; /* number of PCM elements */
__le32 dai_link_elems; /* number of DAI link elements */
struct snd_soc_tplg_private priv;
} __attribute__((packed));
/* Stream Capabilities v4 */
struct snd_soc_tplg_stream_caps_v4 {
__le32 size; /* in bytes of this structure */
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
__le32 rates; /* supported rates SNDRV_PCM_RATE_* */
__le32 rate_min; /* min rate */
__le32 rate_max; /* max rate */
__le32 channels_min; /* min channels */
__le32 channels_max; /* max channels */
__le32 periods_min; /* min number of periods */
__le32 periods_max; /* max number of periods */
__le32 period_size_min; /* min period size bytes */
__le32 period_size_max; /* max period size bytes */
__le32 buffer_size_min; /* min buffer size bytes */
__le32 buffer_size_max; /* max buffer size bytes */
} __attribute__((packed));
/* PCM v4 */
struct snd_soc_tplg_pcm_v4 {
__le32 size; /* in bytes of this structure */
char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
__le32 pcm_id; /* unique ID - used to match with DAI link */
__le32 dai_id; /* unique ID - used to match */
__le32 playback; /* supports playback mode */
__le32 capture; /* supports capture mode */
__le32 compress; /* 1 = compressed; 0 = PCM */
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
__le32 num_streams; /* number of streams */
struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */
} __attribute__((packed));
/* Physical link config v4 */
struct snd_soc_tplg_link_config_v4 {
__le32 size; /* in bytes of this structure */
__le32 id; /* unique ID - used to match */
struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
__le32 num_streams; /* number of streams */
} __attribute__((packed));
#endif

1258
include/sound/uapi/asound.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,135 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
#ifndef __SOUND_ASOUND_FM_H
#define __SOUND_ASOUND_FM_H
/*
* Advanced Linux Sound Architecture - ALSA
*
* Interface file between ALSA driver & user space
* Copyright (c) 1994-98 by Jaroslav Kysela <perex@perex.cz>,
* 4Front Technologies
*
* Direct FM control
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#define SNDRV_DM_FM_MODE_OPL2 0x00
#define SNDRV_DM_FM_MODE_OPL3 0x01
struct snd_dm_fm_info {
unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
unsigned char rhythm; /* percussion mode flag */
};
/*
* Data structure composing an FM "note" or sound event.
*/
struct snd_dm_fm_voice {
unsigned char op; /* operator cell (0 or 1) */
unsigned char voice; /* FM voice (0 to 17) */
unsigned char am; /* amplitude modulation */
unsigned char vibrato; /* vibrato effect */
unsigned char do_sustain; /* sustain phase */
unsigned char kbd_scale; /* keyboard scaling */
unsigned char harmonic; /* 4 bits: harmonic and multiplier */
unsigned char scale_level; /* 2 bits: decrease output freq rises */
unsigned char volume; /* 6 bits: volume */
unsigned char attack; /* 4 bits: attack rate */
unsigned char decay; /* 4 bits: decay rate */
unsigned char sustain; /* 4 bits: sustain level */
unsigned char release; /* 4 bits: release rate */
unsigned char feedback; /* 3 bits: feedback for op0 */
unsigned char connection; /* 0 for serial, 1 for parallel */
unsigned char left; /* stereo left */
unsigned char right; /* stereo right */
unsigned char waveform; /* 3 bits: waveform shape */
};
/*
* This describes an FM note by its voice, octave, frequency number (10bit)
* and key on/off.
*/
struct snd_dm_fm_note {
unsigned char voice; /* 0-17 voice channel */
unsigned char octave; /* 3 bits: what octave to play */
unsigned int fnum; /* 10 bits: frequency number */
unsigned char key_on; /* set for active, clear for silent */
};
/*
* FM parameters that apply globally to all voices, and thus are not "notes"
*/
struct snd_dm_fm_params {
unsigned char am_depth; /* amplitude modulation depth (1=hi) */
unsigned char vib_depth; /* vibrato depth (1=hi) */
unsigned char kbd_split; /* keyboard split */
unsigned char rhythm; /* percussion mode select */
/* This block is the percussion instrument data */
unsigned char bass;
unsigned char snare;
unsigned char tomtom;
unsigned char cymbal;
unsigned char hihat;
};
/*
* FM mode ioctl settings
*/
#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
/* for OPL3 only */
#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
/* SBI patch management */
#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
#define SNDRV_DM_FM_OSS_IOCTL_SET_VOICE 0x22
#define SNDRV_DM_FM_OSS_IOCTL_SET_PARAMS 0x23
#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
/*
* Patch Record - fixed size for write
*/
#define FM_KEY_SBI "SBI\032"
#define FM_KEY_2OP "2OP\032"
#define FM_KEY_4OP "4OP\032"
struct sbi_patch {
unsigned char prog;
unsigned char bank;
char key[4];
char name[25];
char extension[7];
unsigned char data[32];
};
#endif /* __SOUND_ASOUND_FM_H */

View file

@ -0,0 +1,387 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
* Creative Labs, Inc.
* Definitions for EMU10K1 (SB Live!) chips
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_EMU10K1_H
#define __SOUND_EMU10K1_H
#ifdef __linux__
#include <linux/types.h>
#endif
/*
* ---- FX8010 ----
*/
#define EMU10K1_CARD_CREATIVE 0x00000000
#define EMU10K1_CARD_EMUAPS 0x00000001
#define EMU10K1_FX8010_PCM_COUNT 8
/*
* Following definition is copied from linux/types.h to support compiling
* this header file in userspace since they are not generally available for
* uapi headers.
*/
#define __EMU10K1_DECLARE_BITMAP(name,bits) \
unsigned long name[(bits) / (sizeof(unsigned long) * 8)]
/* instruction set */
#define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */
#define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */
#define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */
#define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */
#define iMACINT0 0x04 /* R = A + X * Y ; saturation */
#define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */
#define iACC3 0x06 /* R = A + X + Y ; saturation */
#define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */
#define iANDXOR 0x08 /* R = (A & X) ^ Y */
#define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */
#define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */
#define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */
#define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */
#define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */
#define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */
#define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */
/* GPRs */
#define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */
#define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */
#define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */
#define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */
/* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */
#define C_00000000 0x40
#define C_00000001 0x41
#define C_00000002 0x42
#define C_00000003 0x43
#define C_00000004 0x44
#define C_00000008 0x45
#define C_00000010 0x46
#define C_00000020 0x47
#define C_00000100 0x48
#define C_00010000 0x49
#define C_00080000 0x4a
#define C_10000000 0x4b
#define C_20000000 0x4c
#define C_40000000 0x4d
#define C_80000000 0x4e
#define C_7fffffff 0x4f
#define C_ffffffff 0x50
#define C_fffffffe 0x51
#define C_c0000000 0x52
#define C_4f1bbcdc 0x53
#define C_5a7ef9db 0x54
#define C_00100000 0x55 /* ?? */
#define GPR_ACCU 0x56 /* ACCUM, accumulator */
#define GPR_COND 0x57 /* CCR, condition register */
#define GPR_NOISE0 0x58 /* noise source */
#define GPR_NOISE1 0x59 /* noise source */
#define GPR_IRQ 0x5a /* IRQ register */
#define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */
#define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */
#define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
#define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
#define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */
#define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */
#define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
#define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
#define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
#define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
#define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */
#define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */
#define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */
#define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */
#define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */
#define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */
#define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */
#define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */
#define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */
#define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */
#define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */
#define A_GPR(x) (A_FXGPREGBASE + (x))
/* cc_reg constants */
#define CC_REG_NORMALIZED C_00000001
#define CC_REG_BORROW C_00000002
#define CC_REG_MINUS C_00000004
#define CC_REG_ZERO C_00000008
#define CC_REG_SATURATE C_00000010
#define CC_REG_NONZERO C_00000100
/* FX buses */
#define FXBUS_PCM_LEFT 0x00
#define FXBUS_PCM_RIGHT 0x01
#define FXBUS_PCM_LEFT_REAR 0x02
#define FXBUS_PCM_RIGHT_REAR 0x03
#define FXBUS_MIDI_LEFT 0x04
#define FXBUS_MIDI_RIGHT 0x05
#define FXBUS_PCM_CENTER 0x06
#define FXBUS_PCM_LFE 0x07
#define FXBUS_PCM_LEFT_FRONT 0x08
#define FXBUS_PCM_RIGHT_FRONT 0x09
#define FXBUS_MIDI_REVERB 0x0c
#define FXBUS_MIDI_CHORUS 0x0d
#define FXBUS_PCM_LEFT_SIDE 0x0e
#define FXBUS_PCM_RIGHT_SIDE 0x0f
#define FXBUS_PT_LEFT 0x14
#define FXBUS_PT_RIGHT 0x15
/* Inputs */
#define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
#define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
#define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */
#define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */
#define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */
#define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */
#define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */
#define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */
#define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */
#define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */
#define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */
#define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */
#define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */
#define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */
/* Outputs */
#define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */
#define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */
#define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */
#define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */
#define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */
#define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */
#define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */
#define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */
#define EXTOUT_REAR_L 0x08 /* Rear channel - left */
#define EXTOUT_REAR_R 0x09 /* Rear channel - right */
#define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */
#define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */
#define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */
#define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */
#define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */
#define EXTOUT_ACENTER 0x11 /* Analog Center */
#define EXTOUT_ALFE 0x12 /* Analog LFE */
/* Audigy Inputs */
#define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */
#define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */
#define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */
#define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */
#define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */
#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */
#define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */
#define A_EXTIN_LINE2_R 0x09 /* right */
#define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */
#define A_EXTIN_ADC_R 0x0b /* right */
#define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */
#define A_EXTIN_AUX2_R 0x0d /* - right */
/* Audigiy Outputs */
#define A_EXTOUT_FRONT_L 0x00 /* digital front left */
#define A_EXTOUT_FRONT_R 0x01 /* right */
#define A_EXTOUT_CENTER 0x02 /* digital front center */
#define A_EXTOUT_LFE 0x03 /* digital front lfe */
#define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */
#define A_EXTOUT_HEADPHONE_R 0x05 /* right */
#define A_EXTOUT_REAR_L 0x06 /* digital rear left */
#define A_EXTOUT_REAR_R 0x07 /* right */
#define A_EXTOUT_AFRONT_L 0x08 /* analog front left */
#define A_EXTOUT_AFRONT_R 0x09 /* right */
#define A_EXTOUT_ACENTER 0x0a /* analog center */
#define A_EXTOUT_ALFE 0x0b /* analog LFE */
#define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */
#define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */
#define A_EXTOUT_AREAR_L 0x0e /* analog rear left */
#define A_EXTOUT_AREAR_R 0x0f /* right */
#define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */
#define A_EXTOUT_AC97_R 0x11 /* right */
#define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */
#define A_EXTOUT_ADC_CAP_R 0x17 /* right */
#define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */
/* Audigy constants */
#define A_C_00000000 0xc0
#define A_C_00000001 0xc1
#define A_C_00000002 0xc2
#define A_C_00000003 0xc3
#define A_C_00000004 0xc4
#define A_C_00000008 0xc5
#define A_C_00000010 0xc6
#define A_C_00000020 0xc7
#define A_C_00000100 0xc8
#define A_C_00010000 0xc9
#define A_C_00000800 0xca
#define A_C_10000000 0xcb
#define A_C_20000000 0xcc
#define A_C_40000000 0xcd
#define A_C_80000000 0xce
#define A_C_7fffffff 0xcf
#define A_C_ffffffff 0xd0
#define A_C_fffffffe 0xd1
#define A_C_c0000000 0xd2
#define A_C_4f1bbcdc 0xd3
#define A_C_5a7ef9db 0xd4
#define A_C_00100000 0xd5
#define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */
#define A_GPR_COND 0xd7 /* CCR, condition register */
#define A_GPR_NOISE0 0xd8 /* noise source */
#define A_GPR_NOISE1 0xd9 /* noise source */
#define A_GPR_IRQ 0xda /* IRQ register */
#define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */
#define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */
/* definitions for debug register */
#define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */
#define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */
#define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */
#define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */
#define EMU10K1_DBG_STEP 0x00004000 /* start single step */
#define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */
#define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */
/* tank memory address line */
#define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */
#define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */
#define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */
#define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */
#define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */
struct snd_emu10k1_fx8010_info {
unsigned int internal_tram_size; /* in samples */
unsigned int external_tram_size; /* in samples */
char fxbus_names[16][32]; /* names of FXBUSes */
char extin_names[16][32]; /* names of external inputs */
char extout_names[32][32]; /* names of external outputs */
unsigned int gpr_controls; /* count of GPR controls */
};
#define EMU10K1_GPR_TRANSLATION_NONE 0
#define EMU10K1_GPR_TRANSLATION_TABLE100 1
#define EMU10K1_GPR_TRANSLATION_BASS 2
#define EMU10K1_GPR_TRANSLATION_TREBLE 3
#define EMU10K1_GPR_TRANSLATION_ONOFF 4
enum emu10k1_ctl_elem_iface {
EMU10K1_CTL_ELEM_IFACE_MIXER = 2, /* virtual mixer device */
EMU10K1_CTL_ELEM_IFACE_PCM = 3, /* PCM device */
};
struct emu10k1_ctl_elem_id {
unsigned int pad; /* don't use */
int iface; /* interface identifier */
unsigned int device; /* device/client number */
unsigned int subdevice; /* subdevice (substream) number */
unsigned char name[44]; /* ASCII name of item */
unsigned int index; /* index of item */
};
struct snd_emu10k1_fx8010_control_gpr {
struct emu10k1_ctl_elem_id id; /* full control ID definition */
unsigned int vcount; /* visible count */
unsigned int count; /* count of GPR (1..16) */
unsigned short gpr[32]; /* GPR number(s) */
unsigned int value[32]; /* initial values */
unsigned int min; /* minimum range */
unsigned int max; /* maximum range */
unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */
const unsigned int *tlv;
};
/* old ABI without TLV support */
struct snd_emu10k1_fx8010_control_old_gpr {
struct emu10k1_ctl_elem_id id;
unsigned int vcount;
unsigned int count;
unsigned short gpr[32];
unsigned int value[32];
unsigned int min;
unsigned int max;
unsigned int translation;
};
struct snd_emu10k1_fx8010_code {
char name[128];
__EMU10K1_DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */
__u32 *gpr_map; /* initializers */
unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */
struct snd_emu10k1_fx8010_control_gpr *gpr_add_controls; /* GPR controls to add/replace */
unsigned int gpr_del_control_count; /* count of GPR controls to remove */
struct emu10k1_ctl_elem_id *gpr_del_controls; /* IDs of GPR controls to remove */
unsigned int gpr_list_control_count; /* count of GPR controls to list */
unsigned int gpr_list_control_total; /* total count of GPR controls */
struct snd_emu10k1_fx8010_control_gpr *gpr_list_controls; /* listed GPR controls */
__EMU10K1_DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */
__u32 *tram_data_map; /* data initializers */
__u32 *tram_addr_map; /* map initializers */
__EMU10K1_DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */
__u32 *code; /* one instruction - 64 bits */
};
struct snd_emu10k1_fx8010_tram {
unsigned int address; /* 31.bit == 1 -> external TRAM */
unsigned int size; /* size in samples (4 bytes) */
unsigned int *samples; /* pointer to samples (20-bit) */
/* NULL->clear memory */
};
struct snd_emu10k1_fx8010_pcm_rec {
unsigned int substream; /* substream number */
unsigned int res1; /* reserved */
unsigned int channels; /* 16-bit channels count, zero = remove this substream */
unsigned int tram_start; /* ring buffer position in TRAM (in samples) */
unsigned int buffer_size; /* count of buffered samples */
unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */
unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */
unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */
unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */
unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */
unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */
unsigned char pad; /* reserved */
unsigned char etram[32]; /* external TRAM address & data (one per channel) */
unsigned int res2; /* reserved */
};
#define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)
#define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)
#define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)
#define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)
#define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)
#define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)
#define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)
#define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)
#define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)
#define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)
#define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)
#define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)
#define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)
#define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)
#define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)
#endif /* __SOUND_EMU10K1_H */

104
include/sound/uapi/hdsp.h Normal file
View file

@ -0,0 +1,104 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
#ifndef __SOUND_HDSP_H
#define __SOUND_HDSP_H
/*
* Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef __linux__
#include <linux/types.h>
#endif
#define HDSP_MATRIX_MIXER_SIZE 2048
enum HDSP_IO_Type {
Digiface,
Multiface,
H9652,
H9632,
RPM,
Undefined,
};
struct hdsp_peak_rms {
__u32 input_peaks[26];
__u32 playback_peaks[26];
__u32 output_peaks[28];
__u64 input_rms[26];
__u64 playback_rms[26];
/* These are only used for H96xx cards */
__u64 output_rms[26];
};
#define SNDRV_HDSP_IOCTL_GET_PEAK_RMS _IOR('H', 0x40, struct hdsp_peak_rms)
struct hdsp_config_info {
unsigned char pref_sync_ref;
unsigned char wordclock_sync_check;
unsigned char spdif_sync_check;
unsigned char adatsync_sync_check;
unsigned char adat_sync_check[3];
unsigned char spdif_in;
unsigned char spdif_out;
unsigned char spdif_professional;
unsigned char spdif_emphasis;
unsigned char spdif_nonaudio;
unsigned int spdif_sample_rate;
unsigned int system_sample_rate;
unsigned int autosync_sample_rate;
unsigned char system_clock_mode;
unsigned char clock_source;
unsigned char autosync_ref;
unsigned char line_out;
unsigned char passthru;
unsigned char da_gain;
unsigned char ad_gain;
unsigned char phone_gain;
unsigned char xlr_breakout_cable;
unsigned char analog_extension_board;
};
#define SNDRV_HDSP_IOCTL_GET_CONFIG_INFO _IOR('H', 0x41, struct hdsp_config_info)
struct hdsp_firmware {
void *firmware_data; /* 24413 x 4 bytes */
};
#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, struct hdsp_firmware)
struct hdsp_version {
enum HDSP_IO_Type io_type;
unsigned short firmware_rev;
};
#define SNDRV_HDSP_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdsp_version)
struct hdsp_mixer {
unsigned short matrix[HDSP_MATRIX_MIXER_SIZE];
};
#define SNDRV_HDSP_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdsp_mixer)
struct hdsp_9632_aeb {
int aebi;
int aebo;
};
#define SNDRV_HDSP_IOCTL_GET_9632_AEB _IOR('H', 0x45, struct hdsp_9632_aeb)
#endif /* __SOUND_HDSP_H */

226
include/sound/uapi/hdspm.h Normal file
View file

@ -0,0 +1,226 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
#ifndef __SOUND_HDSPM_H
#define __SOUND_HDSPM_H
/*
* Copyright (C) 2003 Winfried Ritsch (IEM)
* based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef __linux__
#include <linux/types.h>
#endif
/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
#define HDSPM_MAX_CHANNELS 64
enum hdspm_io_type {
MADI,
MADIface,
AIO,
AES32,
RayDAT
};
enum hdspm_speed {
ss,
ds,
qs
};
/* -------------------- IOCTL Peak/RMS Meters -------------------- */
struct hdspm_peak_rms {
__u32 input_peaks[64];
__u32 playback_peaks[64];
__u32 output_peaks[64];
__u64 input_rms[64];
__u64 playback_rms[64];
__u64 output_rms[64];
__u8 speed; /* enum {ss, ds, qs} */
int status2;
};
#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
_IOR('H', 0x42, struct hdspm_peak_rms)
/* ------------ CONFIG block IOCTL ---------------------- */
struct hdspm_config {
unsigned char pref_sync_ref;
unsigned char wordclock_sync_check;
unsigned char madi_sync_check;
unsigned int system_sample_rate;
unsigned int autosync_sample_rate;
unsigned char system_clock_mode;
unsigned char clock_source;
unsigned char autosync_ref;
unsigned char line_out;
unsigned int passthru;
unsigned int analog_out;
};
#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
_IOR('H', 0x41, struct hdspm_config)
/*
* If there's a TCO (TimeCode Option) board installed,
* there are further options and status data available.
* The hdspm_ltc structure contains the current SMPTE
* timecode and some status information and can be
* obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
* hdspm_status struct.
*/
enum hdspm_ltc_format {
format_invalid,
fps_24,
fps_25,
fps_2997,
fps_30
};
enum hdspm_ltc_frame {
frame_invalid,
drop_frame,
full_frame
};
enum hdspm_ltc_input_format {
ntsc,
pal,
no_video
};
struct hdspm_ltc {
unsigned int ltc;
enum hdspm_ltc_format format;
enum hdspm_ltc_frame frame;
enum hdspm_ltc_input_format input_format;
};
#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
/*
* The status data reflects the device's current state
* as determined by the card's configuration and
* connection status.
*/
enum hdspm_sync {
hdspm_sync_no_lock = 0,
hdspm_sync_lock = 1,
hdspm_sync_sync = 2
};
enum hdspm_madi_input {
hdspm_input_optical = 0,
hdspm_input_coax = 1
};
enum hdspm_madi_channel_format {
hdspm_format_ch_64 = 0,
hdspm_format_ch_56 = 1
};
enum hdspm_madi_frame_format {
hdspm_frame_48 = 0,
hdspm_frame_96 = 1
};
enum hdspm_syncsource {
syncsource_wc = 0,
syncsource_madi = 1,
syncsource_tco = 2,
syncsource_sync = 3,
syncsource_none = 4
};
struct hdspm_status {
__u8 card_type; /* enum hdspm_io_type */
enum hdspm_syncsource autosync_source;
__u64 card_clock;
__u32 master_period;
union {
struct {
__u8 sync_wc; /* enum hdspm_sync */
__u8 sync_madi; /* enum hdspm_sync */
__u8 sync_tco; /* enum hdspm_sync */
__u8 sync_in; /* enum hdspm_sync */
__u8 madi_input; /* enum hdspm_madi_input */
__u8 channel_format; /* enum hdspm_madi_channel_format */
__u8 frame_format; /* enum hdspm_madi_frame_format */
} madi;
} card_specific;
};
#define SNDRV_HDSPM_IOCTL_GET_STATUS \
_IOR('H', 0x47, struct hdspm_status)
/*
* Get information about the card and its add-ons.
*/
#define HDSPM_ADDON_TCO 1
struct hdspm_version {
__u8 card_type; /* enum hdspm_io_type */
char cardname[20];
unsigned int serial;
unsigned short firmware_rev;
int addons;
};
#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
/* ------------- get Matrix Mixer IOCTL --------------- */
/* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte =
* 32768 Bytes
*/
/* organisation is 64 channelfader in a continuous memory block */
/* equivalent to hardware definition, maybe for future feature of mmap of
* them
*/
/* each of 64 outputs has 64 infader and 64 outfader:
Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
struct hdspm_channelfader {
unsigned int in[HDSPM_MIXER_CHANNELS];
unsigned int pb[HDSPM_MIXER_CHANNELS];
};
struct hdspm_mixer {
struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS];
};
struct hdspm_mixer_ioctl {
struct hdspm_mixer *mixer;
};
/* use indirect access due to the limit of ioctl bit size */
#define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl)
#endif

View file

@ -0,0 +1,123 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si>
* Takashi Iwai <tiwai@suse.de>
*
* SB16ASP/AWE32 CSP control
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __SOUND_SB16_CSP_H
#define __SOUND_SB16_CSP_H
/* CSP modes */
#define SNDRV_SB_CSP_MODE_NONE 0x00
#define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */
#define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */
#define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */
/* CSP load flags */
#define SNDRV_SB_CSP_LOAD_FROMUSER 0x01
#define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02
/* CSP sample width */
#define SNDRV_SB_CSP_SAMPLE_8BIT 0x01
#define SNDRV_SB_CSP_SAMPLE_16BIT 0x02
/* CSP channels */
#define SNDRV_SB_CSP_MONO 0x01
#define SNDRV_SB_CSP_STEREO 0x02
/* CSP rates */
#define SNDRV_SB_CSP_RATE_8000 0x01
#define SNDRV_SB_CSP_RATE_11025 0x02
#define SNDRV_SB_CSP_RATE_22050 0x04
#define SNDRV_SB_CSP_RATE_44100 0x08
#define SNDRV_SB_CSP_RATE_ALL 0x0f
/* CSP running state */
#define SNDRV_SB_CSP_ST_IDLE 0x00
#define SNDRV_SB_CSP_ST_LOADED 0x01
#define SNDRV_SB_CSP_ST_RUNNING 0x02
#define SNDRV_SB_CSP_ST_PAUSED 0x04
#define SNDRV_SB_CSP_ST_AUTO 0x08
#define SNDRV_SB_CSP_ST_QSOUND 0x10
/* maximum QSound value (180 degrees right) */
#define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20
/* maximum microcode RIFF file size */
#define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000
/* microcode header */
struct snd_sb_csp_mc_header {
char codec_name[16]; /* id name of codec */
unsigned short func_req; /* requested function */
};
/* microcode to be loaded */
struct snd_sb_csp_microcode {
struct snd_sb_csp_mc_header info;
unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE];
};
/* start CSP with sample_width in mono/stereo */
struct snd_sb_csp_start {
int sample_width; /* sample width, look above */
int channels; /* channels, look above */
};
/* CSP information */
struct snd_sb_csp_info {
char codec_name[16]; /* id name of codec */
unsigned short func_nr; /* function number */
unsigned int acc_format; /* accepted PCM formats */
unsigned short acc_channels; /* accepted channels */
unsigned short acc_width; /* accepted sample width */
unsigned short acc_rates; /* accepted sample rates */
unsigned short csp_mode; /* CSP mode, see above */
unsigned short run_channels; /* current channels */
unsigned short run_width; /* current sample width */
unsigned short version; /* version id: 0x10 - 0x1f */
unsigned short state; /* state bits */
};
/* HWDEP controls */
/* get CSP information */
#define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info)
/* load microcode to CSP */
/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
* defined for some architectures like MIPS, and it leads to build errors.
* (x86 and co have 14-bit size, thus it's valid, though.)
* As a workaround for skipping the size-limit check, here we don't use the
* normal _IOW() macro but _IOC() with the manual argument.
*/
#define SNDRV_SB_CSP_IOCTL_LOAD_CODE \
_IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
/* unload microcode from CSP */
#define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12)
/* start CSP */
#define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start)
/* stop CSP */
#define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14)
/* pause CSP and DMA transfer */
#define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15)
/* restart CSP and DMA transfer */
#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
#endif /* __SOUND_SB16_CSP_H */

View file

@ -0,0 +1,21 @@
#ifndef SSCAPE_IOCTL_H
#define SSCAPE_IOCTL_H
struct sscape_bootblock
{
unsigned char code[256];
unsigned version;
};
#define SSCAPE_MICROCODE_SIZE 65536
struct sscape_microcode
{
unsigned char *code;
};
#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock)
#define SND_SSCAPE_LOAD_MCODE _IOW ('P', 101, struct sscape_microcode)
#endif

117
include/sound/uapi/tlv.h Normal file
View file

@ -0,0 +1,117 @@
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __UAPI_SOUND_TLV_H
#define __UAPI_SOUND_TLV_H
#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
#define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */
#define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */
/*
* channel-mapping TLV items
* TLV length must match with num_channels
*/
#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */
#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */
#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */
/*
* TLV structure is right behind the struct snd_ctl_tlv:
* unsigned int type - see SNDRV_CTL_TLVT_*
* unsigned int length
* .... data aligned to sizeof(unsigned int), use
* block_length = (length + (sizeof(unsigned int) - 1)) &
* ~(sizeof(unsigned int) - 1)) ....
*/
#define SNDRV_CTL_TLVD_ITEM(type, ...) \
(type), SNDRV_CTL_TLVD_LENGTH(__VA_ARGS__), __VA_ARGS__
#define SNDRV_CTL_TLVD_LENGTH(...) \
((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ }))
/* Accessor offsets for TLV data items */
#define SNDRV_CTL_TLVO_TYPE 0
#define SNDRV_CTL_TLVO_LEN 1
#define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__)
#define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \
unsigned int name[] = { \
SNDRV_CTL_TLVD_CONTAINER_ITEM(__VA_ARGS__) \
}
#define SNDRV_CTL_TLVD_DB_SCALE_MASK 0xffff
#define SNDRV_CTL_TLVD_DB_SCALE_MUTE 0x10000
#define SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_SCALE, \
(min), \
((step) & SNDRV_CTL_TLVD_DB_SCALE_MASK) | \
((mute) ? SNDRV_CTL_TLVD_DB_SCALE_MUTE : 0))
#define SNDRV_CTL_TLVD_DECLARE_DB_SCALE(name, min, step, mute) \
unsigned int name[] = { \
SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
}
/* Accessor offsets for min, mute and step items in dB scale type TLV */
#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2
#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3
/* dB scale specified with min/max values instead of step */
#define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))
#define SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX_MUTE, (min_dB), (max_dB))
#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX(name, min_dB, max_dB) \
unsigned int name[] = { \
SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
}
#define SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE(name, min_dB, max_dB) \
unsigned int name[] = { \
SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \
}
/* Accessor offsets for min, max items in db-minmax types of TLV. */
#define SNDRV_CTL_TLVO_DB_MINMAX_MIN 2
#define SNDRV_CTL_TLVO_DB_MINMAX_MAX 3
/* linear volume between min_dB and max_dB (.01dB unit) */
#define SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_LINEAR, (min_dB), (max_dB))
#define SNDRV_CTL_TLVD_DECLARE_DB_LINEAR(name, min_dB, max_dB) \
unsigned int name[] = { \
SNDRV_CTL_TLVD_DB_LINEAR_ITEM(min_dB, max_dB) \
}
/* Accessor offsets for min, max items in db-linear type of TLV. */
#define SNDRV_CTL_TLVO_DB_LINEAR_MIN 2
#define SNDRV_CTL_TLVO_DB_LINEAR_MAX 3
/* dB range container:
* Items in dB range container must be ordered by their values and by their
* dB values. This implies that larger values must correspond with larger
* dB values (which is also required for all other mixer controls).
*/
/* Each item is: <min> <max> <TLV> */
#define SNDRV_CTL_TLVD_DB_RANGE_ITEM(...) \
SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__)
#define SNDRV_CTL_TLVD_DECLARE_DB_RANGE(name, ...) \
unsigned int name[] = { \
SNDRV_CTL_TLVD_DB_RANGE_ITEM(__VA_ARGS__) \
}
#define SNDRV_CTL_TLVD_DB_GAIN_MUTE -9999999
#endif

2
include/sys.h Normal file
View file

@ -0,0 +1,2 @@
#warning This header is deprecated, use <alsa/asoundlib.h> instead.
#include <alsa/asoundlib.h>

265
include/timer.h Normal file
View file

@ -0,0 +1,265 @@
/**
* \file include/timer.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/timer.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_TIMER_H
#define __ALSA_TIMER_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Timer Timer Interface
* Timer Interface. See \ref timer page for more details.
* \{
*/
/** dlsym version for interface entry callback */
#define SND_TIMER_DLSYM_VERSION _dlsym_timer_001
/** dlsym version for interface entry callback */
#define SND_TIMER_QUERY_DLSYM_VERSION _dlsym_timer_query_001
/** timer identification structure */
typedef struct _snd_timer_id snd_timer_id_t;
/** timer global info structure */
typedef struct _snd_timer_ginfo snd_timer_ginfo_t;
/** timer global params structure */
typedef struct _snd_timer_gparams snd_timer_gparams_t;
/** timer global status structure */
typedef struct _snd_timer_gstatus snd_timer_gstatus_t;
/** timer info structure */
typedef struct _snd_timer_info snd_timer_info_t;
/** timer params structure */
typedef struct _snd_timer_params snd_timer_params_t;
/** timer status structure */
typedef struct _snd_timer_status snd_timer_status_t;
/** timer master class */
typedef enum _snd_timer_class {
SND_TIMER_CLASS_NONE = -1, /**< invalid */
SND_TIMER_CLASS_SLAVE = 0, /**< slave timer */
SND_TIMER_CLASS_GLOBAL, /**< global timer */
SND_TIMER_CLASS_CARD, /**< card timer */
SND_TIMER_CLASS_PCM, /**< PCM timer */
SND_TIMER_CLASS_LAST = SND_TIMER_CLASS_PCM /**< last timer */
} snd_timer_class_t;
/** timer slave class */
typedef enum _snd_timer_slave_class {
SND_TIMER_SCLASS_NONE = 0, /**< none */
SND_TIMER_SCLASS_APPLICATION, /**< for internal use */
SND_TIMER_SCLASS_SEQUENCER, /**< sequencer timer */
SND_TIMER_SCLASS_OSS_SEQUENCER, /**< OSS sequencer timer */
SND_TIMER_SCLASS_LAST = SND_TIMER_SCLASS_OSS_SEQUENCER /**< last slave timer */
} snd_timer_slave_class_t;
/** timer read event identification */
typedef enum _snd_timer_event {
SND_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */
SND_TIMER_EVENT_TICK, /* val = ticks */
SND_TIMER_EVENT_START, /* val = resolution in ns */
SND_TIMER_EVENT_STOP, /* val = 0 */
SND_TIMER_EVENT_CONTINUE, /* val = resolution in ns */
SND_TIMER_EVENT_PAUSE, /* val = 0 */
SND_TIMER_EVENT_EARLY, /* val = 0 */
SND_TIMER_EVENT_SUSPEND, /* val = 0 */
SND_TIMER_EVENT_RESUME, /* val = resolution in ns */
/* master timer events for slave timer instances */
SND_TIMER_EVENT_MSTART = SND_TIMER_EVENT_START + 10,
SND_TIMER_EVENT_MSTOP = SND_TIMER_EVENT_STOP + 10,
SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10,
SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10,
SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10,
SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10
} snd_timer_event_t;
/** timer read structure */
typedef struct _snd_timer_read {
unsigned int resolution; /**< tick resolution in nanoseconds */
unsigned int ticks; /**< count of happened ticks */
} snd_timer_read_t;
/** timer tstamp + event read structure */
typedef struct _snd_timer_tread {
snd_timer_event_t event; /**< Timer event */
snd_htimestamp_t tstamp; /**< Time stamp of each event */
unsigned int val; /**< Event value */
} snd_timer_tread_t;
/** global timer - system */
#define SND_TIMER_GLOBAL_SYSTEM 0
/** global timer - RTC */
#define SND_TIMER_GLOBAL_RTC 1 /* Obsoleted, due to enough legacy. */
/** global timer - HPET */
#define SND_TIMER_GLOBAL_HPET 2
/** global timer - HRTIMER */
#define SND_TIMER_GLOBAL_HRTIMER 3
/** timer open mode flag - non-blocking behaviour */
#define SND_TIMER_OPEN_NONBLOCK (1<<0)
/** use timestamps and event notification - enhanced read */
#define SND_TIMER_OPEN_TREAD (1<<1)
/** timer handle type */
typedef enum _snd_timer_type {
/** Kernel level HwDep */
SND_TIMER_TYPE_HW = 0,
/** Shared memory client timer (not yet implemented) */
SND_TIMER_TYPE_SHM,
/** INET client timer (not yet implemented) */
SND_TIMER_TYPE_INET
} snd_timer_type_t;
/** timer query handle */
typedef struct _snd_timer_query snd_timer_query_t;
/** timer handle */
typedef struct _snd_timer snd_timer_t;
int snd_timer_query_open(snd_timer_query_t **handle, const char *name, int mode);
int snd_timer_query_open_lconf(snd_timer_query_t **handle, const char *name, int mode, snd_config_t *lconf);
int snd_timer_query_close(snd_timer_query_t *handle);
int snd_timer_query_next_device(snd_timer_query_t *handle, snd_timer_id_t *tid);
int snd_timer_query_info(snd_timer_query_t *handle, snd_timer_ginfo_t *info);
int snd_timer_query_params(snd_timer_query_t *handle, snd_timer_gparams_t *params);
int snd_timer_query_status(snd_timer_query_t *handle, snd_timer_gstatus_t *status);
int snd_timer_open(snd_timer_t **handle, const char *name, int mode);
int snd_timer_open_lconf(snd_timer_t **handle, const char *name, int mode, snd_config_t *lconf);
int snd_timer_close(snd_timer_t *handle);
int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *timer,
snd_async_callback_t callback, void *private_data);
snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler);
int snd_timer_poll_descriptors_count(snd_timer_t *handle);
int snd_timer_poll_descriptors(snd_timer_t *handle, struct pollfd *pfds, unsigned int space);
int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_timer_info(snd_timer_t *handle, snd_timer_info_t *timer);
int snd_timer_params(snd_timer_t *handle, snd_timer_params_t *params);
int snd_timer_status(snd_timer_t *handle, snd_timer_status_t *status);
int snd_timer_start(snd_timer_t *handle);
int snd_timer_stop(snd_timer_t *handle);
int snd_timer_continue(snd_timer_t *handle);
ssize_t snd_timer_read(snd_timer_t *handle, void *buffer, size_t size);
size_t snd_timer_id_sizeof(void);
/** allocate #snd_timer_id_t container on stack */
#define snd_timer_id_alloca(ptr) __snd_alloca(ptr, snd_timer_id)
int snd_timer_id_malloc(snd_timer_id_t **ptr);
void snd_timer_id_free(snd_timer_id_t *obj);
void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src);
void snd_timer_id_set_class(snd_timer_id_t *id, int dev_class);
int snd_timer_id_get_class(snd_timer_id_t *id);
void snd_timer_id_set_sclass(snd_timer_id_t *id, int dev_sclass);
int snd_timer_id_get_sclass(snd_timer_id_t *id);
void snd_timer_id_set_card(snd_timer_id_t *id, int card);
int snd_timer_id_get_card(snd_timer_id_t *id);
void snd_timer_id_set_device(snd_timer_id_t *id, int device);
int snd_timer_id_get_device(snd_timer_id_t *id);
void snd_timer_id_set_subdevice(snd_timer_id_t *id, int subdevice);
int snd_timer_id_get_subdevice(snd_timer_id_t *id);
size_t snd_timer_ginfo_sizeof(void);
/** allocate #snd_timer_ginfo_t container on stack */
#define snd_timer_ginfo_alloca(ptr) __snd_alloca(ptr, snd_timer_ginfo)
int snd_timer_ginfo_malloc(snd_timer_ginfo_t **ptr);
void snd_timer_ginfo_free(snd_timer_ginfo_t *obj);
void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src);
int snd_timer_ginfo_set_tid(snd_timer_ginfo_t *obj, snd_timer_id_t *tid);
snd_timer_id_t *snd_timer_ginfo_get_tid(snd_timer_ginfo_t *obj);
unsigned int snd_timer_ginfo_get_flags(snd_timer_ginfo_t *obj);
int snd_timer_ginfo_get_card(snd_timer_ginfo_t *obj);
char *snd_timer_ginfo_get_id(snd_timer_ginfo_t *obj);
char *snd_timer_ginfo_get_name(snd_timer_ginfo_t *obj);
unsigned long snd_timer_ginfo_get_resolution(snd_timer_ginfo_t *obj);
unsigned long snd_timer_ginfo_get_resolution_min(snd_timer_ginfo_t *obj);
unsigned long snd_timer_ginfo_get_resolution_max(snd_timer_ginfo_t *obj);
unsigned int snd_timer_ginfo_get_clients(snd_timer_ginfo_t *obj);
size_t snd_timer_info_sizeof(void);
/** allocate #snd_timer_info_t container on stack */
#define snd_timer_info_alloca(ptr) __snd_alloca(ptr, snd_timer_info)
int snd_timer_info_malloc(snd_timer_info_t **ptr);
void snd_timer_info_free(snd_timer_info_t *obj);
void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src);
int snd_timer_info_is_slave(snd_timer_info_t * info);
int snd_timer_info_get_card(snd_timer_info_t * info);
const char *snd_timer_info_get_id(snd_timer_info_t * info);
const char *snd_timer_info_get_name(snd_timer_info_t * info);
long snd_timer_info_get_resolution(snd_timer_info_t * info);
size_t snd_timer_params_sizeof(void);
/** allocate #snd_timer_params_t container on stack */
#define snd_timer_params_alloca(ptr) __snd_alloca(ptr, snd_timer_params)
int snd_timer_params_malloc(snd_timer_params_t **ptr);
void snd_timer_params_free(snd_timer_params_t *obj);
void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src);
int snd_timer_params_set_auto_start(snd_timer_params_t * params, int auto_start);
int snd_timer_params_get_auto_start(snd_timer_params_t * params);
int snd_timer_params_set_exclusive(snd_timer_params_t * params, int exclusive);
int snd_timer_params_get_exclusive(snd_timer_params_t * params);
int snd_timer_params_set_early_event(snd_timer_params_t * params, int early_event);
int snd_timer_params_get_early_event(snd_timer_params_t * params);
void snd_timer_params_set_ticks(snd_timer_params_t * params, long ticks);
long snd_timer_params_get_ticks(snd_timer_params_t * params);
void snd_timer_params_set_queue_size(snd_timer_params_t * params, long queue_size);
long snd_timer_params_get_queue_size(snd_timer_params_t * params);
void snd_timer_params_set_filter(snd_timer_params_t * params, unsigned int filter);
unsigned int snd_timer_params_get_filter(snd_timer_params_t * params);
size_t snd_timer_status_sizeof(void);
/** allocate #snd_timer_status_t container on stack */
#define snd_timer_status_alloca(ptr) __snd_alloca(ptr, snd_timer_status)
int snd_timer_status_malloc(snd_timer_status_t **ptr);
void snd_timer_status_free(snd_timer_status_t *obj);
void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src);
snd_htimestamp_t snd_timer_status_get_timestamp(snd_timer_status_t * status);
long snd_timer_status_get_resolution(snd_timer_status_t * status);
long snd_timer_status_get_lost(snd_timer_status_t * status);
long snd_timer_status_get_overrun(snd_timer_status_t * status);
long snd_timer_status_get_queue(snd_timer_status_t * status);
/* deprecated functions, for compatibility */
long snd_timer_info_get_ticks(snd_timer_info_t * info);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /** __ALSA_TIMER_H */

1181
include/topology.h Normal file

File diff suppressed because it is too large Load diff

61
include/type_compat.h Normal file
View file

@ -0,0 +1,61 @@
/*
* ALSA lib - compatibility header to be included by local.h
* Copyright (c) 2016 by Thomas Klausner <wiz@NetBSD.org>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef __TYPE_COMPAT_H
#define __TYPE_COMPAT_H
#ifndef EBADFD
#define EBADFD EBADF
#endif
#ifndef ESTRPIPE
#define ESTRPIPE ESPIPE
#endif
#ifndef __u16
#define __u16 uint16_t
#endif
#ifndef __u32
#define __u32 uint32_t
#endif
#ifndef __u64
#define __u64 uint64_t
#endif
#ifndef __le16
#define __le16 uint16_t
#endif
#ifndef __le32
#define __le32 uint32_t
#endif
#ifndef __le64
#define __le64 uint64_t
#endif
#ifndef __kernel_pid_t
#define __kernel_pid_t pid_t
#endif
#ifndef __kernel_off_t
#define __kernel_off_t off_t
#endif
#ifndef __bitwise
#define __bitwise
#endif
#endif

189
include/ump.h Normal file
View file

@ -0,0 +1,189 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
/**
* \file include/ump.h
* \brief API library for ALSA rawmidi/UMP interface
*
* API library for ALSA rawmidi/UMP interface
*/
#if !defined(__ASOUNDLIB_H) && !defined(ALSA_LIBRARY_BUILD)
/* don't use ALSA_LIBRARY_BUILD define in sources outside alsa-lib */
#warning "use #include <alsa/asoundlib.h>, <alsa/ump.h> should not be used directly"
#include <alsa/asoundlib.h>
#endif
#ifndef __ALSA_UMP_H
#define __ALSA_UMP_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup RawMidi RawMidi Interface
* The RawMidi Interface. See \ref rawmidi page for more details.
* \{
*/
/** UMP (Endpoint) RawMIDI device */
typedef struct _snd_ump snd_ump_t;
/** UMP Endpoint information container */
typedef struct snd_ump_endpoint_info snd_ump_endpoint_info_t;
/** UMP Block information container */
typedef struct snd_ump_block_info snd_ump_block_info_t;
int snd_ump_open(snd_ump_t **inputp, snd_ump_t **outputp, const char *name, int mode);
int snd_ump_close(snd_ump_t *ump);
snd_rawmidi_t *snd_ump_rawmidi(snd_ump_t *ump);
const char *snd_ump_name(snd_ump_t *ump);
int snd_ump_poll_descriptors_count(snd_ump_t *ump);
int snd_ump_poll_descriptors(snd_ump_t *ump, struct pollfd *pfds, unsigned int space);
int snd_ump_poll_descriptors_revents(snd_ump_t *ump, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
int snd_ump_nonblock(snd_ump_t *ump, int nonblock);
int snd_ump_rawmidi_info(snd_ump_t *ump, snd_rawmidi_info_t *info);
int snd_ump_rawmidi_params(snd_ump_t *ump, snd_rawmidi_params_t *params);
int snd_ump_rawmidi_params_current(snd_ump_t *ump, snd_rawmidi_params_t *params);
int snd_ump_rawmidi_status(snd_ump_t *ump, snd_rawmidi_status_t *status);
int snd_ump_drop(snd_ump_t *ump);
int snd_ump_drain(snd_ump_t *ump);
ssize_t snd_ump_write(snd_ump_t *ump, const void *buffer, size_t size);
ssize_t snd_ump_read(snd_ump_t *ump, void *buffer, size_t size);
ssize_t snd_ump_tread(snd_ump_t *ump, struct timespec *tstamp, void *buffer, size_t size);
/** Max number of UMP Groups */
#define SND_UMP_MAX_GROUPS 16
/** Max number of UMP Blocks */
#define SND_UMP_MAX_BLOCKS 32
/** UMP direction */
enum _snd_ump_direction {
/** Input only */
SND_UMP_DIR_INPUT = 0x01,
/** Output only */
SND_UMP_DIR_OUTPUT = 0x02,
/** Bidirectional */
SND_UMP_DIR_BIDIRECTION = 0x03,
};
/** UMP EP holds only static blocks */
#define SND_UMP_EP_INFO_STATIC_BLOCKS 0x01
/** Bitmask for UMP EP MIDI protocols */
#define SND_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300
/** Bit flag for MIDI 1.0 protocol */
#define SND_UMP_EP_INFO_PROTO_MIDI1 0x0100
/** Bit flag for MIDI 2.0 protocol */
#define SND_UMP_EP_INFO_PROTO_MIDI2 0x0200
/** Bitmask for UMP Jitter-reduction timestamp */
#define SND_UMP_EP_INFO_PROTO_JRTS_MASK 0x0003
/** Bit flag for JRTS in Transmit */
#define SND_UMP_EP_INFO_PROTO_JRTS_TX 0x0001
/** Bit flag for JRTS in Receive */
#define SND_UMP_EP_INFO_PROTO_JRTS_RX 0x0002
/** Default version passed to UMP Endpoint info */
#define SND_UMP_EP_INFO_DEFAULT_VERSION 0x0101
size_t snd_ump_endpoint_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ump_endpoint_info_t using standard alloca
* \param ptr returned pointer
*/
#define snd_ump_endpoint_info_alloca(ptr) __snd_alloca(ptr, snd_ump_endpoint_info)
int snd_ump_endpoint_info_malloc(snd_ump_endpoint_info_t **info);
void snd_ump_endpoint_info_free(snd_ump_endpoint_info_t *info);
void snd_ump_endpoint_info_clear(snd_ump_endpoint_info_t *info);
void snd_ump_endpoint_info_copy(snd_ump_endpoint_info_t *dst, const snd_ump_endpoint_info_t *src);
int snd_ump_endpoint_info_get_card(const snd_ump_endpoint_info_t *info);
int snd_ump_endpoint_info_get_device(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_flags(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_protocol_caps(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_protocol(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_num_blocks(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_version(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_manufacturer_id(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_family_id(const snd_ump_endpoint_info_t *info);
unsigned int snd_ump_endpoint_info_get_model_id(const snd_ump_endpoint_info_t *info);
const unsigned char *snd_ump_endpoint_info_get_sw_revision(const snd_ump_endpoint_info_t *info);
const char *snd_ump_endpoint_info_get_name(const snd_ump_endpoint_info_t *info);
const char *snd_ump_endpoint_info_get_product_id(const snd_ump_endpoint_info_t *info);
int snd_ump_endpoint_info(snd_ump_t *ump, snd_ump_endpoint_info_t *info);
void snd_ump_endpoint_info_set_card(snd_ump_endpoint_info_t *info, unsigned int card);
void snd_ump_endpoint_info_set_device(snd_ump_endpoint_info_t *info, unsigned int device);
void snd_ump_endpoint_info_set_flags(snd_ump_endpoint_info_t *info, unsigned int flags);
void snd_ump_endpoint_info_set_protocol_caps(snd_ump_endpoint_info_t *info, unsigned int caps);
void snd_ump_endpoint_info_set_protocol(snd_ump_endpoint_info_t *info, unsigned int protocols);
void snd_ump_endpoint_info_set_num_blocks(snd_ump_endpoint_info_t *info, unsigned int num_blocks);
void snd_ump_endpoint_info_set_version(snd_ump_endpoint_info_t *info, unsigned int version);
void snd_ump_endpoint_info_set_manufacturer_id(snd_ump_endpoint_info_t *info, unsigned int id);
void snd_ump_endpoint_info_set_family_id(snd_ump_endpoint_info_t *info, unsigned int id);
void snd_ump_endpoint_info_set_model_id(snd_ump_endpoint_info_t *info, unsigned int id);
void snd_ump_endpoint_info_set_sw_revision(snd_ump_endpoint_info_t *info, const unsigned char *id);
void snd_ump_endpoint_info_set_name(snd_ump_endpoint_info_t *info, const char *name);
void snd_ump_endpoint_info_set_product_id(snd_ump_endpoint_info_t *info, const char *id);
/** Bit flag for MIDI 1.0 port w/o restrict in UMP Block info flags */
#define SND_UMP_BLOCK_IS_MIDI1 (1U << 0)
/** Bit flag for 31.25Kbps B/W MIDI1 port in UMP Block info flags */
#define SND_UMP_BLOCK_IS_LOWSPEED (1U << 1)
/** UMP block user-interface hint */
enum _snd_ump_block_ui_hint {
/** Unknown or undeclared */
SND_UMP_BLOCK_UI_HINT_UNKNOWN = 0x00,
/** Primarily a receiver or a destination for MIDI messages */
SND_UMP_BLOCK_UI_HINT_RECEIVER = 0x01,
/** Primarily a sender or a source of MIDI messages */
SND_UMP_BLOCK_UI_HINT_SENDER = 0x02,
/** Both a sender and receiver of MIDI messages */
SND_UMP_BLOCK_UI_HINT_BOTH = 0x03,
};
/** Default MIDI CI version passed to UMP Block info */
#define SND_UMP_BLOCK_INFO_DEFAULT_MIDI_CI_VERSION 0x01
size_t snd_ump_block_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ump_block_info_t using standard alloca
* \param ptr returned pointer
*/
#define snd_ump_block_info_alloca(ptr) __snd_alloca(ptr, snd_ump_block_info)
int snd_ump_block_info_malloc(snd_ump_block_info_t **info);
void snd_ump_block_info_free(snd_ump_block_info_t *info);
void snd_ump_block_info_clear(snd_ump_block_info_t *info);
void snd_ump_block_info_copy(snd_ump_block_info_t *dst, const snd_ump_block_info_t *src);
int snd_ump_block_info_get_card(const snd_ump_block_info_t *info);
int snd_ump_block_info_get_device(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_block_id(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_active(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_flags(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_direction(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_first_group(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_num_groups(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_midi_ci_version(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_sysex8_streams(const snd_ump_block_info_t *info);
unsigned int snd_ump_block_info_get_ui_hint(const snd_ump_block_info_t *info);
const char *snd_ump_block_info_get_name(const snd_ump_block_info_t *info);
int snd_ump_block_info(snd_ump_t *ump, snd_ump_block_info_t *info);
void snd_ump_block_info_set_card(snd_ump_block_info_t *info, unsigned int card);
void snd_ump_block_info_set_device(snd_ump_block_info_t *info, unsigned int device);
void snd_ump_block_info_set_block_id(snd_ump_block_info_t *info, unsigned int id);
void snd_ump_block_info_set_active(snd_ump_block_info_t *info, unsigned int active);
void snd_ump_block_info_set_flags(snd_ump_block_info_t *info, unsigned int flags);
void snd_ump_block_info_set_direction(snd_ump_block_info_t *info, unsigned int direction);
void snd_ump_block_info_set_first_group(snd_ump_block_info_t *info, unsigned int first_group);
void snd_ump_block_info_set_num_groups(snd_ump_block_info_t *info, unsigned int num_groups);
void snd_ump_block_info_set_midi_ci_version(snd_ump_block_info_t *info, unsigned int version);
void snd_ump_block_info_set_sysex8_streams(snd_ump_block_info_t *info, unsigned int streams);
void snd_ump_block_info_set_ui_hint(snd_ump_block_info_t *info, unsigned int hint);
void snd_ump_block_info_set_name(snd_ump_block_info_t *info, const char *name);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_UMP_H */

1135
include/ump_msg.h Normal file

File diff suppressed because it is too large Load diff

565
include/use-case.h Normal file
View file

@ -0,0 +1,565 @@
/**
* \file include/use-case.h
* \brief use case interface for the ALSA driver
* \author Liam Girdwood <lrg@slimlogic.co.uk>
* \author Stefan Schmidt <stefan@slimlogic.co.uk>
* \author Jaroslav Kysela <perex@perex.cz>
* \author Justin Xu <justinx@slimlogic.co.uk>
* \date 2008-2010
*/
/*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Copyright (C) 2008-2010 SlimLogic Ltd
* Copyright (C) 2010 Wolfson Microelectronics PLC
* Copyright (C) 2010 Texas Instruments Inc.
*
* Support for the verb/device/modifier core logic and API,
* command line tool and file parser was kindly sponsored by
* Texas Instruments Inc.
* Support for multiple active modifiers and devices,
* transition sequences, multiple client access and user defined use
* cases was kindly sponsored by Wolfson Microelectronics PLC.
*/
#ifndef __ALSA_USE_CASE_H
#define __ALSA_USE_CASE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <alsa/asoundlib.h>
/**
* \defgroup ucm Use Case Interface
* The ALSA Use Case manager interface.
* See \ref Usecase page for more details.
* \{
*/
/*! \page Usecase ALSA Use Case Interface
*
* The use case manager works by configuring the sound card ALSA kcontrols to
* change the hardware digital and analog audio routing to match the requested
* device use case. The use case manager kcontrol configurations are stored in
* easy to modify text files.
*
* An audio use case can be defined by a verb and device parameter. The verb
* describes the use case action i.e. a phone call, listening to music, recording
* a conversation etc. The device describes the physical audio capture and playback
* hardware i.e. headphones, phone handset, bluetooth headset, etc.
*
* It's intended clients will mostly only need to set the use case verb and
* device for each system use case change (as the verb and device parameters
* cover most audio use cases).
*
* However there are times when a use case has to be modified at runtime. e.g.
*
* + Incoming phone call when the device is playing music
* + Recording sections of a phone call
* + Playing tones during a call.
*
* In order to allow asynchronous runtime use case adaptations, we have a third
* optional modifier parameter that can be used to further configure
* the use case during live audio runtime.
*
* This interface allows clients to :-
*
* + Query the supported use case verbs, devices and modifiers for the machine.
* + Set and Get use case verbs, devices and modifiers for the machine.
* + Get the ALSA PCM playback and capture device PCMs for use case verb,
* use case device and modifier.
* + Get the TQ parameter for each use case verb, use case device and
* modifier.
* + Get the ALSA master playback and capture volume/switch kcontrols
* or mixer elements for each use case.
*/
/*
* Use Case Verb.
*
* The use case verb is the main device audio action. e.g. the "HiFi" use
* case verb will configure the audio hardware for HiFi Music playback
* and capture.
*/
#define SND_USE_CASE_VERB_INACTIVE "Inactive" /**< Inactive Verb */
#define SND_USE_CASE_VERB_HIFI "HiFi" /**< HiFi Verb */
#define SND_USE_CASE_VERB_HIFI_LOW_POWER "HiFi Low Power" /**< HiFi Low Power Verb */
#define SND_USE_CASE_VERB_VOICE "Voice" /**< Voice Verb */
#define SND_USE_CASE_VERB_VOICE_LOW_POWER "Voice Low Power" /**< Voice Low Power Verb */
#define SND_USE_CASE_VERB_VOICECALL "Voice Call" /**< Voice Call Verb */
#define SND_USE_CASE_VERB_IP_VOICECALL "Voice Call IP" /**< Voice Call IP Verb */
#define SND_USE_CASE_VERB_ANALOG_RADIO "FM Analog Radio" /**< FM Analog Radio Verb */
#define SND_USE_CASE_VERB_DIGITAL_RADIO "FM Digital Radio" /**< FM Digital Radio Verb */
/* add new verbs to end of list */
/*
* Use Case Device.
*
* Physical system devices the render and capture audio. Devices can be OR'ed
* together to support audio on simultaneous devices.
*
* If multiple devices with the same name exists, the number suffixes should
* be added to these names like HDMI1,HDMI2,HDMI3 etc. No number gaps are
* allowed. The names with numbers must be continuous. It is allowed to put
* a whitespace between name and index (like 'Line 1') for the better
* readability. The device names 'Line 1' and 'Line1' are equal for
* this purpose.
*
* If EnableSequence/DisableSequence controls independent paths in the hardware
* it is also recommended to split playback and capture UCM devices and use
* the number suffixes. Example use case: Use the integrated microphone
* in the laptop instead the microphone in headphones.
*
* The preference of the devices is determined by the priority value.
*/
#define SND_USE_CASE_DEV_NONE "None" /**< None Device */
#define SND_USE_CASE_DEV_SPEAKER "Speaker" /**< Speaker Device */
#define SND_USE_CASE_DEV_LINE "Line" /**< Line Device */
#define SND_USE_CASE_DEV_MIC "Mic" /**< Microphone Device */
#define SND_USE_CASE_DEV_HEADPHONES "Headphones" /**< Headphones Device */
#define SND_USE_CASE_DEV_HEADSET "Headset" /**< Headset Device */
#define SND_USE_CASE_DEV_HANDSET "Handset" /**< Handset Device */
#define SND_USE_CASE_DEV_BLUETOOTH "Bluetooth" /**< Bluetooth Device */
#define SND_USE_CASE_DEV_EARPIECE "Earpiece" /**< Earpiece Device */
#define SND_USE_CASE_DEV_SPDIF "SPDIF" /**< SPDIF Device */
#define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI / DisplayPort Device */
#define SND_USE_CASE_DEV_USB "USB" /**< USB Device (multifunctional) */
#define SND_USE_CASE_DEV_DIRECT "Direct" /**< Direct Device (no channel remapping), (e.g. ProAudio usage) */
/* add new devices to end of list */
/*
* Use Case Modifiers.
*
* The use case modifier allows runtime configuration changes to deal with
* asynchronous events.
*
* If multiple modifiers with the same name exists, the number suffixes should
* be added to these names like 'Echo Reference 1','Echo Reference 2' etc.
* No number gaps are allowed. The names with numbers must be continuous.
* It is allowed to put a whitespace between name and index for the better
* readability. The modifier names 'Something 1' and 'Something1' are equal
* for this purpose.
*
* e.g. to record a voice call :-
* 1. Set verb to SND_USE_CASE_VERB_VOICECALL (for voice call)
* 2. Set modifier SND_USE_CASE_MOD_CAPTURE_VOICE when capture required.
* 3. Call snd_use_case_get("CapturePCM") to get ALSA source PCM name
* with captured voice pcm data.
*
* e.g. to play a ring tone when listenin to MP3 Music :-
* 1. Set verb to SND_USE_CASE_VERB_HIFI (for MP3 playback)
* 2. Set modifier to SND_USE_CASE_MOD_PLAY_TONE when incoming call happens.
* 3. Call snd_use_case_get("PlaybackPCM") to get ALSA PCM sink name for
* ringtone pcm data.
*/
#define SND_USE_CASE_MOD_CAPTURE_VOICE "Capture Voice" /**< Capture Voice Modifier */
#define SND_USE_CASE_MOD_CAPTURE_MUSIC "Capture Music" /**< Capture Music Modifier */
#define SND_USE_CASE_MOD_PLAY_MUSIC "Play Music" /**< Play Music Modifier */
#define SND_USE_CASE_MOD_PLAY_VOICE "Play Voice" /**< Play Voice Modifier */
#define SND_USE_CASE_MOD_PLAY_TONE "Play Tone" /**< Play Tone Modifier */
#define SND_USE_CASE_MOD_ECHO_REF "Echo Reference" /**< Echo Reference Modifier */
/* add new modifiers to end of list */
/**
* TQ - Tone Quality
*
* The interface allows clients to determine the audio TQ required for each
* use case verb and modifier. It's intended as an optional hint to the
* audio driver in order to lower power consumption.
*
*/
#define SND_USE_CASE_TQ_MUSIC "Music" /**< Music Tone Quality */
#define SND_USE_CASE_TQ_VOICE "Voice" /**< Voice Tone Quality */
#define SND_USE_CASE_TQ_TONES "Tones" /**< Tones Tone Quality */
/** use case container */
typedef struct snd_use_case_mgr snd_use_case_mgr_t;
/**
* \brief Create an identifier
* \param fmt Format (sprintf like)
* \param ... Optional arguments for sprintf like format
* \return Allocated string identifier or NULL on error
*/
char *snd_use_case_identifier(const char *fmt, ...);
/**
* \brief Free a string list
* \param list The string list to free
* \param items Count of strings
* \return Zero if success, otherwise a negative error code
*/
int snd_use_case_free_list(const char *list[], int items);
/**
* \brief Obtain a list of entries
* \param uc_mgr Use case manager (may be NULL - card list)
* \param identifier (may be NULL - card list)
* \param list Returned allocated list
* \return Number of list entries if success, otherwise a negative error code
*
* Defined identifiers:
* - NULL - get card list
* (in pair cardname+comment)
* - _verbs - get verb list
* (in pair verb+comment)
* - _devices[/{verb}] - get list of supported devices
* (in pair device+comment)
* - _modifiers[/{verb}] - get list of supported modifiers
* (in pair modifier+comment)
* - TQ[/{verb}] - get list of TQ identifiers
* - _enadevs - get list of enabled devices
* - _enamods - get list of enabled modifiers
*
* - _identifiers/{modifier}|{device}[/{verb}] - list of value identifiers
* - _supporteddevs/{modifier}|{device}[/{verb}] - list of supported devices
* - _conflictingdevs/{modifier}|{device}[/{verb}] - list of conflicting devices
*
* Note that at most one of the supported/conflicting devs lists has
* any entries, and when neither is present, all devices are supported.
*
*/
int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
const char **list[]);
/**
* \brief Get current - string
* \param uc_mgr Use case manager
* \param identifier
* \param value Value pointer
* \return Zero if success, otherwise a negative error code
*
* Note: The returned string is dynamically allocated, use free() to
* deallocate this string. (Yes, the value parameter shouldn't be marked as
* "const", but it's too late to fix it, sorry about that.)
*
* Known identifiers:
* - NULL - return current card
* - _verb - return current verb
* - _file - return configuration file loaded for current card
* - _alibcfg - return private alsa-lib's configuration for current card
* - _alibpref - return private alsa-lib's configuration device prefix for current card
*
* - [=]{NAME}[/[{modifier}|{/device}][/{verb}]]
* - value identifier {NAME}
* - Search starts at given modifier or device if any,
* else at a verb
* - Search starts at given verb if any,
* else current verb
* - Searches modifier/device, then verb, then defaults
* - Specify a leading "=" to search only the exact
* device/modifier/verb specified, and not search
* through each object in turn.
* - Examples:
* - "PlaybackPCM/Play Music"
* - "CapturePCM/SPDIF"
* - From ValueDefaults only:
* "=Variable"
* - From current active verb:
* "=Variable//"
* - From verb "Verb":
* "=Variable//Verb"
* - From "Modifier" in current active verb:
* "=Variable/Modifier/"
* - From "Modifier" in "Verb":
* "=Variable/Modifier/Verb"
*
* Recommended names for values:
* - Linked
* - value "True" or "1" (case insensitive)
* - this is a linked UCM card
* - don't use this UCM card, because the other UCM card refers devices
* - valid only in the ValueDefaults section (query '=Linked')
* - TQ
* - Tone Quality
* - Priority
* - priority value (1-10000), higher value means higher priority
* - valid only for verbs
* - for devices - PlaybackPriority and CapturePriority
* - PlaybackPCM
* - full PCM playback device name
* - PlaybackPCMIsDummy
* - Valid values: "yes" and "no". If set to "yes", the PCM named by the
* PlaybackPCM value is a dummy device, meaning that opening it enables
* an audio path in the hardware, but writing to the PCM device has no
* effect.
* - CapturePCM
* - full PCM capture device name
* - CapturePCMIsDummy
* - Valid values: "yes" and "no". If set to "yes", the PCM named by the
* CapturePCM value is a dummy device, meaning that opening it enables
* an audio path in the hardware, but reading from the PCM device has no
* effect.
* - PlaybackRate
* - playback device sample rate
* - PlaybackChannels
* - playback device channel count
* - PlaybackChannel#
* - describe index of the logical channel in the PCM stream
* - e.g. "PlaybackChannel0 2" - logical channel 0 is third channel in the PCM stream
* - PlaybackChannelPos#
* - describe sound position of the logical channel (ALSA chmap names)
* - e.g. "PlaybackChannel0 FR" - logical channel 0 is at front left
* - PlaybackCTL
* - playback control device name
* - PlaybackVolume
* - playback control volume identifier string
* - can be parsed using #snd_use_case_parse_ctl_elem_id()
* - PlaybackSwitch
* - playback control switch identifier string
* - can be parsed using #snd_use_case_parse_ctl_elem_id()
* - PlaybackPriority
* - priority value (1-10000), higher value means higher priority
* - CaptureRate
* - capture device sample rate
* - CaptureChannels
* - capture device channel count
* - CaptureChannel#
* - describe index of the logical channel in the PCM stream
* - e.g. "CaptureChannel0 2" - logical channel 0 is third channel in the PCM stream
* - CaptureChannelPos#
* - describe sound position of the logical channel (ALSA chmap names)
* - e.g. "CaptureChannel0 FR" - logical channel 0 is at front left
* - CaptureCTL
* - capture control device name
* - CaptureVolume
* - capture control volume identifier string
* - can be parsed using #snd_use_case_parse_ctl_elem_id()
* - CaptureSwitch
* - capture control switch identifier string
* - can be parsed using #snd_use_case_parse_ctl_elem_id()
* - CapturePriority
* - priority value (1-10000), higher value means higher priority
* - PlaybackMixer
* - name of playback mixer
* - PlaybackMixerElem
* - mixer element playback identifier
* - can be parsed using #snd_use_case_parse_selem_id()
* - PlaybackMasterElem
* - mixer element playback identifier for the master control
* - can be parsed using #snd_use_case_parse_selem_id()
* - PlaybackMasterType
* - type of the master volume control
* - Valid values: "soft" (software attenuation)
* - CaptureMixer
* - name of capture mixer
* - CaptureMixerElem
* - mixer element capture identifier
* - can be parsed using #snd_use_case_parse_selem_id()
* - CaptureMasterElem
* - mixer element playback identifier for the master control
* - can be parsed using #snd_use_case_parse_selem_id()
* - CaptureMasterType
* - type of the master volume control
* - Valid values: "soft" (software attenuation)
* - CaptureMicInfoFile
* - json file with the microphone array placement and type description
* (e.g. output from nhlt-dmic-info)
* - EDIDFile
* - Path to EDID file for HDMI devices
* - JackCTL
* - jack control device name
* - JackControl
* - jack control identificator
* - can be parsed using snd_use_case_parse_ctl_elem_id()
* - UCM configuration files should contain both JackControl and JackDev
* when possible, because applications are likely to support only one
* or the other
* - JackDev
* - the input device id of the jack (if the full input device path is
* /dev/input/by-id/foo, the JackDev value should be "foo")
* - UCM configuration files should contain both JackControl and JackDev
* when possible, because applications are likely to support only one
* or the other
* - JackHWMute
* If this value is set, it indicates that when the jack is plugged
* in, the hardware automatically mutes some other device(s). The
* value is a space-separated list of device names. If the device
* name contains space, it must be enclosed to ' or ", e.g.:
* JackHWMute "'Dock Headphone' Headphone"
* Note that JackHWMute should be used only when the hardware enforces
* the automatic muting. If the hardware doesn't enforce any muting, it
* may still be tempting to set JackHWMute to trick upper software layers
* to e.g. automatically mute speakers when headphones are plugged in,
* but that's application policy configuration that doesn't belong
* to UCM configuration files.
* - MinBufferLevel
* - This is used on platform where reported buffer level is not accurate.
* E.g. "512", which holds 512 samples in device buffer. Note: this will
* increase latency.
*/
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
const char **value);
/**
* \brief Get current - integer
* \param uc_mgr Use case manager
* \param identifier
* \param value result
* \return Zero if success, otherwise a negative error code
*
* Known identifiers:
* - _devstatus/{device} - return status for given device
* - _modstatus/{modifier} - return status for given modifier
*/
int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
long *value);
/**
* \brief Set new
* \param uc_mgr Use case manager
* \param identifier
* \param value Value
* \return Zero if success, otherwise a negative error code
*
* Known identifiers:
* - _fboot - execute the fixed boot sequence (value = NULL)
* - _boot - execute the boot sequence (value = NULL)
* - only when driver controls identifiers are changed
* (otherwise the old control values are restored)
* - _defaults - execute the 'defaults' sequence (value = NULL)
* - _verb - set current verb = value
* - _enadev - enable given device = value
* - _disdev - disable given device = value
* - _swdev/{old_device} - new_device = value
* - disable old_device and then enable new_device
* - if old_device is not enabled just return
* - check transmit sequence firstly
* - _enamod - enable given modifier = value
* - _dismod - disable given modifier = value
* - _swmod/{old_modifier} - new_modifier = value
* - disable old_modifier and then enable new_modifier
* - if old_modifier is not enabled just return
* - check transmit sequence firstly
*/
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
const char *identifier,
const char *value);
/**
* \brief Open and initialise use case core for sound card
* \param uc_mgr Returned use case manager pointer
* \param card_name Sound card name.
* \return zero if success, otherwise a negative error code
*
* By default only first card is used when the driver card
* name or long name is passed in the card_name argument.
*
* The "strict:" prefix in the card_name defines that
* there is no driver name / long name matching. The straight
* configuration is used.
*
* The "hw:" prefix in the card_name will load the configuration
* for the ALSA card specified by the card index (value) or
* the card string identificator.
*
* The sound card might be also composed from several physical
* sound cards (for the default and strict card_name).
* The application cannot expect that the device names will refer
* only one ALSA sound card in this case.
*/
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr,
const char *card_name);
/**
* \brief Reload and re-parse use case configuration files for sound card.
* \param uc_mgr Use case manager
* \return zero if success, otherwise a negative error code
*/
int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr);
/**
* \brief Close use case manager
* \param uc_mgr Use case manager
* \return zero if success, otherwise a negative error code
*/
int snd_use_case_mgr_close(snd_use_case_mgr_t *uc_mgr);
/**
* \brief Reset use case manager verb, device, modifier to deafult settings.
* \param uc_mgr Use case manager
* \return zero if success, otherwise a negative error code
*/
int snd_use_case_mgr_reset(snd_use_case_mgr_t *uc_mgr);
/*
* helper functions
*/
/**
* \brief Obtain a list of cards
* \param list Returned allocated list
* \return Number of list entries if success, otherwise a negative error code
*/
static __inline__ int snd_use_case_card_list(const char **list[])
{
return snd_use_case_get_list(NULL, NULL, list);
}
/**
* \brief Obtain a list of verbs
* \param uc_mgr Use case manager
* \param list Returned list of verbs
* \return Number of list entries if success, otherwise a negative error code
*/
static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
const char **list[])
{
return snd_use_case_get_list(uc_mgr, "_verbs", list);
}
/**
* \brief Parse control element identifier
* \param dst Element identifier
* \param ucm_id Use case identifier
* \param value String value to be parsed
* \return Zero if success, otherwise a negative error code
*/
int snd_use_case_parse_ctl_elem_id(snd_ctl_elem_id_t *dst,
const char *ucm_id,
const char *value);
/**
* \brief Parse mixer element identifier
* \param dst Simple mixer element identifier
* \param ucm_id Use case identifier
* \param value String value to be parsed
* \return Zero if success, otherwise a negative error code
*/
int snd_use_case_parse_selem_id(snd_mixer_selem_id_t *dst,
const char *ucm_id,
const char *value);
/**
* \}
*/
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_USE_CASE_H */

13
include/version.h Normal file
View file

@ -0,0 +1,13 @@
/*
* version.h
*/
#define SND_LIB_MAJOR 1 /**< major number of library version */
#define SND_LIB_MINOR 2 /**< minor number of library version */
#define SND_LIB_SUBMINOR 14 /**< subminor number of library version */
#define SND_LIB_EXTRAVER 1000000 /**< extra version number, used mainly for betas */
/** library version */
#define SND_LIB_VER(maj, min, sub) (((maj)<<16)|((min)<<8)|(sub))
#define SND_LIB_VERSION SND_LIB_VER(SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR)
/** library version (string) */
#define SND_LIB_VERSION_STR "1.2.14"

View file

@ -0,0 +1,24 @@
dnl Check compiler support for symver function attribute
AC_DEFUN([AC_CHECK_ATTRIBUTE_SYMVER], [
saved_CFLAGS=$CFLAGS
CFLAGS="-O0 -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
void _test_attribute_symver(void);
__attribute__((__symver__("sym@VER_1.2.3"))) void _test_attribute_symver(void) {}
]],
[[
_test_attribute_symver()
]]
)],
[
AC_DEFINE([HAVE_ATTRIBUTE_SYMVER], 1, [Define to 1 if __attribute__((symver)) is supported])
],
[
AC_DEFINE([HAVE_ATTRIBUTE_SYMVER], 0, [Define to 0 if __attribute__((symver)) is not supported])
]
)
CFLAGS=$saved_CFLAGS
])

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