commit msg

Signed-off-by: xuxuehai <xuxuehai2@huawei.com>
This commit is contained in:
xuxuehai 2024-05-16 17:35:05 +08:00
parent b03597f7cc
commit 582d7b6130
187 changed files with 6138 additions and 1540 deletions

View File

@ -13,10 +13,12 @@ jobs:
dnf -y upgrade
dnf -y install @development-tools libtool bzip2
- name: Checkout
uses: actions/checkout@v2
- name: Checkout all tags
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Safe git directory
run: |
git fetch --prune --unshallow
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Modify version
run: |
mv configure.ac configure.ac.old
@ -73,7 +75,7 @@ jobs:
image: ubuntu:latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Prepare environment
run: |
export DEBIAN_FRONTEND=noninteractive

1
.gitignore vendored
View File

@ -43,6 +43,7 @@ m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
src/Versions
src/Versions.in
src/conf/topology/sklrt286/data/pvt_data
src/control/ctl_symbols_list.c
src/pcm/pcm_symbols_list.c

View File

@ -1,7 +1,7 @@
# 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)
[![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.

View File

@ -18,6 +18,8 @@
*
*/
#include "aserver.h"
#include <sys/shm.h>
#include <sys/socket.h>
#include <poll.h>
@ -33,7 +35,6 @@
#include <limits.h>
#include <signal.h>
#include "aserver.h"
char *command;
@ -530,7 +531,7 @@ transport_ops_t pcm_shm_ops = {
static int ctl_handler(waiter_t *waiter, unsigned short events)
{
client_t *client = waiter->private_data;
char buf[1];
char buf[1] = "";
ssize_t n;
if (events & POLLIN) {
n = write(client->poll_fd, buf, 1);
@ -737,7 +738,7 @@ static int snd_client_open(client_t *client)
ans.result = -EINVAL;
goto _answer;
}
name = alloca(req.namelen);
name = alloca(req.namelen + 1);
err = read(client->ctrl_fd, name, req.namelen);
if (err < 0) {
SYSERROR("read failed");
@ -774,6 +775,10 @@ static int snd_client_open(client_t *client)
name[req.namelen] = '\0';
client->transport_type = req.transport_type;
if (sizeof(client->name) < (size_t)(req.namelen + 1)) {
ans.result = -ENOMEM;
goto _answer;
}
strcpy(client->name, name);
client->stream = req.stream;
client->mode = req.mode;

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(alsa-lib, 1.2.6)
AC_INIT(alsa-lib, 1.2.11)
AC_CONFIG_SRCDIR([src/control/control.c])
AC_CONFIG_MACRO_DIR([m4])
@ -46,12 +46,16 @@ 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)
@ -235,6 +239,19 @@ 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,
@ -242,9 +259,8 @@ AC_ARG_WITH(libdl,
[ have_libdl="$withval" ], [ have_libdl="yes" ])
HAVE_LIBDL=
if test "$have_libdl" = "yes"; then
AC_CHECK_LIB([dl], [dlsym], [HAVE_LIBDL="yes"])
AC_SEARCH_LIBS([dlsym], [dl], [HAVE_LIBDL="yes"])
if test "$HAVE_LIBDL" = "yes" ; then
ALSA_DEPLIBS="$ALSA_DEPLIBS -ldl"
AC_DEFINE([HAVE_LIBDL], 1, [Have libdl])
fi
else
@ -322,7 +338,7 @@ else
fi
dnl Check for headers
AC_CHECK_HEADERS([endian.h sys/endian.h sys/shm.h])
AC_CHECK_HEADERS([endian.h sys/endian.h sys/shm.h malloc.h])
dnl Check for resmgr support...
AC_MSG_CHECKING(for resmgr support)
@ -626,6 +642,9 @@ 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
@ -731,28 +750,31 @@ if test ! -L "$srcdir"/include/alsa ; then
ln -sf . "$srcdir"/include/alsa
fi
AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
include/Makefile include/sound/Makefile include/sound/uapi/Makefile \
src/Versions 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/alisp/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 \
alsalisp/Makefile aserver/Makefile \
test/Makefile test/lsb/Makefile \
utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)
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/alisp/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 \
alsalisp/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
if test "$ac_cv_header_sys_endian_h" = "yes"; then
else
cat >> include/asoundlib.h <<EOF
#include <sys/endian.h>
#ifndef __BYTE_ORDER
@ -768,9 +790,11 @@ 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>
@ -782,6 +806,7 @@ cat >> include/asoundlib.h <<EOF
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

View File

@ -36,18 +36,21 @@ INPUT = @top_srcdir@/doc/index.doxygen \
@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 \
@ -109,8 +112,9 @@ EXCLUDE = @top_srcdir@/src/control/control_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 = pictures
IMAGE_PATH = @top_srcdir@/doc/pictures
QUIET = YES
EXTRACT_ALL = NO
@ -126,7 +130,8 @@ PREDEFINED = DOXYGEN PIC "DOC_HIDDEN" \
ALSA_PCM_NEW_HW_PARAMS_API \
_POSIX_C_SOURCE \
"use_default_symbol_version(x,y,z)=" \
"link_warning(x,y)="
"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

View File

@ -1 +1,9 @@
EXTRA_DIST=wave1.gif wave2.gif
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

View File

@ -2,7 +2,8 @@
set -e
bit32=
bits32=
cbits32=
modules=
alisp=
lto=
@ -12,6 +13,7 @@ if [ $# -ne 0 ]; then
case "$1" in
32)
bits32=yes
cbits32="-m32"
echo "Forced 32-bit library build..."
shift ;;
modules)
@ -30,6 +32,10 @@ if [ $# -ne 0 ]; then
lto="-flto -flto-partition=none"
echo "Forced lto build..."
shift ;;
static)
static=yes
echo "Selected static build..."
shift ;;
*)
endloop=yes
;;
@ -40,7 +46,7 @@ if [ $# -ne 0 -a -z "$bit32" ]; then
args="$@"
elif [ -r /etc/asound/library_args ]; then
args="`cat /etc/asound/library_args`"
if [ -z "$bit32" ]; then
if [ -z "$bits32" ]; then
test -r /etc/asound/library64_args && \
args="`cat /etc/asound/library64_args`"
fi
@ -48,7 +54,7 @@ else
prefix="/usr"
libdir="/usr/lib"
libdir2="/usr/lib"
if [ -z "$bit32" ]; then
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"
@ -73,6 +79,12 @@ 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
@ -80,7 +92,7 @@ autoheader
automake --foreign --copy --add-missing
touch depcomp # seems to be missing for old automake
autoconf
export CFLAGS="-O2 -Wall -W -Wunused-const-variable=0 -pipe -g $lto"
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"

View File

@ -34,7 +34,7 @@ endif
endif
if BUILD_RAWMIDI
alsainclude_HEADERS += rawmidi.h
alsainclude_HEADERS += rawmidi.h ump.h ump_msg.h
endif
if BUILD_HWDEP

View File

@ -29,10 +29,17 @@
#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")))

View File

@ -18,9 +18,9 @@
*
*/
#include <netdb.h>
#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);

View File

@ -215,6 +215,8 @@ extern "C" {
#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.
@ -224,6 +226,8 @@ extern "C" {
#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.
@ -335,8 +339,6 @@ extern "C" {
/** \} */
/** \} */
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +1,14 @@
/*
* ALSA lib header file include/asoundlib.h
* Copyright (c) 2022 Huawei Device Co., Ltd.
/**
* \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
@ -33,9 +40,11 @@
#include <stdarg.h>
#include <endian.h>
#ifndef DOC_HIDDEN
#ifndef __GNUC__
#define __inline__ inline
#endif
#endif /* DOC_HIDDEN */
#include <alsa/asoundef.h>
#include <alsa/version.h>
@ -46,6 +55,7 @@
#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>

View File

@ -27,6 +27,11 @@
#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

View File

@ -33,7 +33,7 @@ extern "C" {
#endif
/**
* \defgroup Config Configuration Interface
* \defgroup Configuration Configuration Interface
* The configuration functions and types allow you to read, enumerate,
* modify and write the contents of ALSA configuration files.
* \{
@ -109,6 +109,16 @@ 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,
@ -129,6 +139,7 @@ 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,

View File

@ -1,31 +1,11 @@
/*
* ALSA lib header file include/config.h
* Copyright (c) 2022 Huawei Device Co., Ltd.
*
* 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_CONFIG_H
#define __ALSA_CONFIG_H
/* 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 "/system/etc/audio/alsa/share"
#define ALSA_CONFIG_DIR "/usr/share/alsa"
/* Enable assert at error message handler */
/* #undef ALSA_DEBUG_ASSERT */
@ -33,8 +13,11 @@
/* 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 "/system/lib"
#define ALSA_PLUGIN_DIR "/usr/lib/alsa-lib"
/* Build hwdep component */
#define BUILD_HWDEP "1"
@ -51,6 +34,9 @@
/* 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"
@ -78,6 +64,9 @@
/* Build UCM component */
#define BUILD_UCM "1"
/* Define to 0 if __attribute__((symver)) is not supported */
#define HAVE_ATTRIBUTE_SYMVER 0
/* Have clock gettime */
#define HAVE_CLOCK_GETTIME 1
@ -93,6 +82,9 @@
/* 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
@ -105,11 +97,14 @@
/* Have librt */
#define HAVE_LIBRT 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* MMX technology is enabled */
/* #undef HAVE_MMX */
#define HAVE_MMX "1"
/* Define if your pthreads implementation have PTHREAD_MUTEX_RECURSIVE */
#define HAVE_PTHREAD_MUTEX_RECURSIVE /**/
@ -172,7 +167,7 @@
#define PACKAGE_NAME "alsa-lib"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "alsa-lib 1.2.6"
#define PACKAGE_STRING "alsa-lib 1.2.11"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "alsa-lib"
@ -181,7 +176,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.2.6"
#define PACKAGE_VERSION "1.2.11"
/* Max number of cards */
#define SND_MAX_CARDS 32
@ -204,11 +199,44 @@
/* directory to put tmp socket files */
#define TMPDIR "/tmp"
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* sound library version string */
#define VERSION "1.2.6"
#define VERSION "1.2.11"
/* compiled with versioned symbols */
#define VERSIONED_SYMBOLS
#define VERSIONED_SYMBOLS /**/
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* 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 */
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
@ -231,5 +259,3 @@
#ifndef __cplusplus
/* #undef inline */
#endif
#endif /* __ALSA_CONFIG_H */

View File

@ -356,6 +356,9 @@ typedef enum _snd_ctl_type {
/** 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;
@ -371,10 +374,6 @@ 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_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);
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);
@ -415,6 +414,11 @@ 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);
@ -791,6 +795,20 @@ 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

View File

@ -51,6 +51,11 @@ const char *snd_asoundlib_version(void);
#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. */
@ -82,18 +87,13 @@ extern struct snd_dlsym_link *snd_dlsym_start;
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 = # name; \
__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
#ifndef __STRING
/** \brief Return 'x' argument as string */
#define __STRING(x) #x
#endif
/** \brief Returns the version of a dynamic symbol as a string. */
#define SND_DLSYM_VERSION(version) __STRING(version)

View File

@ -28,6 +28,8 @@
#ifndef __ALSA_INPUT_H
#define __ALSA_INPUT_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -34,6 +34,9 @@
#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
@ -43,9 +46,6 @@
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#endif
#else
#error Header defining endianness not defined
#endif
#include <stdarg.h>
#include <poll.h>
#include <sys/types.h>
@ -69,13 +69,28 @@
#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
@ -167,6 +182,7 @@
#include "pcm.h"
#include "pcm_plugin.h"
#include "rawmidi.h"
#include "ump.h"
#include "timer.h"
#include "hwdep.h"
#include "control.h"
@ -180,7 +196,9 @@
#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
@ -232,10 +250,14 @@ 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);
int safe_strtoll_base(const char *str, long long *val, int base);
#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); }
int safe_strtol_base(const char *str, long *val, int base);
#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);

View File

@ -47,7 +47,7 @@ typedef struct _snd_mixer_elem snd_mixer_elem_t;
/**
* \brief Mixer callback function
* \param mixer Mixer handle
* \param ctl Mixer handle
* \param mask event mask
* \param elem related mixer element (if any)
* \return 0 on success otherwise a negative error code

View File

@ -97,10 +97,10 @@ struct sm_elem_ops {
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 *class, sm_class_basic_t *info);
void *snd_mixer_sbasic_get_private(const snd_mixer_class_t *class);
void snd_mixer_sbasic_set_private(const snd_mixer_class_t *class, void *private_data);
void snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *class, void (*private_free)(snd_mixer_class_t *class));
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));
/** \} */

View File

@ -28,6 +28,8 @@
#ifndef __ALSA_OUTPUT_H
#define __ALSA_OUTPUT_H
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -282,9 +282,17 @@ typedef enum _snd_pcm_format {
/** PCM sample subformat */
typedef enum _snd_pcm_subformat {
/** Unknown */
SND_PCM_SUBFORMAT_UNKNOWN = -1,
/** Standard */
SND_PCM_SUBFORMAT_STD = 0,
SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD
/** Maximum bits based on PCM format */
SND_PCM_SUBFORMAT_MSBITS_MAX = 1,
/** 20 most significant bits */
SND_PCM_SUBFORMAT_MSBITS_20 = 2,
/** 24 most significant bits */
SND_PCM_SUBFORMAT_MSBITS_24 = 3,
SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_MSBITS_24
} snd_pcm_subformat_t;
/** PCM state */
@ -343,6 +351,7 @@ typedef enum _snd_pcm_tstamp {
SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE
} snd_pcm_tstamp_t;
/** PCM timestamp type */
typedef enum _snd_pcm_tstamp_type {
SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /**< gettimeofday equivalent */
SND_PCM_TSTAMP_TYPE_MONOTONIC, /**< posix_clock_monotonic equivalent */
@ -350,6 +359,7 @@ typedef enum _snd_pcm_tstamp_type {
SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
} snd_pcm_tstamp_type_t;
/** PCM audio timestamp type */
typedef enum _snd_pcm_audio_tstamp_type {
/**
* first definition for backwards compatibility only,
@ -364,24 +374,22 @@ typedef enum _snd_pcm_audio_tstamp_type {
SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
} snd_pcm_audio_tstamp_type_t;
/** PCM audio timestamp config */
typedef struct _snd_pcm_audio_tstamp_config {
/* 5 of max 16 bits used */
unsigned int type_requested:4;
unsigned int report_delay:1; /* add total delay to A/D or D/A */
unsigned int type_requested:4; /**< requested audio tstamp type */
unsigned int report_delay:1; /**< add total delay to A/D or D/A */
} snd_pcm_audio_tstamp_config_t;
/** PCM audio timestamp report */
typedef struct _snd_pcm_audio_tstamp_report {
/* 6 of max 16 bits used for bit-fields */
/* for backwards compatibility */
unsigned int valid:1;
unsigned int valid:1; /**< for backwards compatibility */
unsigned int actual_type:4; /**< actual type if hardware could not support requested timestamp */
/* actual type if hardware could not support requested timestamp */
unsigned int actual_type:4;
/* accuracy represented in ns units */
unsigned int accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */
unsigned int accuracy; /* up to 4.29s, will be packed in separate field */
unsigned int accuracy_report:1; /**< 0 if accuracy unknown, 1 if accuracy field is valid */
unsigned int accuracy; /**< up to 4.29s in ns units, will be packed in separate field */
} snd_pcm_audio_tstamp_report_t;
/** Unsigned frames quantity */
@ -393,6 +401,8 @@ typedef long snd_pcm_sframes_t;
#define SND_PCM_NONBLOCK 0x00000001
/** Async notification (flag for open mode) \hideinitializer */
#define SND_PCM_ASYNC 0x00000002
/** Return EINTR instead blocking (wait operation) */
#define SND_PCM_EINTR 0x00000080
/** In an abort state (internal, not allowed for open) */
#define SND_PCM_ABORT 0x00008000
/** Disable automatic (but not forced!) rate resamplinig */
@ -498,6 +508,13 @@ typedef union _snd_pcm_sync_id {
unsigned int id32[4];
} snd_pcm_sync_id_t;
/** Infinite wait for snd_pcm_wait() */
#define SND_PCM_WAIT_INFINITE (-1)
/** Wait for next i/o in snd_pcm_wait() */
#define SND_PCM_WAIT_IO (-10001)
/** Wait for drain in snd_pcm_wait() */
#define SND_PCM_WAIT_DRAIN (-10002)
/** #SND_PCM_TYPE_METER scope handle */
typedef struct _snd_pcm_scope snd_pcm_scope_t;
@ -722,6 +739,7 @@ int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_is_perfect_drain(const snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params); /* deprecated, use audio_ts_type */
int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params, int type);
int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
@ -821,6 +839,8 @@ int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_set_drain_silence(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
int snd_pcm_hw_params_get_drain_silence(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
@ -1080,6 +1100,7 @@ const char *snd_pcm_format_name(const snd_pcm_format_t format);
const char *snd_pcm_format_description(const snd_pcm_format_t format);
const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat);
const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat);
snd_pcm_subformat_t snd_pcm_subformat_value(const char* name);
snd_pcm_format_t snd_pcm_format_value(const char* name);
const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode);
const char *snd_pcm_state_name(const snd_pcm_state_t state);

View File

@ -2,11 +2,14 @@
* Old ALSA 0.9.x API
*/
#define ___symbol_version(name, version) \
__asm__ (".symver " #name "," #name "@" version)
#ifdef ALSA_PCM_OLD_HW_PARAMS_API
asm(".symver snd_pcm_hw_params_get_access,snd_pcm_hw_params_get_access@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_access_first,snd_pcm_hw_params_set_access_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_access_last,snd_pcm_hw_params_set_access_last@ALSA_0.9");
___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);
@ -16,9 +19,9 @@ snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_pa
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);
asm(".symver snd_pcm_hw_params_get_format,snd_pcm_hw_params_get_format@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_format_first,snd_pcm_hw_params_set_format_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_format_last,snd_pcm_hw_params_set_format_last@ALSA_0.9");
___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);
@ -28,9 +31,9 @@ snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_pa
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);
asm(".symver snd_pcm_hw_params_get_subformat,snd_pcm_hw_params_get_subformat@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_subformat_first,snd_pcm_hw_params_set_subformat_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_subformat_last,snd_pcm_hw_params_set_subformat_last@ALSA_0.9");
___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);
@ -40,12 +43,12 @@ snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm
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);
asm(".symver snd_pcm_hw_params_get_channels,snd_pcm_hw_params_get_channels@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_channels_min,snd_pcm_hw_params_get_channels_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_channels_max,snd_pcm_hw_params_get_channels_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_channels_near,snd_pcm_hw_params_set_channels_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_channels_first,snd_pcm_hw_params_set_channels_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_channels_last,snd_pcm_hw_params_set_channels_last@ALSA_0.9");
___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);
@ -59,12 +62,12 @@ unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_para
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);
asm(".symver snd_pcm_hw_params_get_rate,snd_pcm_hw_params_get_rate@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_rate_min,snd_pcm_hw_params_get_rate_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_rate_max,snd_pcm_hw_params_get_rate_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_rate_near,snd_pcm_hw_params_set_rate_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_rate_first,snd_pcm_hw_params_set_rate_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_rate_last,snd_pcm_hw_params_set_rate_last@ALSA_0.9");
___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);
@ -80,12 +83,12 @@ unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t
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);
asm(".symver snd_pcm_hw_params_get_period_time,snd_pcm_hw_params_get_period_time@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_period_time_min,snd_pcm_hw_params_get_period_time_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_period_time_max,snd_pcm_hw_params_get_period_time_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_time_near,snd_pcm_hw_params_set_period_time_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_time_first,snd_pcm_hw_params_set_period_time_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_time_last,snd_pcm_hw_params_set_period_time_last@ALSA_0.9");
___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);
@ -99,12 +102,12 @@ unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_p
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);
asm(".symver snd_pcm_hw_params_get_period_size,snd_pcm_hw_params_get_period_size@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_period_size_min,snd_pcm_hw_params_get_period_size_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_period_size_max,snd_pcm_hw_params_get_period_size_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_size_near,snd_pcm_hw_params_set_period_size_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_size_first,snd_pcm_hw_params_set_period_size_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_period_size_last,snd_pcm_hw_params_set_period_size_last@ALSA_0.9");
___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);
@ -119,12 +122,12 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pc
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);
asm(".symver snd_pcm_hw_params_get_periods,snd_pcm_hw_params_get_periods@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_periods_min,snd_pcm_hw_params_get_periods_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_periods_max,snd_pcm_hw_params_get_periods_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_periods_near,snd_pcm_hw_params_set_periods_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_periods_first,snd_pcm_hw_params_set_periods_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_periods_last,snd_pcm_hw_params_set_periods_last@ALSA_0.9");
___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);
@ -139,12 +142,12 @@ unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_para
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);
asm(".symver snd_pcm_hw_params_get_buffer_time,snd_pcm_hw_params_get_buffer_time@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_buffer_time_min,snd_pcm_hw_params_get_buffer_time_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_buffer_time_max,snd_pcm_hw_params_get_buffer_time_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_time_near,snd_pcm_hw_params_set_buffer_time_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_time_first,snd_pcm_hw_params_set_buffer_time_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_time_last,snd_pcm_hw_params_set_buffer_time_last@ALSA_0.9");
___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);
@ -158,12 +161,12 @@ unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_p
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);
asm(".symver snd_pcm_hw_params_get_buffer_size,snd_pcm_hw_params_get_buffer_size@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_buffer_size_min,snd_pcm_hw_params_get_buffer_size_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_buffer_size_max,snd_pcm_hw_params_get_buffer_size_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_size_near,snd_pcm_hw_params_set_buffer_size_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_size_first,snd_pcm_hw_params_set_buffer_size_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_buffer_size_last,snd_pcm_hw_params_set_buffer_size_last@ALSA_0.9");
___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);
@ -177,12 +180,12 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm
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);
asm(".symver snd_pcm_hw_params_get_tick_time,snd_pcm_hw_params_get_tick_time@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_tick_time_min,snd_pcm_hw_params_get_tick_time_min@ALSA_0.9");
asm(".symver snd_pcm_hw_params_get_tick_time_max,snd_pcm_hw_params_get_tick_time_max@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_tick_time_near,snd_pcm_hw_params_set_tick_time_near@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_tick_time_first,snd_pcm_hw_params_set_tick_time_first@ALSA_0.9");
asm(".symver snd_pcm_hw_params_set_tick_time_last,snd_pcm_hw_params_set_tick_time_last@ALSA_0.9");
___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);
@ -201,14 +204,14 @@ unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_par
#ifdef ALSA_PCM_OLD_SW_PARAMS_API
asm(".symver snd_pcm_sw_params_get_tstamp_mode,snd_pcm_sw_params_get_tstamp_mode@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_sleep_min,snd_pcm_sw_params_get_sleep_min@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_avail_min,snd_pcm_sw_params_get_avail_min@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_xfer_align,snd_pcm_sw_params_get_xfer_align@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_start_threshold,snd_pcm_sw_params_get_start_threshold@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_stop_threshold,snd_pcm_sw_params_get_stop_threshold@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_silence_threshold,snd_pcm_sw_params_get_silence_threshold@ALSA_0.9");
asm(".symver snd_pcm_sw_params_get_silence_size,snd_pcm_sw_params_get_silence_size@ALSA_0.9");
___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);

View File

@ -133,6 +133,19 @@ 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
*/

View File

@ -93,6 +93,9 @@ typedef enum _snd_rawmidi_read_mode {
SND_RAWMIDI_READ_TSTAMP = 1,
} snd_rawmidi_read_mode_t;
/** rawmidi info bit flags */
#define SND_RAWMIDI_INFO_UMP 0x00000008 /* rawmidi is UMP */
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,

View File

@ -130,6 +130,13 @@ typedef enum snd_seq_client_type {
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) \
@ -149,11 +156,22 @@ const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_i
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);
@ -165,6 +183,11 @@ int snd_seq_get_any_client_info(snd_seq_t *handle, int client, snd_seq_client_in
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);
/*
*/
@ -222,6 +245,14 @@ typedef struct _snd_seq_port_info snd_seq_port_info_t;
#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 */
#define SND_SEQ_PORT_DIR_OUTPUT 2 /**< Output only */
#define SND_SEQ_PORT_DIR_BIDIRECTION 3 /**< Input/output bidirectional */
/* port type */
/** Messages sent from/to this port have device-specific semantics. */
@ -238,6 +269,8 @@ typedef struct _snd_seq_port_info snd_seq_port_info_t;
#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)
@ -283,6 +316,8 @@ 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);
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);
@ -297,6 +332,8 @@ 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);
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);
@ -572,6 +609,12 @@ 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);
/** \} */
/**
@ -729,6 +772,10 @@ extern const unsigned int snd_seq_event_types[];
#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

View File

@ -225,6 +225,7 @@ typedef union snd_seq_timestamp {
#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 {
@ -291,6 +292,19 @@ typedef struct snd_seq_ev_queue_control {
} param; /**< data value union */
} snd_seq_ev_queue_control_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_event_data_t;
/** Sequencer event */
typedef struct snd_seq_event {
@ -304,20 +318,24 @@ typedef struct snd_seq_event {
snd_seq_addr_t source; /**< source address */
snd_seq_addr_t dest; /**< destination address */
union {
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 */
} data; /**< event data... */
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;
/** \} */

View File

@ -45,8 +45,21 @@ extern "C" {
*
* This macro clears the given event record pointer to the default status.
*/
#define snd_seq_ev_clear(ev) \
memset(ev, 0, sizeof(snd_seq_event_t))
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
@ -284,6 +297,31 @@ extern "C" {
(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);
@ -343,6 +381,8 @@ int snd_seq_disconnect_to(snd_seq_t *seq, int my_port, int dest_client, int dest
*/
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);

View File

@ -1,9 +1,9 @@
#ifndef __TYPE_COMPAT_H
#define __TYPE_COMPAT_H
#ifndef __SOUND_TYPE_COMPAT_H
#define __SOUND_TYPE_COMPAT_H
#ifndef DOC_HIDDEN
#include <stdint.h>
#ifdef __linux__
#if defined(__linux__)
#include <linux/types.h>
#else
typedef uint8_t __u8;
@ -15,8 +15,14 @@ typedef int16_t __s16;
typedef int32_t __s32;
typedef int64_t __s64;
#include <endian.h>
#include <byteswap.h>
#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)
@ -28,20 +34,12 @@ typedef int64_t __s64;
#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
#define __le64 __u64
#define __le32 __u32
#define __le16 __u16
#define __le8 __u8
#define __be64 __u64
#define __be32 __u32
#define __be16 __u16
#define __be8 __u8
#endif
#ifndef __kernel_long_t
@ -58,4 +56,4 @@ typedef int64_t __s64;
#endif /* DOC_HIDDEN */
#endif /* __TYPE_COMPAT_H */
#endif /* __SOUND_TYPE_COMPAT_H */

View File

@ -26,7 +26,7 @@
#include <sound/asound.h>
/** version of the sequencer */
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 2)
#define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 3)
/**
* definition of sequencer event types
@ -190,6 +190,7 @@ struct snd_seq_connect {
#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 {
@ -268,6 +269,19 @@ struct snd_seq_ev_quote {
struct snd_seq_event *event; /* quoted event */
} __attribute__((packed));
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;
};
/* sequencer event */
struct snd_seq_event {
@ -278,25 +292,27 @@ struct snd_seq_event {
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 { /* 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;
} data;
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
@ -344,10 +360,11 @@ typedef int __bitwise snd_seq_client_type_t;
#define KERNEL_CLIENT ((snd_seq_client_type_t) 2)
/* event filter flags */
#define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */
#define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */
#define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */
#define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */
#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 */
@ -360,9 +377,18 @@ struct snd_seq_client_info {
int event_lost; /* number of lost events */
int card; /* RO: card number[kernel] */
int pid; /* RO: pid[user] */
char reserved[56]; /* for future use */
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 {
@ -422,6 +448,8 @@ struct snd_seq_remove_events {
#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 */
@ -431,6 +459,7 @@ struct snd_seq_remove_events {
#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) */
@ -448,6 +477,12 @@ struct snd_seq_remove_events {
#define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)
#define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)
/* 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 */
@ -464,7 +499,9 @@ struct snd_seq_port_info {
void *kernel; /* reserved for kernel use (must be NULL) */
unsigned int flags; /* misc. conditioning */
unsigned char time_queue; /* queue # for timestamping */
char reserved[59]; /* for future use */
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 */
};
@ -568,6 +605,18 @@ struct snd_seq_query_subs {
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) */
} __packed;
/*
* IOCTL commands
@ -577,9 +626,12 @@ struct snd_seq_query_subs {
#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)

View File

@ -16,7 +16,9 @@
#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.

View File

@ -28,7 +28,7 @@
#include <linux/types.h>
#include <asm/byteorder.h>
#else
#include <endian.h>
#include <sys/endian.h>
#include <sys/ioctl.h>
#endif
@ -274,13 +274,17 @@ typedef int __bitwise snd_pcm_format_t;
typedef int __bitwise snd_pcm_subformat_t;
#define SNDRV_PCM_SUBFORMAT_STD ((snd_pcm_subformat_t) 0)
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD
#define SNDRV_PCM_SUBFORMAT_MSBITS_MAX ((snd_pcm_subformat_t) 1)
#define SNDRV_PCM_SUBFORMAT_MSBITS_20 ((snd_pcm_subformat_t) 2)
#define SNDRV_PCM_SUBFORMAT_MSBITS_24 ((snd_pcm_subformat_t) 3)
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_MSBITS_24
#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
#define SNDRV_PCM_INFO_SYNC_APPLPTR 0x00000020 /* need the explicit sync of appl_ptr update */
#define SNDRV_PCM_INFO_PERFECT_DRAIN 0x00000040 /* silencing at the end of stream is not required */
#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
@ -389,6 +393,9 @@ typedef int snd_pcm_hw_param_t;
#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */
#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */
#define SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE (1<<3) /* suppress the silence fill
* for draining
*/
struct snd_interval {
unsigned int min, max;
@ -702,7 +709,7 @@ enum {
* Raw MIDI section - /dev/snd/midi??
*/
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 2)
#define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)
enum {
SNDRV_RAWMIDI_STREAM_OUTPUT = 0,
@ -713,6 +720,7 @@ enum {
#define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001
#define SNDRV_RAWMIDI_INFO_INPUT 0x00000002
#define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004
#define SNDRV_RAWMIDI_INFO_UMP 0x00000008
struct snd_rawmidi_info {
unsigned int device; /* RO/WR (control): device number */
@ -771,6 +779,72 @@ struct snd_rawmidi_status {
unsigned char reserved[16]; /* reserved for future use */
};
/* UMP EP info flags */
#define SNDRV_UMP_EP_INFO_STATIC_BLOCKS 0x01
/* UMP EP Protocol / JRTS capability bits */
#define SNDRV_UMP_EP_INFO_PROTO_MIDI_MASK 0x0300
#define SNDRV_UMP_EP_INFO_PROTO_MIDI1 0x0100 /* MIDI 1.0 */
#define SNDRV_UMP_EP_INFO_PROTO_MIDI2 0x0200 /* MIDI 2.0 */
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_MASK 0x0003
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_TX 0x0001 /* JRTS Transmit */
#define SNDRV_UMP_EP_INFO_PROTO_JRTS_RX 0x0002 /* JRTS Receive */
/* UMP Endpoint information */
struct snd_ump_endpoint_info {
int card; /* card number */
int device; /* device number */
unsigned int flags; /* additional info */
unsigned int protocol_caps; /* protocol capabilities */
unsigned int protocol; /* current protocol */
unsigned int num_blocks; /* # of function blocks */
unsigned short version; /* UMP major/minor version */
unsigned short family_id; /* MIDI device family ID */
unsigned short model_id; /* MIDI family model ID */
unsigned int manufacturer_id; /* MIDI manufacturer ID */
unsigned char sw_revision[4]; /* software revision */
unsigned short padding;
unsigned char name[128]; /* endpoint name string */
unsigned char product_id[128]; /* unique product id string */
unsigned char reserved[32];
} __packed;
/* UMP direction */
#define SNDRV_UMP_DIR_INPUT 0x01
#define SNDRV_UMP_DIR_OUTPUT 0x02
#define SNDRV_UMP_DIR_BIDIRECTION 0x03
/* UMP block info flags */
#define SNDRV_UMP_BLOCK_IS_MIDI1 (1U << 0) /* MIDI 1.0 port w/o restrict */
#define SNDRV_UMP_BLOCK_IS_LOWSPEED (1U << 1) /* 31.25Kbps B/W MIDI1 port */
/* UMP block user-interface hint */
#define SNDRV_UMP_BLOCK_UI_HINT_UNKNOWN 0x00
#define SNDRV_UMP_BLOCK_UI_HINT_RECEIVER 0x01
#define SNDRV_UMP_BLOCK_UI_HINT_SENDER 0x02
#define SNDRV_UMP_BLOCK_UI_HINT_BOTH 0x03
/* UMP groups and blocks */
#define SNDRV_UMP_MAX_GROUPS 16
#define SNDRV_UMP_MAX_BLOCKS 32
/* UMP Block information */
struct snd_ump_block_info {
int card; /* card number */
int device; /* device number */
unsigned char block_id; /* block ID (R/W) */
unsigned char direction; /* UMP direction */
unsigned char active; /* Activeness */
unsigned char first_group; /* first group ID */
unsigned char num_groups; /* number of groups */
unsigned char midi_ci_version; /* MIDI-CI support version */
unsigned char sysex8_streams; /* max number of sysex8 streams */
unsigned char ui_hint; /* user interface hint */
unsigned int flags; /* various info flags */
unsigned char name[128]; /* block name string */
unsigned char reserved[32];
} __packed;
#define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int)
#define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info)
#define SNDRV_RAWMIDI_IOCTL_USER_PVERSION _IOW('W', 0x02, int)
@ -778,6 +852,9 @@ struct snd_rawmidi_status {
#define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status)
#define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int)
#define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int)
/* Additional ioctls for UMP rawmidi devices */
#define SNDRV_UMP_IOCTL_ENDPOINT_INFO _IOR('W', 0x40, struct snd_ump_endpoint_info)
#define SNDRV_UMP_IOCTL_BLOCK_INFO _IOR('W', 0x41, struct snd_ump_block_info)
/*
* Timer section - /dev/snd/timer
@ -949,7 +1026,7 @@ struct snd_timer_tread {
* *
****************************************************************************/
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 8)
#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)
struct snd_ctl_card_info {
int card; /* card number */
@ -1110,6 +1187,9 @@ struct snd_ctl_tlv {
#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
#define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info)
#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
#define SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE _IOWR('U', 0x43, int)
#define SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO _IOWR('U', 0x44, struct snd_ump_endpoint_info)
#define SNDRV_CTL_IOCTL_UMP_BLOCK_INFO _IOWR('U', 0x45, struct snd_ump_block_info)
#define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int)
#define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int)

View File

@ -219,7 +219,7 @@ extern "C" {
*
* <pre>
* SectionData."data element name" {
* index "1" #Index number
* index "1" # Index number
* tuples [
* "id of the 1st vendor tuples section"
* "id of the 2nd vendor tuples section"
@ -254,8 +254,6 @@ extern "C" {
* And data of these sections will be merged in the same order as they are
* in the list, as the element's private data for kernel.
*
* </pre>
*
* <h6>Vendor Tokens</h6>
* A vendor token list is defined as a new section. Each token element is
* a pair of string ID and integer value. And both the ID and value are
@ -419,7 +417,7 @@ extern "C" {
* Values [
* "value1"
* "value2"
"value3"
* "value3"
* ]
* }
* </pre>
@ -504,7 +502,7 @@ extern "C" {
* no_pm "true" # No PM control bit.
* reg "20" # PM bit register offset
* shift "0" # PM bit register shift
* invert "1 # PM bit is inverted
* invert "1" # PM bit is inverted
* subseq "8" # subsequence number
*
* event_type "1" # DAPM widget event type
@ -639,7 +637,7 @@ extern "C" {
* ...
* ]
*
* default_hw_conf_id "1" #default HW config ID for init
* default_hw_conf_id "1" # default HW config ID for init
*
* # Optional boolean flags
* symmetric_rates "true"
@ -842,7 +840,7 @@ struct snd_tplg_tlv_dbscale_template {
int mute; /*!< is min dB value mute ? */
};
/** \struct snd_tplg_channel_template
/** \struct snd_tplg_channel_elem
* \brief Template type for single channel mapping.
*/
struct snd_tplg_channel_elem {
@ -1023,26 +1021,26 @@ struct snd_tplg_pcm_template {
* hardware config, i.e. hardware audio formats.
*/
struct snd_tplg_hw_config_template {
int id; /* unique ID - - used to match */
unsigned int fmt; /* SND_SOC_DAI_FORMAT_ format value */
unsigned char clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */
unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */
unsigned char bclk_provider; /* SND_SOC_TPLG_BCLK_ value */
unsigned char fsync_provider; /* SND_SOC_TPLG_FSYNC_ value */
unsigned char mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
unsigned short reserved; /* for 32bit alignment */
unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */
unsigned int bclk_rate; /* BCLK freqency in Hz */
unsigned int fsync_rate; /* frame clock in Hz */
unsigned int tdm_slots; /* number of TDM slots in use */
unsigned int tdm_slot_width; /* width in bits for each slot */
unsigned int tx_slots; /* bit mask for active Tx slots */
unsigned int rx_slots; /* bit mask for active Rx slots */
unsigned int tx_channels; /* number of Tx channels */
unsigned int *tx_chanmap; /* array of slot number */
unsigned int rx_channels; /* number of Rx channels */
unsigned int *rx_chanmap; /* array of slot number */
int id; /*!< unique ID - - used to match */
unsigned int fmt; /*!< SND_SOC_DAI_FORMAT_ format value */
unsigned char clock_gated; /*!< SND_SOC_TPLG_DAI_CLK_GATE_ value */
unsigned char invert_bclk; /*!< 1 for inverted BCLK, 0 for normal */
unsigned char invert_fsync; /*!< 1 for inverted frame clock, 0 for normal */
unsigned char bclk_provider; /*!< SND_SOC_TPLG_BCLK_ value */
unsigned char fsync_provider; /*!< SND_SOC_TPLG_FSYNC_ value */
unsigned char mclk_direction; /*!< SND_SOC_TPLG_MCLK_ value */
unsigned short reserved; /*!< for 32bit alignment */
unsigned int mclk_rate; /*!< MCLK or SYSCLK freqency in Hz */
unsigned int bclk_rate; /*!< BCLK freqency in Hz */
unsigned int fsync_rate; /*!< frame clock in Hz */
unsigned int tdm_slots; /*!< number of TDM slots in use */
unsigned int tdm_slot_width; /*!< width in bits for each slot */
unsigned int tx_slots; /*!< bit mask for active Tx slots */
unsigned int rx_slots; /*!< bit mask for active Rx slots */
unsigned int tx_channels; /*!< number of Tx channels */
unsigned int *tx_chanmap; /*!< array of slot number */
unsigned int rx_channels; /*!< number of Rx channels */
unsigned int *rx_chanmap; /*!< array of slot number */
};
/** \struct snd_tplg_dai_template
@ -1073,15 +1071,15 @@ struct snd_tplg_link_template {
struct snd_tplg_stream_template *stream; /*!< supported configs */
struct snd_tplg_hw_config_template *hw_config; /*!< supported HW configs */
int num_hw_configs; /* number of hw configs */
int default_hw_config_id; /* default hw config ID for init */
int num_hw_configs; /*!< number of hw configs */
int default_hw_config_id; /*!< default hw config ID for init */
unsigned int flag_mask; /* bitmask of flags to configure */
unsigned int flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
unsigned int flag_mask; /*!< bitmask of flags to configure */
unsigned int flags; /*!< SND_SOC_TPLG_LNK_FLGBIT_* flag value */
struct snd_soc_tplg_private *priv; /*!< private data */
};
/** \struct snd_tplg_obj_template
/** \struct snd_tplg_obj_template_t
* \brief Generic Template Object
*/
typedef struct snd_tplg_obj_template {
@ -1154,7 +1152,13 @@ int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
* \brief Save the topology to the text configuration string.
* \param tplg Topology instance.
* \param dst A pointer to string with result (malloc).
* \param flags save mode
* \return Zero on success, otherwise a negative error code
*
* Valid flags are
* - SND_TPLG_SAVE_SORT
* - SND_TPLG_SAVE_GROUPS
* - SND_TPLG_SAVE_NOCHECK
*/
int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags);
@ -1163,11 +1167,12 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags);
* \param tplg Topology instance.
* \param bin Binary topology input buffer.
* \param size Binary topology input buffer size.
* \param dflags - not used, must be set to 0.
* \return Zero on success, otherwise a negative error code
*/
int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags);
/* \} */
/** \} */
#ifdef __cplusplus
}

View File

@ -26,7 +26,7 @@
#define EBADFD EBADF
#endif
#ifndef ESTRPIPE
#define ESTRPIPE EPIPE
#define ESTRPIPE ESPIPE
#endif
#ifndef __u16

141
include/ump.h Normal file
View File

@ -0,0 +1,141 @@
/* 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
*/
#ifndef __ALSA_UMP_H
#define __ALSA_UMP_H
#ifdef __cplusplus
extern "C" {
#endif
/** 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
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_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);
/** 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,
};
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_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);
void snd_ump_block_info_set_block_id(snd_ump_block_info_t *info, unsigned int id);
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);
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_UMP_H */

665
include/ump_msg.h Normal file
View File

@ -0,0 +1,665 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
/**
* \file include/ump_msg.h
* \brief API library for ALSA rawmidi/UMP interface
*
* API library for ALSA rawmidi/UMP interface
*/
#ifndef __ALSA_UMP_MSG_H
#define __ALSA_UMP_MSG_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/** general UMP packet header in 32bit word */
typedef struct _snd_ump_msg_hdr {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t byte1; /**< First data byte */
uint8_t byte2; /**< Second data byte */
#else
uint8_t byte2; /**< Second data byte */
uint8_t byte1; /**< First data byte */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
#endif
} __attribute((packed)) snd_ump_msg_hdr_t;
/** MIDI 1.0 Note Off / Note On (32bit) */
typedef struct _snd_ump_msg_midi1_note {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t note; /**< Note (7bit) */
uint8_t velocity; /**< Velocity (7bit) */
#else
uint8_t velocity; /**< Velocity (7bit) */
uint8_t note; /**< Note (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
#endif
} __attribute((packed)) snd_ump_msg_midi1_note_t;
/** MIDI 1.0 Poly Pressure (32bit) */
typedef struct _snd_ump_msg_midi1_paf {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t note; /** Note (7bit) */
uint8_t data; /** Pressure (7bit) */
#else
uint8_t data; /** Pressure (7bit) */
uint8_t note; /** Note (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
#endif
} __attribute((packed)) snd_ump_msg_midi1_paf_t;
/** MIDI 1.0 Control Change (32bit) */
typedef struct _snd_ump_msg_midi1_cc {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t index; /** Control index (7bit) */
uint8_t data; /** Control data (7bit) */
#else
uint8_t data; /** Control data (7bit) */
uint8_t index; /** Control index (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
#endif
} __attribute((packed)) snd_ump_msg_midi1_cc_t;
/** MIDI 1.0 Program Change (32bit) */
typedef struct _snd_ump_msg_midi1_program {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t program; /**< Program number (7bit) */
uint8_t reserved; /**< Unused */
#else
uint8_t reserved; /**< Unused */
uint8_t program; /**< Program number (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
#endif
} __attribute((packed)) snd_ump_msg_midi1_program_t;
/** MIDI 1.0 Channel Pressure (32bit) */
typedef struct _snd_ump_msg_midi1_caf {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t data; /**< Pressure (7bit) */
uint8_t reserved; /**< Unused */
#else
uint8_t reserved; /**< Unused */
uint8_t data; /**< Pressure (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
#endif
} __attribute((packed)) snd_ump_msg_midi1_caf_t;
/** MIDI 1.0 Pitch Bend (32bit) */
typedef struct _snd_ump_msg_midi1_pitchbend {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t data_lsb; /**< LSB of pitchbend (7bit) */
uint8_t data_msb; /**< MSB of pitchbend (7bit) */
#else
uint8_t data_msb; /**< MSB of pitchbend (7bit) */
uint8_t data_lsb; /**< LSB of pitchbend (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
#endif
} __attribute((packed)) snd_ump_msg_midi1_pitchbend_t;
/** System Common and Real Time messages (32bit); no channel field */
typedef struct snd_ump_msg_system {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status; /**< Status */
uint8_t parm1; /**< First parameter */
uint8_t parm2; /**< Second parameter */
#else
uint8_t parm1; /**< First parameter */
uint8_t parm2; /**< Second parameter */
uint8_t status; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
#endif
} __attribute((packed)) snd_ump_msg_system_t;
/** MIDI 1.0 UMP CVM (32bit) */
typedef union _snd_ump_msg_midi1 {
snd_ump_msg_midi1_note_t note_on;
snd_ump_msg_midi1_note_t note_off;
snd_ump_msg_midi1_paf_t poly_pressure;
snd_ump_msg_midi1_cc_t control_change;
snd_ump_msg_midi1_program_t program_change;
snd_ump_msg_midi1_caf_t channel_pressure;
snd_ump_msg_midi1_pitchbend_t pitchbend;
snd_ump_msg_system_t system;
snd_ump_msg_hdr_t hdr;
uint32_t raw;
} snd_ump_msg_midi1_t;
/** MIDI 2.0 Note-on/off attribute type */
enum {
SND_UMP_MIDI2_NOTE_ATTR_NO_DATA = 0x00, /**< No attribute data */
SND_UMP_MIDI2_NOTE_ATTR_MANUFACTURER = 0x01, /**< Manufacturer specific */
SND_UMP_MIDI2_NOTE_ATTR_PROFILE = 0x02, /**< Profile specific */
SND_UMP_MIDI2_NOTE_ATTR_PITCH79 = 0x03, /**< Pitch 7.9 */
};
/* MIDI 2.0 Note Off / Note On (64bit) */
typedef struct _snd_ump_msg_midi2_note {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t note; /**< Note (7bit) */
uint8_t attr_type; /**< Attribute type */
uint16_t velocity; /**< Velocity (16bit) */
uint16_t attr_data; /**< Attribute data (16bit) */
#else
uint8_t attr_type; /**< Attribute type */
uint8_t note; /**< Note (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint16_t attr_data; /**< Attribute data (16bit) */
uint16_t velocity; /**< Velocity (16bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_note_t;
/** MIDI 2.0 Poly Pressure (64bit) */
typedef struct _snd_ump_msg_midi2_paf {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t note; /**< Note (7bit) */
uint8_t reserved; /**< Unused */
uint32_t data; /**< Pressure (32bit) */
#else
uint8_t reserved; /**< Unused */
uint8_t note; /**< Note (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint32_t data; /**< Pressure (32bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_paf_t;
/** MIDI 2.0 Per-Note Controller (64bit) */
typedef struct _snd_ump_msg_midi2_per_note_cc {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t note; /**< Note (7bit) */
uint8_t index; /**< Control index (8bit) */
uint32_t data; /**< Data (32bit) */
#else
uint8_t index; /**< Control index (8bit) */
uint8_t note; /**< Note (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint32_t data; /**< Data (32bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_per_note_cc_t;
/** MIDI 2.0 per-note management flag bits */
enum {
SND_UMP_MIDI2_PNMGMT_RESET_CONTROLLERS = 0x01, /**< Reset (set) per-note controllers */
SND_UMP_MIDI2_PNMGMT_DETACH_CONTROLLERS = 0x02, /**< Detach per-note controllers */
};
/** MIDI 2.0 Per-Note Management (64bit) */
typedef struct _snd_ump_msg_midi2_per_note_mgmt {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t note; /**< Note (7bit) */
uint8_t flags; /**< Option flags (8bit) */
uint32_t reserved; /**< Unused */
#else
uint8_t flags; /**< Option flags (8bit) */
uint8_t note; /**< Note (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint32_t reserved; /**< Unused */
#endif
} __attribute((packed)) snd_ump_msg_midi2_per_note_mgmt_t;
/** MIDI 2.0 Control Change (64bit) */
typedef struct _snd_ump_msg_midi2_cc {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t index; /**< Control index (7bit) */
uint8_t reserved; /**< Unused */
uint32_t data; /**< Control data (32bit) */
#else
uint8_t reserved; /**< Unused */
uint8_t index; /**< Control index (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint32_t data; /**< Control data (32bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_cc_t;
/** MIDI 2.0 Registered Controller (RPN) / Assignable Controller (NRPN) (64bit) */
typedef struct _snd_ump_msg_midi2_rpn {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t bank; /**< Bank number (7bit) */
uint8_t index; /**< Control index (7bit) */
uint32_t data; /**< Data (32bit) */
#else
uint8_t index; /**< Control index (7bit) */
uint8_t bank; /**< Bank number (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint32_t data; /**< Data (32bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_rpn_t;
/** MIDI 2.0 Program Change (64bit) */
typedef struct _snd_ump_msg_midi2_program {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint16_t reserved:15; /**< Unused */
uint16_t bank_valid:1; /**< Option flag: bank valid */
uint8_t program; /**< Program number (7bit) */
uint8_t reserved2; /**< Unused */
uint8_t bank_msb; /**< MSB of bank (8bit) */
uint8_t bank_lsb; /**< LSB of bank (7bit) */
#else
uint16_t bank_valid:1; /**< Option flag: bank valid */
uint16_t reserved:15; /**< Unused */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint8_t bank_lsb; /**< LSB of bank (7bit) */
uint8_t bank_msb; /**< MSB of bank (8bit) */
uint8_t reserved2; /**< Unused */
uint8_t program; /**< Program number (7bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_program_t;
/** MIDI 2.0 Channel Pressure (64bit) */
typedef struct _snd_ump_msg_midi2_caf {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint16_t reserved; /**< Unused */
uint32_t data; /** Data (32bit) */
#else
uint16_t reserved; /**< Unused */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint32_t data; /** Data (32bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_caf_t;
/* MIDI 2.0 Pitch Bend (64bit) */
typedef struct _snd_ump_msg_midi2_pitchbend {
#ifdef SNDRV_BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint16_t reserved; /**< Unused */
uint32_t data; /** Data (32bit) */
#else
uint16_t reserved; /**< Unused */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint32_t data; /** Data (32bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_pitchbend_t;
/* MIDI 2.0 Per-Note Pitch Bend (64bit) */
typedef struct _snd_ump_msg_midi2_per_note_pitchbend {
#ifdef __BIG_ENDIAN_BITFIELD
uint8_t type:4; /**< UMP packet type */
uint8_t group:4; /**< UMP Group */
uint8_t status:4; /**< Status */
uint8_t channel:4; /**< Channel */
uint8_t note; /**< Note (7bit) */
uint8_t reserved; /**< Unused */
uint32_t data; /**< Data (32bit) */
#else
/* 0 */
uint8_t reserved; /**< Unused */
uint8_t note; /**< Note (7bit) */
uint8_t channel:4; /**< Channel */
uint8_t status:4; /**< Status */
uint8_t group:4; /**< UMP Group */
uint8_t type:4; /**< UMP packet type */
uint32_t data; /**< Data (32bit) */
#endif
} __attribute((packed)) snd_ump_msg_midi2_per_note_pitchbend_t;
/** MIDI2 UMP packet (64bit little-endian) */
typedef union _snd_ump_msg_midi2 {
snd_ump_msg_midi2_note_t note_on;
snd_ump_msg_midi2_note_t note_off;
snd_ump_msg_midi2_paf_t poly_pressure;
snd_ump_msg_midi2_per_note_cc_t per_note_acc;
snd_ump_msg_midi2_per_note_cc_t per_note_rcc;
snd_ump_msg_midi2_per_note_mgmt_t per_note_mgmt;
snd_ump_msg_midi2_cc_t control_change;
snd_ump_msg_midi2_rpn_t rpn;
snd_ump_msg_midi2_rpn_t nrpn;
snd_ump_msg_midi2_rpn_t relative_rpn;
snd_ump_msg_midi2_rpn_t relative_nrpn;
snd_ump_msg_midi2_program_t program_change;
snd_ump_msg_midi2_caf_t channel_pressure;
snd_ump_msg_midi2_pitchbend_t pitchbend;
snd_ump_msg_midi2_per_note_pitchbend_t per_note_pitchbend;
snd_ump_msg_hdr_t hdr;
uint32_t raw[2];
} snd_ump_msg_midi2_t;
/**
* UMP message type
*/
enum {
SND_UMP_MSG_TYPE_UTILITY = 0x00, /* Utility messages */
SND_UMP_MSG_TYPE_SYSTEM = 0x01, /* System messages */
SND_UMP_MSG_TYPE_MIDI1_CHANNEL_VOICE = 0x02, /* MIDI 1.0 messages */
SND_UMP_MSG_TYPE_DATA = 0x03, /* 7bit SysEx messages */
SND_UMP_MSG_TYPE_MIDI2_CHANNEL_VOICE = 0x04, /* MIDI 2.0 messages */
SND_UMP_MSG_TYPE_EXTENDED_DATA = 0x05, /* 8bit data message */
SND_UMP_MSG_TYPE_FLEX_DATA = 0x0d, /* Flexible data messages */
SND_UMP_MSG_TYPE_STREAM = 0x0f, /* Stream messages */
};
/**
* UMP MIDI 1.0 / 2.0 message status code (4bit)
*/
enum {
SND_UMP_MSG_PER_NOTE_RCC = 0x0,
SND_UMP_MSG_PER_NOTE_ACC = 0x1,
SND_UMP_MSG_RPN = 0x2,
SND_UMP_MSG_NRPN = 0x3,
SND_UMP_MSG_RELATIVE_RPN = 0x4,
SND_UMP_MSG_RELATIVE_NRPN = 0x5,
SND_UMP_MSG_PER_NOTE_PITCHBEND = 0x6,
SND_UMP_MSG_NOTE_OFF = 0x8,
SND_UMP_MSG_NOTE_ON = 0x9,
SND_UMP_MSG_POLY_PRESSURE = 0xa,
SND_UMP_MSG_CONTROL_CHANGE = 0xb,
SND_UMP_MSG_PROGRAM_CHANGE = 0xc,
SND_UMP_MSG_CHANNEL_PRESSURE = 0xd,
SND_UMP_MSG_PITCHBEND = 0xe,
SND_UMP_MSG_PER_NOTE_MGMT = 0xf,
};
/**
* MIDI System / Realtime message status code (8bit)
*/
enum {
SND_UMP_MSG_REALTIME = 0xf0, /* mask */
SND_UMP_MSG_SYSEX_START = 0xf0,
SND_UMP_MSG_MIDI_TIME_CODE = 0xf1,
SND_UMP_MSG_SONG_POSITION = 0xf2,
SND_UMP_MSG_SONG_SELECT = 0xf3,
SND_UMP_MSG_TUNE_REQUEST = 0xf6,
SND_UMP_MSG_SYSEX_END = 0xf7,
SND_UMP_MSG_TIMING_CLOCK = 0xf8,
SND_UMP_MSG_START = 0xfa,
SND_UMP_MSG_CONTINUE = 0xfb,
SND_UMP_MSG_STOP = 0xfc,
SND_UMP_MSG_ACTIVE_SENSING = 0xfe,
SND_UMP_MSG_RESET = 0xff,
};
/** MIDI 2.0 SysEx / Data Status; same values for both 7-bit and 8-bit SysEx */
enum {
SND_UMP_SYSEX_STATUS_SINGLE = 0,
SND_UMP_SYSEX_STATUS_START = 1,
SND_UMP_SYSEX_STATUS_CONTINUE = 2,
SND_UMP_SYSEX_STATUS_END = 3,
};
/** UMP Utility Type Status (type 0x0) **/
enum {
SND_UMP_UTILITY_MSG_STATUS_NOOP = 0x00,
SND_UMP_UTILITY_MSG_STATUS_JR_CLOCK = 0x01,
SND_UMP_UTILITY_MSG_STATUS_JR_TSTAMP = 0x02,
SND_UMP_UTILITY_MSG_STATUS_DCTPQ = 0x03,
SND_UMP_UTILITY_MSG_STATUS_DC = 0x04,
};
/** UMP Stream Message Status (type 0xf) */
enum {
SND_UMP_STREAM_MSG_STATUS_EP_DISCOVERY = 0x00,
SND_UMP_STREAM_MSG_STATUS_EP_INFO = 0x01,
SND_UMP_STREAM_MSG_STATUS_DEVICE_INFO = 0x02,
SND_UMP_STREAM_MSG_STATUS_EP_NAME = 0x03,
SND_UMP_STREAM_MSG_STATUS_PRODUCT_ID = 0x04,
SND_UMP_STREAM_MSG_STATUS_STREAM_CFG_REQUEST = 0x05,
SND_UMP_STREAM_MSG_STATUS_STREAM_CFG = 0x06,
SND_UMP_STREAM_MSG_STATUS_FB_DISCOVERY = 0x10,
SND_UMP_STREAM_MSG_STATUS_FB_INFO = 0x11,
SND_UMP_STREAM_MSG_STATUS_FB_NAME = 0x12,
SND_UMP_STREAM_MSG_STATUS_START_CLIP = 0x20,
SND_UMP_STREAM_MSG_STATUS_END_CLIP = 0x21,
};
/** UMP Endpoint Discovery filter bitmap */
enum {
SND_UMP_STREAM_MSG_REQUEST_EP_INFO = (1U << 0),
SND_UMP_STREAM_MSG_REQUEST_DEVICE_INFO = (1U << 1),
SND_UMP_STREAM_MSG_REQUEST_EP_NAME = (1U << 2),
SND_UMP_STREAM_MSG_REQUEST_PRODUCT_ID = (1U << 3),
SND_UMP_STREAM_MSG_REQUEST_STREAM_CFG = (1U << 4),
};
/** UMP Function Block Discovery filter bitmap */
enum {
SND_UMP_STREAM_MSG_REQUEST_FB_INFO = (1U << 0),
SND_UMP_STREAM_MSG_REQUEST_FB_NAME = (1U << 1),
};
/** UMP Endpoint Info capability bits (used for protocol request/notify, too) */
enum {
SND_UMP_STREAM_MSG_EP_INFO_CAP_TXJR = (1U << 0), /* Sending JRTS */
SND_UMP_STREAM_MSG_EP_INFO_CAP_RXJR = (1U << 1), /* Receiving JRTS */
SND_UMP_STREAM_MSG_EP_INFO_CAP_MIDI1 = (1U << 8), /* MIDI 1.0 */
SND_UMP_STREAM_MSG_EP_INFO_CAP_MIDI2 = (1U << 9), /* MIDI 2.0 */
};
/** UMP Endpoint / Function Block name string format bits */
enum {
SND_UMP_STREAM_MSG_FORMAT_SINGLE = 0,
SND_UMP_STREAM_MSG_FORMAT_START = 1,
SND_UMP_STREAM_MSG_FORMAT_CONTINUE = 2,
SND_UMP_STREAM_MSG_FORMAT_END = 3,
};
/**
* \brief get UMP status (4bit) from 32bit UMP message header
*/
static inline uint8_t snd_ump_msg_hdr_status(uint32_t ump)
{
return (ump >> 20) & 0x0f;
}
/**
* \brief get UMP channel (4bit) from 32bit UMP message header
*/
static inline uint8_t snd_ump_msg_hdr_channel(uint32_t ump)
{
return (ump >> 16) & 0x0f;
}
/**
* \brief get UMP message type (4bit) from 32bit UMP message header
*/
static inline uint8_t snd_ump_msg_hdr_type(uint32_t ump)
{
return (ump >> 28);
}
/**
* \brief check if the given UMP type is a groupless message
*/
static inline int snd_ump_msg_type_is_groupless(uint8_t type)
{
return type == SND_UMP_MSG_TYPE_UTILITY || type == SND_UMP_MSG_TYPE_STREAM;
}
/**
* \brief get UMP group (4bit) from 32bit UMP message header
*/
static inline uint8_t snd_ump_msg_hdr_group(uint32_t ump)
{
return (ump >> 24) & 0x0f;
}
/**
* \brief get UMP status from UMP packet pointer
*/
static inline uint8_t snd_ump_msg_status(const uint32_t *ump)
{
return snd_ump_msg_hdr_status(*ump);
}
/**
* \brief get UMP channel from UMP packet pointer
*/
static inline uint8_t snd_ump_msg_channel(const uint32_t *ump)
{
return snd_ump_msg_hdr_channel(*ump);
}
/**
* \brief get UMP message type from UMP packet pointer
*/
static inline uint8_t snd_ump_msg_type(const uint32_t *ump)
{
return snd_ump_msg_hdr_type(*ump);
}
/**
* \brief get UMP group from UMP packet pointer
*/
static inline uint8_t snd_ump_msg_group(const uint32_t *ump)
{
return snd_ump_msg_hdr_group(*ump);
}
/**
* \brief get UMP sysex message status
*/
static inline uint8_t snd_ump_sysex_msg_status(const uint32_t *ump)
{
return (*ump >> 20) & 0xf;
}
/**
* \brief get UMP sysex message length
*/
static inline uint8_t snd_ump_sysex_msg_length(const uint32_t *ump)
{
return (*ump >> 16) & 0xf;
}
int snd_ump_msg_sysex_expand(const uint32_t *ump, uint8_t *buf, size_t maxlen,
size_t *filled);
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_UMP_MSG_H */

View File

@ -141,6 +141,7 @@ extern "C" {
#define SND_USE_CASE_DEV_SPDIF "SPDIF" /**< SPDIF Device */
#define SND_USE_CASE_DEV_HDMI "HDMI" /**< HDMI 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 */
@ -314,38 +315,50 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* - 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()
* - 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()
* - 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()
* - 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()
* - 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()
* - 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()
* - can be parsed using #snd_use_case_parse_selem_id()
* - PlaybackMasterType
* - type of the master volume control
* - Valid values: "soft" (software attenuation)
@ -353,13 +366,16 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* - name of capture mixer
* - CaptureMixerElem
* - mixer element capture identifier
* - can be parsed using snd_use_case_parse_selem_id()
* - 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()
* - 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
@ -389,9 +405,9 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* 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.
* - 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,
@ -420,24 +436,24 @@ int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
* \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
* - _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
* - 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,
@ -518,7 +534,7 @@ static __inline__ int snd_use_case_verb_list(snd_use_case_mgr_t *uc_mgr,
/**
* \brief Parse control element identifier
* \param elem_id 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

View File

@ -1,34 +1,14 @@
/*
* ALSA lib header file include/version.h
* Copyright (c) 2022 Huawei Device Co., Ltd.
*
* 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
*
* version.h
*/
#ifndef __ALSA_VERSION_H
#define __ALSA_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 6 /**< subminor number of library version */
#define SND_LIB_SUBMINOR 11 /**< 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.6"
#define SND_LIB_VERSION_STR "1.2.11"
#endif /* __ALSA_VERSION_H */

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
])

View File

@ -775,8 +775,8 @@ pymixer_melement_new(struct pymixer *pymixer, PyObject *args)
obj = PyDict_GetItemString(pymixer->mdict, class);
if (obj) {
obj1 = PyTuple_New(4);
if (PyTuple_SET_ITEM(obj1, 0, (PyObject *)pymixer))
Py_INCREF((PyObject *)pymixer);
PyTuple_SET_ITEM(obj1, 0, (PyObject *)pymixer);
Py_INCREF((PyObject *)pymixer);
PyTuple_SET_ITEM(obj1, 1, PyUnicode_FromString(name));
PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong(index));
PyTuple_SET_ITEM(obj1, 3, PyInt_FromLong(weight));
@ -920,8 +920,8 @@ static PyObject *new_helem(struct python_priv *priv, snd_hctl_elem_t *helem)
obj = PyDict_GetItemString(priv->py_mdict, "HElement");
if (obj) {
obj1 = PyTuple_New(3);
if (PyTuple_SET_ITEM(obj1, 0, py_hctl))
Py_INCREF(py_hctl);
PyTuple_SET_ITEM(obj1, 0, py_hctl);
Py_INCREF(py_hctl);
PyTuple_SET_ITEM(obj1, 1, PyFloat_FromDouble(1));
PyTuple_SET_ITEM(obj1, 2, PyInt_FromLong((long)helem));
obj2 = PyObject_CallObject(obj, obj1);
@ -995,11 +995,11 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
}
if (o == NULL)
return 0;
if (PyTuple_SET_ITEM(t, 1, o))
Py_INCREF(o);
PyTuple_SET_ITEM(t, 1, o);
Py_INCREF(o);
o = melem ? find_melem(priv, melem) : Py_None;
if (PyTuple_SET_ITEM(t, 2, o))
Py_INCREF(o);
PyTuple_SET_ITEM(t, 2, o);
Py_INCREF(o);
r = PyObject_CallObject(priv->py_event_func, t);
Py_DECREF(t);
if (r) {
@ -1066,8 +1066,8 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
obj1 = PyTuple_New(3);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong((long)class));
PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong((long)mixer));
if (PyTuple_SET_ITEM(obj1, 2, mdict))
Py_INCREF(mdict);
PyTuple_SET_ITEM(obj1, 2, mdict);
Py_INCREF(mdict);
obj2 = PyObject_CallObject(obj, obj1);
Py_XDECREF(obj1);
PyDict_SetItemString(mdict, "mixer", obj2);

View File

@ -1,10 +1,12 @@
EXTRA_DIST=Versions
EXTRA_DIST = Versions.in.in
COMPATNUM=@LIBTOOL_VERSION_INFO@
if VERSIONED_SYMBOLS
VSYMS = -Wl,--version-script=Versions
BUILT_SOURCES = $(top_builddir)/src/Versions
else
VSYMS =
BUILT_SOURCES =
endif
if SYMBOLIC_FUNCTIONS
@ -13,6 +15,8 @@ else
SYMFUNCS =
endif
VERSION_CPPFLAGS =
lib_LTLIBRARIES = libasound.la
libasound_la_SOURCES = conf.c confeval.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c
@ -23,6 +27,9 @@ SUBDIRS += mixer
libasound_la_LIBADD += mixer/libmixer.la
endif
if BUILD_PCM
if VERSIONED_SYMBOLS
VERSION_CPPFLAGS += -DHAVE_PCM_SYMS -DHAVE_TIMER_SYMS
endif
SUBDIRS += pcm timer
libasound_la_LIBADD += pcm/libpcm.la timer/libtimer.la
endif
@ -43,6 +50,9 @@ SUBDIRS += ucm
libasound_la_LIBADD += ucm/libucm.la
endif
if BUILD_ALISP
if VERSIONED_SYMBOLS
VERSION_CPPFLAGS += -DHAVE_ALISP_SYMS
endif
SUBDIRS += alisp
libasound_la_LIBADD += alisp/libalisp.la
endif
@ -51,6 +61,9 @@ libasound_la_LIBADD += @ALSA_DEPLIBS@
libasound_la_LDFLAGS = -version-info $(COMPATNUM) $(VSYMS) $(SYMFUNCS) $(LDFLAGS_NOUNDEFINED)
$(top_builddir)/src/Versions: $(top_builddir)/src/Versions.in
$(COMPILE) -E $(VERSION_CPPFLAGS) -x assembler-with-cpp -o $@ $<
control/libcontrol.la:
$(MAKE) -C control libcontrol.la

View File

@ -1,136 +1,195 @@
ALSA_0.9 {
global:
@SYMBOL_PREFIX@snd_*;
snd_*;
@SYMBOL_PREFIX@_snd_*_open;
@SYMBOL_PREFIX@_snd_*_dlsym_*;
@SYMBOL_PREFIX@_snd_*_poll_descriptor;
@SYMBOL_PREFIX@_snd_pcm_hook_*;
_snd_*_open;
_snd_*_dlsym_*;
_snd_*_poll_descriptor;
_snd_pcm_hook_*;
@SYMBOL_PREFIX@__snd_pcm_hw_params_*;
@SYMBOL_PREFIX@__snd_pcm_sw_params_*;
@SYMBOL_PREFIX@__snd_*_dlsym_*;
__snd_pcm_hw_params_*;
__snd_pcm_sw_params_*;
__snd_*_dlsym_*;
local:
*;
};
ALSA_0.9.0rc4 {
#ifdef HAVE_PCM_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_hw_params_get_access;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_access_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_access_last;
snd_pcm_hw_params_get_access;
snd_pcm_hw_params_set_access_first;
snd_pcm_hw_params_set_access_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_format;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_format_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_format_last;
snd_pcm_hw_params_get_format;
snd_pcm_hw_params_set_format_first;
snd_pcm_hw_params_set_format_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_subformat;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_subformat_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_subformat_last;
snd_pcm_hw_params_get_subformat;
snd_pcm_hw_params_set_subformat_first;
snd_pcm_hw_params_set_subformat_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_channels;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_channels_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_channels_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_last;
snd_pcm_hw_params_get_channels;
snd_pcm_hw_params_get_channels_min;
snd_pcm_hw_params_get_channels_max;
snd_pcm_hw_params_set_channels_near;
snd_pcm_hw_params_set_channels_first;
snd_pcm_hw_params_set_channels_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_rate;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_last;
snd_pcm_hw_params_get_rate;
snd_pcm_hw_params_get_rate_min;
snd_pcm_hw_params_get_rate_max;
snd_pcm_hw_params_set_rate_near;
snd_pcm_hw_params_set_rate_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_last;
snd_pcm_hw_params_set_rate_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_last;
snd_pcm_hw_params_get_period_time;
snd_pcm_hw_params_get_period_time_min;
snd_pcm_hw_params_get_period_time_max;
snd_pcm_hw_params_set_period_time_near;
snd_pcm_hw_params_set_period_time_first;
snd_pcm_hw_params_set_period_time_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_periods;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_periods_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_periods_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_last;
snd_pcm_hw_params_get_period_size;
snd_pcm_hw_params_get_period_size_min;
snd_pcm_hw_params_get_period_size_max;
snd_pcm_hw_params_set_period_size_near;
snd_pcm_hw_params_set_period_size_first;
snd_pcm_hw_params_set_period_size_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_last;
snd_pcm_hw_params_get_periods;
snd_pcm_hw_params_get_periods_min;
snd_pcm_hw_params_get_periods_max;
snd_pcm_hw_params_set_periods_near;
snd_pcm_hw_params_set_periods_first;
snd_pcm_hw_params_set_periods_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_last;
snd_pcm_hw_params_get_buffer_time;
snd_pcm_hw_params_get_buffer_time_min;
snd_pcm_hw_params_get_buffer_time_max;
snd_pcm_hw_params_set_buffer_time_near;
snd_pcm_hw_params_set_buffer_time_first;
snd_pcm_hw_params_set_buffer_time_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_last;
snd_pcm_hw_params_get_buffer_size;
snd_pcm_hw_params_get_buffer_size_min;
snd_pcm_hw_params_get_buffer_size_max;
snd_pcm_hw_params_set_buffer_size_near;
snd_pcm_hw_params_set_buffer_size_first;
snd_pcm_hw_params_set_buffer_size_last;
snd_pcm_hw_params_get_tick_time;
snd_pcm_hw_params_get_tick_time_min;
snd_pcm_hw_params_get_tick_time_max;
snd_pcm_hw_params_set_tick_time_near;
snd_pcm_hw_params_set_tick_time_first;
snd_pcm_hw_params_set_tick_time_last;
#endif
} ALSA_0.9;
ALSA_0.9.0rc8 {
#ifdef HAVE_PCM_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_forward;
@SYMBOL_PREFIX@snd_pcm_status_get_trigger_htstamp;
@SYMBOL_PREFIX@snd_pcm_status_get_htstamp;
snd_pcm_forward;
snd_pcm_status_get_trigger_htstamp;
snd_pcm_status_get_htstamp;
#endif
} ALSA_0.9.0rc4;
ALSA_0.9.0 {
#if defined HAVE_PCM_SYMS || defined HAVE_TIMER_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_type_name;
@SYMBOL_PREFIX@snd_timer_query_info;
@SYMBOL_PREFIX@snd_timer_query_params;
@SYMBOL_PREFIX@snd_timer_query_status;
@SYMBOL_PREFIX@snd_timer_params_set_exclusive;
@SYMBOL_PREFIX@snd_timer_params_get_exclusive;
@SYMBOL_PREFIX@snd_timer_params_set_filter;
@SYMBOL_PREFIX@snd_timer_params_get_filter;
#if defined HAVE_PCM_SYMS
snd_pcm_type_name;
#endif
#ifdef HAVE_TIMER_SYMS
snd_timer_query_info;
snd_timer_query_params;
snd_timer_query_status;
snd_timer_params_set_exclusive;
snd_timer_params_get_exclusive;
snd_timer_params_set_filter;
snd_timer_params_get_filter;
#endif
#endif
} ALSA_0.9.0rc8;
ALSA_0.9.3 {
global:
@SYMBOL_PREFIX@snd_ctl_elem_info_get_dimensions;
@SYMBOL_PREFIX@snd_ctl_elem_info_get_dimension;
snd_ctl_elem_info_get_dimensions;
snd_ctl_elem_info_get_dimension;
} ALSA_0.9.0;
ALSA_0.9.5 {
#ifdef HAVE_ALISP_SYMS
global:
@SYMBOL_PREFIX@alsa_lisp;
alsa_lisp;
#endif
} ALSA_0.9.3;
ALSA_0.9.7 {
#ifdef HAVE_ALISP_SYMS
global:
@SYMBOL_PREFIX@alsa_lisp_*;
alsa_lisp_*;
#endif
} ALSA_0.9.5;
ALSA_1.1.6 {
global:
@SYMBOL_PREFIX@snd_dlopen;
snd_dlopen;
} ALSA_0.9.7;
ALSA_1.2.6 {
global:
_snd_safe_strto*;
} ALSA_1.1.6;
ALSA_1.2.9 {
#ifdef HAVE_PCM_SYMS
global:
snd_pcm_hw_params_is_perfect_drain;
snd_pcm_hw_params_set_drain_silence;
snd_pcm_hw_params_get_drain_silence;
#endif
} ALSA_1.2.6;
ALSA_1.2.10 {
global:
snd_ump_*;
snd_ctl_ump_next_device;
snd_ctl_ump_endpoint_info;
snd_ctl_ump_block_info;
snd_seq_ump_*;
snd_seq_client_info_get_midi_version;
snd_seq_client_info_get_ump_group_enabled;
snd_seq_client_info_get_ump_groupless_enabled;
snd_seq_client_info_get_ump_conversion;
snd_seq_client_info_set_midi_version;
snd_seq_client_info_set_ump_group_enabled;
snd_seq_client_info_set_ump_groupless_enabled;
snd_seq_client_info_set_ump_conversion;
snd_seq_get_ump_endpoint_info;
snd_seq_get_ump_block_info;
snd_seq_set_ump_endpoint_info;
snd_seq_set_ump_block_info;
snd_seq_port_info_get_direction;
snd_seq_port_info_get_ump_group;
snd_seq_port_info_set_direction;
snd_seq_port_info_set_ump_group;
snd_seq_set_client_midi_version;
snd_seq_set_client_ump_conversion;
} ALSA_1.2.9;

195
src/Versions.in.in Normal file
View File

@ -0,0 +1,195 @@
ALSA_0.9 {
global:
@SYMBOL_PREFIX@snd_*;
@SYMBOL_PREFIX@_snd_*_open;
@SYMBOL_PREFIX@_snd_*_dlsym_*;
@SYMBOL_PREFIX@_snd_*_poll_descriptor;
@SYMBOL_PREFIX@_snd_pcm_hook_*;
@SYMBOL_PREFIX@__snd_pcm_hw_params_*;
@SYMBOL_PREFIX@__snd_pcm_sw_params_*;
@SYMBOL_PREFIX@__snd_*_dlsym_*;
local:
*;
};
ALSA_0.9.0rc4 {
#ifdef HAVE_PCM_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_hw_params_get_access;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_access_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_access_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_format;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_format_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_format_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_subformat;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_subformat_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_subformat_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_channels;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_channels_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_channels_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_channels_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_rate;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_time_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_time_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_period_size_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_period_size_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_periods;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_periods_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_periods_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_periods_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_time_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_time_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_buffer_size_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_buffer_size_last;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time_min;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_tick_time_max;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_near;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_first;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_tick_time_last;
#endif
} ALSA_0.9;
ALSA_0.9.0rc8 {
#ifdef HAVE_PCM_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_forward;
@SYMBOL_PREFIX@snd_pcm_status_get_trigger_htstamp;
@SYMBOL_PREFIX@snd_pcm_status_get_htstamp;
#endif
} ALSA_0.9.0rc4;
ALSA_0.9.0 {
#if defined HAVE_PCM_SYMS || defined HAVE_TIMER_SYMS
global:
#if defined HAVE_PCM_SYMS
@SYMBOL_PREFIX@snd_pcm_type_name;
#endif
#ifdef HAVE_TIMER_SYMS
@SYMBOL_PREFIX@snd_timer_query_info;
@SYMBOL_PREFIX@snd_timer_query_params;
@SYMBOL_PREFIX@snd_timer_query_status;
@SYMBOL_PREFIX@snd_timer_params_set_exclusive;
@SYMBOL_PREFIX@snd_timer_params_get_exclusive;
@SYMBOL_PREFIX@snd_timer_params_set_filter;
@SYMBOL_PREFIX@snd_timer_params_get_filter;
#endif
#endif
} ALSA_0.9.0rc8;
ALSA_0.9.3 {
global:
@SYMBOL_PREFIX@snd_ctl_elem_info_get_dimensions;
@SYMBOL_PREFIX@snd_ctl_elem_info_get_dimension;
} ALSA_0.9.0;
ALSA_0.9.5 {
#ifdef HAVE_ALISP_SYMS
global:
@SYMBOL_PREFIX@alsa_lisp;
#endif
} ALSA_0.9.3;
ALSA_0.9.7 {
#ifdef HAVE_ALISP_SYMS
global:
@SYMBOL_PREFIX@alsa_lisp_*;
#endif
} ALSA_0.9.5;
ALSA_1.1.6 {
global:
@SYMBOL_PREFIX@snd_dlopen;
} ALSA_0.9.7;
ALSA_1.2.6 {
global:
@SYMBOL_PREFIX@_snd_safe_strto*;
} ALSA_1.1.6;
ALSA_1.2.9 {
#ifdef HAVE_PCM_SYMS
global:
@SYMBOL_PREFIX@snd_pcm_hw_params_is_perfect_drain;
@SYMBOL_PREFIX@snd_pcm_hw_params_set_drain_silence;
@SYMBOL_PREFIX@snd_pcm_hw_params_get_drain_silence;
#endif
} ALSA_1.2.6;
ALSA_1.2.10 {
global:
@SYMBOL_PREFIX@snd_ump_*;
@SYMBOL_PREFIX@snd_ctl_ump_next_device;
@SYMBOL_PREFIX@snd_ctl_ump_endpoint_info;
@SYMBOL_PREFIX@snd_ctl_ump_block_info;
@SYMBOL_PREFIX@snd_seq_ump_*;
@SYMBOL_PREFIX@snd_seq_client_info_get_midi_version;
@SYMBOL_PREFIX@snd_seq_client_info_get_ump_group_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_get_ump_groupless_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_get_ump_conversion;
@SYMBOL_PREFIX@snd_seq_client_info_set_midi_version;
@SYMBOL_PREFIX@snd_seq_client_info_set_ump_group_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_set_ump_groupless_enabled;
@SYMBOL_PREFIX@snd_seq_client_info_set_ump_conversion;
@SYMBOL_PREFIX@snd_seq_get_ump_endpoint_info;
@SYMBOL_PREFIX@snd_seq_get_ump_block_info;
@SYMBOL_PREFIX@snd_seq_set_ump_endpoint_info;
@SYMBOL_PREFIX@snd_seq_set_ump_block_info;
@SYMBOL_PREFIX@snd_seq_port_info_get_direction;
@SYMBOL_PREFIX@snd_seq_port_info_get_ump_group;
@SYMBOL_PREFIX@snd_seq_port_info_set_direction;
@SYMBOL_PREFIX@snd_seq_port_info_set_ump_group;
@SYMBOL_PREFIX@snd_seq_set_client_midi_version;
@SYMBOL_PREFIX@snd_seq_set_client_ump_conversion;
} ALSA_1.2.9;

View File

@ -21,6 +21,12 @@
*
*/
#define alisp_seq_iterator alisp_object
#include "local.h"
#include "alisp.h"
#include "alisp_local.h"
#include <assert.h>
#include <limits.h>
@ -31,11 +37,6 @@
#include <math.h>
#include <err.h>
#define alisp_seq_iterator alisp_object
#include "local.h"
#include "alisp.h"
#include "alisp_local.h"
struct alisp_object alsa_lisp_nil;
struct alisp_object alsa_lisp_t;

View File

@ -29,7 +29,9 @@
#include <signal.h>
static struct sigaction previous_action;
#ifndef DOC_HIDDEN
#define MAX_SIG_FUNCTION_CODE 10 /* i.e. SIG_DFL SIG_IGN SIG_HOLD et al */
#endif /* DOC_HIDDEN */
#ifdef SND_ASYNC_RT_SIGNAL
/** async signal number */
@ -54,6 +56,15 @@ static LIST_HEAD(snd_async_handlers);
static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED)
{
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
/* siginfo_t does not have si_fd */
struct list_head *i;
list_for_each(i, &snd_async_handlers) {
snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist);
if (h->callback)
h->callback(h);
}
#else
int fd;
struct list_head *i;
//assert(siginfo->si_code == SI_SIGIO);
@ -66,6 +77,7 @@ static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, vo
if (h->fd == fd && h->callback)
h->callback(h);
}
#endif
}
/**

View File

@ -527,7 +527,7 @@ static inline void snd_config_unlock(void) { }
#endif
/*
* Add a diretory to the paths to search included files.
* Add a directory to the paths to search included files.
* param fd - File object that owns these paths to search files included by it.
* param dir - Path of the directory to add. Allocated externally and need to
* be freed manually later.
@ -584,6 +584,8 @@ static void free_include_paths(struct filedesc *fd)
}
}
#endif /* DOC_HIDDEN */
/**
* \brief Returns the default top-level config directory
* \return The top-level config directory path string
@ -605,6 +607,8 @@ const char *snd_config_topdir(void)
return topdir;
}
#ifndef DOC_HIDDEN
static char *_snd_config_path(const char *name)
{
const char *root = snd_config_topdir();
@ -663,7 +667,7 @@ static int input_stdio_open(snd_input_t **inputp, const char *file,
return err;
}
int safe_strtoll_base(const char *str, long long *val, int base)
int _snd_safe_strtoll_base(const char *str, long long *val, int base)
{
char *end;
long v;
@ -679,7 +683,7 @@ int safe_strtoll_base(const char *str, long long *val, int base)
return 0;
}
int safe_strtol_base(const char *str, long *val, int base)
int _snd_safe_strtol_base(const char *str, long *val, int base)
{
char *end;
long v;
@ -695,7 +699,7 @@ int safe_strtol_base(const char *str, long *val, int base)
return 0;
}
static int safe_strtod(const char *str, double *val)
int _snd_safe_strtod(const char *str, double *val)
{
char *end;
double v;
@ -814,11 +818,12 @@ static int get_char_skip_comments(input_t *input)
closedir(dirp);
err = add_include_path(input->current, str);
free(str);
if (err < 0) {
SNDERR("Cannot add search dir %s", str);
free(str);
return err;
}
free(str);
continue;
}
@ -1699,7 +1704,7 @@ static int _snd_config_save_children(snd_config_t *config, snd_output_t *out,
}
return 0;
}
#endif
#endif /* DOC_HIDDEN */
/**
@ -1741,6 +1746,8 @@ int snd_config_substitute(snd_config_t *dst, snd_config_t *src)
src->u.compound.fields.prev->next = &dst->u.compound.fields;
}
free(dst->id);
if (dst->type == SND_CONFIG_TYPE_STRING)
free(dst->u.string);
dst->id = src->id;
dst->type = src->type;
dst->u = src->u;
@ -2052,7 +2059,7 @@ int snd_config_load(snd_config_t *config, snd_input_t *in)
/**
* \brief Loads a configuration tree from a string.
* \param[out] The function puts the handle to the configuration
* \param[out] config The function puts the handle to the configuration
* node loaded from the file(s) at the address specified
* by \a config.
* \param[in] s String with the ASCII configuration
@ -2257,9 +2264,9 @@ static int _snd_config_array_merge(snd_config_t *dst, snd_config_t *src, int ind
/**
* \brief In-place merge of two config handles
* \param dst[out] Config handle for the merged contents
* \param src[in] Config handle to merge into dst (may be NULL)
* \param override[in] Override flag
* \param[out] dst Config handle for the merged contents
* \param[in] src Config handle to merge into dst (may be NULL)
* \param[in] override Override flag
* \return Zero if successful, otherwise a negative error code.
*
* This function merges all fields from the source compound to the destination compound.
@ -2276,7 +2283,7 @@ static int _snd_config_array_merge(snd_config_t *dst, snd_config_t *src, int ind
*
* \par Errors:
* <dl>
* <dt>-EEXIST<dd>identifier already exists (!overwrite)
* <dt>-EEXIST<dd>identifier already exists (!override)
* <dt>-ENOMEM<dd>not enough memory
* </dl>
*/
@ -2870,6 +2877,26 @@ int snd_config_imake_string(snd_config_t **config, const char *id, const char *v
return 0;
}
/**
* \brief Creates a string configuration node with the given initial value.
* \param[out] config The function puts the handle to the new node at
* the address specified by \a config.
* \param[in] id The id of the new node.
* \param[in] value The initial value of the new node. May be \c NULL.
* \return Zero if successful, otherwise a negative error code.
*
* This function creates a new node of type #SND_CONFIG_TYPE_STRING. The node
* contains with a copy of the string \c value, replacing any character other
* than alphanumeric, space, or '-' with the character '_'.
*
* \par Errors:
* <dl>
* <dt>-ENOMEM<dd>Out of memory.
* </dl>
*
* \par Conforming to:
* LSB 3.2
*/
int snd_config_imake_safe_string(snd_config_t **config, const char *id, const char *value)
{
int err;
@ -3891,7 +3918,6 @@ int snd_config_search_alias_hooks(snd_config_t *config,
#define ALSA_CONFIG_PATH_VAR "ALSA_CONFIG_PATH"
/**
* \ingroup Config
* \brief Configuration top-level node (the global configuration).
*
* This variable contains a handle to the top-level configuration node,
@ -3919,7 +3945,7 @@ snd_config_t *snd_config = NULL;
struct finfo {
char *name;
dev_t dev;
ino_t ino;
ino64_t ino;
time_t mtime;
};
@ -4062,7 +4088,7 @@ static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data)
return err;
}
static int config_filename_filter(const struct dirent *dirent)
static int config_filename_filter(const struct dirent64 *dirent)
{
size_t flen;
@ -4100,26 +4126,26 @@ static int config_file_open(snd_config_t *root, const char *filename)
static int config_file_load(snd_config_t *root, const char *fn, int errors)
{
struct stat st;
struct dirent **namelist;
struct stat64 st;
struct dirent64 **namelist;
int err, n;
if (!errors && access(fn, R_OK) < 0)
return 1;
if (stat(fn, &st) < 0) {
if (stat64(fn, &st) < 0) {
SNDERR("cannot stat file/directory %s", fn);
return 1;
}
if (!S_ISDIR(st.st_mode))
return config_file_open(root, fn);
#ifndef DOC_HIDDEN
#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID)
#define SORTFUNC versionsort
#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__sun) && !defined(__ANDROID__)
#define SORTFUNC versionsort64
#else
#define SORTFUNC alphasort
#define SORTFUNC alphasort64
#endif
#endif
n = scandir(fn, &namelist, config_filename_filter, SORTFUNC);
n = scandir64(fn, &namelist, config_filename_filter, SORTFUNC);
if (n > 0) {
int j;
err = 0;
@ -4292,7 +4318,7 @@ SND_DLSYM_BUILD_VERSION(snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK);
int snd_determine_driver(int card, char **driver);
#endif
snd_config_t *_snd_config_hook_private_data(int card, const char *driver)
static snd_config_t *_snd_config_hook_private_data(int card, const char *driver)
{
snd_config_t *private_data, *v;
int err;
@ -4543,9 +4569,9 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
c++;
}
for (k = 0; k < local->count; ++k) {
struct stat st;
struct stat64 st;
struct finfo *lf = &local->finfo[k];
if (stat(lf->name, &st) >= 0) {
if (stat64(lf->name, &st) >= 0) {
lf->dev = st.st_dev;
lf->ino = st.st_ino;
lf->mtime = st.st_mtime;
@ -4994,8 +5020,10 @@ int snd_config_copy(snd_config_t **dst,
static int _snd_config_expand_vars(snd_config_t **dst, const char *s, void *private_data)
{
snd_config_t *val, *vars = private_data;
if (snd_config_search(vars, s, &val) < 0)
return snd_config_make_string(dst, "");
if (snd_config_search(vars, s, &val) < 0) {
*dst = NULL;
return 0;
}
return snd_config_copy(dst, val);
}
@ -5060,6 +5088,8 @@ static int _snd_config_expand(snd_config_t *src,
err = snd_config_evaluate_string(dst, s, fcn, vars);
if (err < 0)
return err;
if (*dst == NULL)
return 0;
err = snd_config_set_id(*dst, id);
if (err < 0) {
snd_config_delete(*dst);
@ -5803,6 +5833,7 @@ static void _snd_config_end(void)
}
#endif
#ifndef DOC_HIDDEN
size_t page_size(void)
{
long s = sysconf(_SC_PAGE_SIZE);
@ -5838,3 +5869,4 @@ size_t page_ptr(size_t object_offset, size_t object_size, size_t *offset, size_t
*offset = object_offset;
return r;
}
#endif /* DOC_HIDDEN */

View File

@ -26,14 +26,6 @@ Audigy.pcm.front.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -42,15 +34,6 @@ Audigy.pcm.front.0 {
optional true
value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
}
]
}
}
@ -79,14 +62,6 @@ Audigy.pcm.rear.0 {
optional true
value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
}
]
}
}
@ -115,14 +90,6 @@ Audigy.pcm.center_lfe.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -131,14 +98,6 @@ Audigy.pcm.center_lfe.0 {
optional true
value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
}
]
}
}
@ -265,14 +224,6 @@ Audigy.pcm.iec958.0 {
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
# for compatibility with older drivers
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
name "IEC958 Optical Raw Playback Switch"
lock true
@ -287,14 +238,6 @@ Audigy.pcm.iec958.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -303,14 +246,6 @@ Audigy.pcm.iec958.0 {
optional true
value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
}
{
name "Audigy Analog/Digital Output Jack"
lock true

View File

@ -26,14 +26,6 @@ Audigy2.pcm.front.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -42,14 +34,6 @@ Audigy2.pcm.front.0 {
optional true
value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 8 9 0 0 0 0 0 0 ]
}
]
}
@ -79,14 +63,6 @@ Audigy2.pcm.rear.0 {
optional true
value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 ]
}
]
}
}
@ -115,14 +91,6 @@ Audigy2.pcm.center_lfe.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -131,14 +99,6 @@ Audigy2.pcm.center_lfe.0 {
optional true
value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 6 7 0 0 0 0 0 0 ]
}
]
}
}
@ -167,14 +127,6 @@ Audigy2.pcm.side.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -183,14 +135,6 @@ Audigy2.pcm.side.0 {
optional true
value [ 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 14 15 0 0 0 0 0 0 ]
}
]
}
}
@ -374,13 +318,6 @@ Audigy2.pcm.iec958.0 {
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
# for compatibility with older drivers
name "IEC958 Playback Default"
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
name "IEC958 Optical Raw Playback Switch"
lock true
@ -395,14 +332,6 @@ Audigy2.pcm.iec958.0 {
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -411,14 +340,6 @@ Audigy2.pcm.iec958.0 {
optional true
value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
lock true
optional true
value [ 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 20 21 0 0 0 0 0 0 ]
}
{
name "Audigy Analog/Digital Output Jack"
lock true

View File

@ -28,14 +28,6 @@ EMU10K1.pcm.front.0 {
optional true
value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -44,14 +36,6 @@ EMU10K1.pcm.front.0 {
optional true
value [ 8 9 0 0 8 9 0 0 8 9 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 8 9 0 0 8 9 0 0 8 9 0 0 ]
}
]
}
}
@ -87,14 +71,6 @@ EMU10K1.pcm.rear.0 {
optional true
value [ 0 0 255 255 0 0 255 0 0 0 0 255 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 0 0 255 255 0 0 255 0 0 0 0 255 ]
}
]
}
}
@ -152,14 +128,6 @@ EMU10K1.pcm.center_lfe.0 {
optional true
value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Volume"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 255 255 0 0 255 0 0 0 0 255 0 0 ]
}
{
interface PCM
name "EMU10K1 PCM Send Routing"
@ -168,14 +136,6 @@ EMU10K1.pcm.center_lfe.0 {
optional true
value [ 6 7 0 0 6 7 0 0 6 7 0 0 ]
}
{
# for compatibility with older drivers
name "EMU10K1 PCM Send Routing"
index { @func private_pcm_subdevice }
# lock true
optional true
value [ 6 7 0 0 6 7 0 0 6 7 0 0 ]
}
]
}
}
@ -304,14 +264,6 @@ EMU10K1.pcm.iec958.0 {
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
# for compatibility with older drivers
name "IEC958 Playback Default"
lock true
preserve true
optional true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
{
name "IEC958 Optical Raw Playback Switch"
lock true

View File

@ -27,6 +27,7 @@ USB-Audio.pcm.use_dmix {
USB-Audio.pcm.surround40_type {
"AudioPhile" two_stereo_devices
"Audiophile USB (tm)" two_stereo_devices
"ICUSBAUDIO7D" six_channels
"OmniStudio" two_stereo_devices
"Quattro" two_stereo_devices
"SB Audigy 2 NX" six_channels
@ -52,6 +53,7 @@ USB-Audio.pcm.iec958_device {
"Blue Snowball" 999
"C-Media USB Headphone Set" 999
"Cmedia Audio" 999
"Corsair HS60 PRO Surround USB S" 999
"DELL PROFESSIONAL SOUND BAR AE5" 999
"HP Digital Stereo Headset" 999
"GN 9330" 999
@ -65,8 +67,11 @@ USB-Audio.pcm.iec958_device {
"Plantronics USB Headset" 999
"Plantronics Wireless Audio" 999
"SB WoW Headset" 999
"Scarlett 2i2 4th Gen" 999
"Scarlett 2i2 USB" 999
"Scarlett 2i4 USB" 999
"Scarlett Solo 4th Gen" 999
"Scarlett Solo USB" 999
"Sennheiser USB headset" 999
"SWTOR Gaming Headset by Razer" 999
"ThinkStation P620 Main" 999
@ -77,6 +82,7 @@ USB-Audio.pcm.iec958_device {
"USB Device 0x46d_0x992" 999
"WD15 Dock" 999
"WD19 Dock" 999
"ThinkPad USB-C Dock Gen2 USB Au" 999
}
# Second iec958 device number, if any.

View File

@ -3,36 +3,9 @@
# subframe conversion
#
<confdir:pcm/front.conf>
<confdir:pcm/hdmi.conf>
vc4-hdmi.pcm.front.0 {
@args [ CARD ]
@args.CARD {
type string
}
type hw
card $CARD
}
# default with dmix
vc4-hdmi.pcm.default {
@args [ CARD ]
@args.CARD {
type string
}
type asym
playback.pcm {
type plug
slave.pcm {
@func concat
strings [ "dmix:" $CARD ]
}
}
}
<confdir:pcm/iec958.conf>
vc4-hdmi.pcm.iec958.0 {
vc4-hdmi.pcm.hdmi.0 {
@args [ CARD AES0 AES1 AES2 AES3 ]
@args.CARD {
type string
@ -53,12 +26,57 @@ vc4-hdmi.pcm.iec958.0 {
slave {
format IEC958_SUBFRAME_LE
pcm {
type plug
type hooks
slave.pcm {
type hw
card $CARD
device 0
}
hooks.0 {
type ctl_elems
hook_args [
{
name "IEC958 Playback Default"
interface PCM
optional true
lock true
preserve true
value [ $AES0 $AES1 $AES2 $AES3 ]
}
]
}
}
}
status [ $AES0 $AES1 $AES2 $AES3 ]
hdmi_mode true
}
# default with plug and softvol
vc4-hdmi.pcm.default {
@args [ CARD ]
@args.CARD {
type string
}
type asym
playback.pcm {
type plug
slave.pcm {
type softvol
slave.pcm {
@func concat
strings [
"cards.vc4-hdmi.pcm.hdmi.0:"
"CARD=" $CARD ","
"AES0=0x04," # IEC958_AES0_CON_NOT_COPYRIGHT | IEC958_AES0_CON_EMPHASIS_NONE
"AES1=0x82," # IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER
"AES2=0x00," # IEC958_AES2_CON_SOURCE_UNSPEC | IEC958_AES2_CON_CHANNEL_UNSPEC
"AES3=0x01" # IEC958_AES3_CON_FS_NOTID (iec958 plugin will fill in actual rate)
]
}
control {
name "PCM Playback Volume"
card $CARD
}
}
}
}

View File

@ -31,14 +31,16 @@
*
*/
#include "local.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include "local.h"
#ifndef DOC_HIDDEN
typedef long long value_type_t;
#endif /* DOC_HIDDEN */
static const char *_find_end_of_expression(const char *s, char begin, char end)
{
@ -119,6 +121,7 @@ static int _to_integer(value_type_t *val, snd_config_t *c)
return err;
}
#ifndef DOC_HIDDEN
int _snd_eval_string(snd_config_t **dst, const char *s,
snd_config_expand_fcn_t fcn, void *private_data)
{
@ -190,7 +193,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
} else {
e = s + 1;
while (*e) {
if (!isalnum(*e))
if (!isalnum(*e) && *e != '_')
break;
e++;
}
@ -203,6 +206,11 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
free(m);
if (err < 0)
return err;
if (tmp == NULL) {
err = snd_config_imake_integer(&tmp, NULL, 0);
if (err < 0)
return err;
}
s = e;
}
err = _to_integer(op == LEFT ? &left : &right, tmp);
@ -239,6 +247,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
else
return snd_config_imake_integer(dst, NULL, left);
}
#endif /* DOC_HIDDEN */
/**
* \brief Evaluate an math expression in the string
@ -246,7 +255,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
* node at the address specified by \a dst.
* \param[in] s A string to evaluate
* \param[in] fcn A function to get the variable contents
* \param[in] private_value A private value for the variable contents function
* \param[in] private_data A private value for the variable contents function
* \return 0 if successful, otherwise a negative error code.
*/
int snd_config_evaluate_string(snd_config_t **dst, const char *s,

View File

@ -74,12 +74,12 @@
*/
#include "local.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include "local.h"
/**
* \brief Gets the boolean value from the given ASCII string.
@ -645,7 +645,7 @@ static int string_from_integer(char **dst, long v)
}
#endif
int _snd_func_private_data(snd_config_t **dst, snd_config_t *src,
static int _snd_func_private_data(snd_config_t **dst, snd_config_t *src,
snd_config_t **private_data, const char *id)
{
int err;
@ -1031,6 +1031,14 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE);
#endif
#ifdef DOXYGEN
/* For consistency with the PCM Interface module, include documentation even
* when PCM module is not included in the build. */
#ifndef BUILD_PCM
#define BUILD_PCM
#endif
#endif /* DOXYGEN */
#ifdef BUILD_PCM
/**

View File

@ -1,6 +1,6 @@
EXTRA_LTLIBRARIES = libcontrol.la
libcontrol_la_SOURCES = cards.c tlv.c namehint.c hcontrol.c \
libcontrol_la_SOURCES = cards.c tlv.c eld.c namehint.c hcontrol.c \
control.c control_hw.c control_empty.c \
setup.c ctlparse.c \
control_plugin.c control_symbols.c

View File

@ -25,6 +25,7 @@
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -32,7 +33,6 @@
#include <ctype.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "control_local.h"
#ifndef DOC_HIDDEN
#define SND_FILE_CONTROL ALSA_DEVICE_DIRECTORY "controlC%i"

View File

@ -185,6 +185,7 @@ in-kernel implementations utilize this feature for I/O operations. This is
against the original design.
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@ -196,7 +197,6 @@ against the original design.
#include <poll.h>
#include <stdbool.h>
#include <limits.h>
#include "control_local.h"
/**
* \brief get identifier of CTL handle
@ -265,13 +265,14 @@ int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock)
}
#ifndef DOC_HIDDEN
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name)
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mode)
{
snd_ctl_t *ctl;
ctl = calloc(1, sizeof(*ctl));
if (!ctl)
return -ENOMEM;
ctl->type = type;
ctl->mode = mode;
if (name)
ctl->name = strdup(name);
INIT_LIST_HEAD(&ctl->async_handlers);
@ -427,6 +428,7 @@ int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info)
return ctl->ops->element_info(ctl, info);
}
#ifndef DOC_HIDDEN
#if 0 /* deprecated */
static bool validate_element_member_dimension(snd_ctl_elem_info_t *info)
{
@ -502,6 +504,8 @@ int __snd_ctl_add_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
return ctl->ops->element_add(ctl, info);
}
#endif /* DOC_HIDDEN */
/**
* \brief Create and add some user-defined control elements of integer type.
* \param ctl A handle of backend module for control interface.
@ -1266,6 +1270,44 @@ int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev)
return ctl->ops->rawmidi_prefer_subdevice(ctl, subdev);
}
/**
* \brief Get next UMP device number
* \param ctl CTL handle
* \param device current device on entry and next device on return
* \return 0 on success otherwise a negative error code
*/
int snd_ctl_ump_next_device(snd_ctl_t *ctl, int *device)
{
assert(ctl && device);
if (ctl->ops->ump_next_device)
return ctl->ops->ump_next_device(ctl, device);
return -ENXIO;
}
/**
* \brief Get UMP Endpoint info about a UMP RawMidi device
* \param ctl CTL handle
* \param info UMP Endpoint info pointer
* \return 0 on success otherwise a negative error code
*/
int snd_ctl_ump_endpoint_info(snd_ctl_t *ctl, snd_ump_endpoint_info_t *info)
{
assert(ctl && info);
return ctl->ops->ump_endpoint_info(ctl, info);
}
/**
* \brief Get UMP Block info about a UMP RawMidi device
* \param ctl CTL handle
* \param info UMP Block info pointer
* \return 0 on success otherwise a negative error code
*/
int snd_ctl_ump_block_info(snd_ctl_t *ctl, snd_ump_block_info_t *info)
{
assert(ctl && info);
return ctl->ops->ump_block_info(ctl, info);
}
/**
* \brief Set Power State to given SND_CTL_POWER_* value and do the power management
* \param ctl CTL handle
@ -1320,7 +1362,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
npfds = snd_ctl_poll_descriptors_count(ctl);
if (npfds <= 0 || npfds >= 16) {
SNDERR("Invalid poll_fds %d\n", npfds);
SNDERR("Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
@ -1328,7 +1370,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
if (err < 0)
return err;
if (err != npfds) {
SNDMSG("invalid poll descriptors %d\n", err);
SNDMSG("invalid poll descriptors %d", err);
return -EIO;
}
for (;;) {

View File

@ -27,12 +27,12 @@
*
*/
#include "control_local.h"
#include "control_external.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "control_local.h"
#include "control_external.h"
#ifndef PIC
/* entry for static linking */
@ -622,7 +622,7 @@ The rest fields are filled by #snd_ctl_ext_create(). The handle field
is the resultant PCM handle. The others are the current status of the
PCM.
\section ctl_ext_impl Callback Functions of External Control Plugins
\section ctl_ext_impl_cb Callback Functions of External Control Plugins
The callback functions in #snd_ctl_ext_callback_t define the real
behavior of the driver. There are many callbacks but many of them are optional.
@ -712,11 +712,11 @@ int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode)
if (ext->version < SNDRV_PROTOCOL_VERSION(1, 0, 0) ||
ext->version > SND_CTL_EXT_VERSION) {
SNDERR("ctl_ext: Plugin version mismatch\n");
SNDERR("ctl_ext: Plugin version mismatch");
return -ENXIO;
}
err = snd_ctl_new(&ctl, SND_CTL_TYPE_EXT, name);
err = snd_ctl_new(&ctl, SND_CTL_TYPE_EXT, name, mode);
if (err < 0)
return err;

View File

@ -26,6 +26,7 @@
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -33,18 +34,18 @@
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "control_local.h"
#ifndef PIC
/* entry for static linking */
const char *_snd_module_control_hw = "";
#endif
#ifndef DOC_HIDDEN
#ifndef F_SETSIG
#define F_SETSIG 10
#endif
#ifndef DOC_HIDDEN
#define SNDRV_FILE_CONTROL ALSA_DEVICE_DIRECTORY "controlC%i"
#define SNDRV_CTL_VERSION_MAX SNDRV_PROTOCOL_VERSION(2, 0, 4)
@ -287,6 +288,9 @@ static int snd_ctl_hw_pcm_info(snd_ctl_t *handle, snd_pcm_info_t * info)
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_PCM_INFO, info) < 0)
return -errno;
/* may be configurable (optional) */
if (__snd_pcm_info_eld_fixup_check(info))
return __snd_pcm_info_eld_fixup(info);
return 0;
}
@ -322,6 +326,32 @@ static int snd_ctl_hw_rawmidi_prefer_subdevice(snd_ctl_t *handle, int subdev)
return 0;
}
static int snd_ctl_hw_ump_next_device(snd_ctl_t *handle, int *device)
{
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_UMP_NEXT_DEVICE, device) < 0)
return -errno;
return 0;
}
static int snd_ctl_hw_ump_endpoint_info(snd_ctl_t *handle,
snd_ump_endpoint_info_t *info)
{
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_UMP_ENDPOINT_INFO, info) < 0)
return -errno;
return 0;
}
static int snd_ctl_hw_ump_block_info(snd_ctl_t *handle,
snd_ump_block_info_t *info)
{
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_UMP_BLOCK_INFO, info) < 0)
return -errno;
return 0;
}
static int snd_ctl_hw_set_power_state(snd_ctl_t *handle, unsigned int state)
{
snd_ctl_hw_t *hw = handle->private_data;
@ -345,7 +375,7 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
if (res <= 0)
return -errno;
if (CHECK_SANITY(res != sizeof(*event))) {
SNDMSG("snd_ctl_hw_read: read size error (req:%d, got:%d)\n",
SNDMSG("snd_ctl_hw_read: read size error (req:%d, got:%d)",
sizeof(*event), res);
return -EINVAL;
}
@ -376,6 +406,9 @@ static const snd_ctl_ops_t snd_ctl_hw_ops = {
.rawmidi_next_device = snd_ctl_hw_rawmidi_next_device,
.rawmidi_info = snd_ctl_hw_rawmidi_info,
.rawmidi_prefer_subdevice = snd_ctl_hw_rawmidi_prefer_subdevice,
.ump_next_device = snd_ctl_hw_ump_next_device,
.ump_endpoint_info = snd_ctl_hw_ump_endpoint_info,
.ump_block_info = snd_ctl_hw_ump_block_info,
.set_power_state = snd_ctl_hw_set_power_state,
.get_power_state = snd_ctl_hw_get_power_state,
.read = snd_ctl_hw_read,
@ -441,7 +474,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
hw->fd = fd;
hw->protocol = ver;
err = snd_ctl_new(&ctl, SND_CTL_TYPE_HW, name);
err = snd_ctl_new(&ctl, SND_CTL_TYPE_HW, name, mode);
if (err < 0) {
close(fd);
free(hw);

View File

@ -47,6 +47,9 @@ typedef struct _snd_ctl_ops {
int (*rawmidi_next_device)(snd_ctl_t *handle, int *device);
int (*rawmidi_info)(snd_ctl_t *handle, snd_rawmidi_info_t * info);
int (*rawmidi_prefer_subdevice)(snd_ctl_t *handle, int subdev);
int (*ump_next_device)(snd_ctl_t *handle, int *device);
int (*ump_endpoint_info)(snd_ctl_t *handle, snd_ump_endpoint_info_t *info);
int (*ump_block_info)(snd_ctl_t *handle, snd_ump_block_info_t *info);
int (*set_power_state)(snd_ctl_t *handle, unsigned int state);
int (*get_power_state)(snd_ctl_t *handle, unsigned int *state);
int (*read)(snd_ctl_t *handle, snd_ctl_event_t *event);
@ -62,6 +65,7 @@ struct _snd_ctl {
snd_ctl_type_t type;
const snd_ctl_ops_t *ops;
void *private_data;
int mode;
int nonblock;
int poll_fd;
struct list_head async_handlers;
@ -93,7 +97,7 @@ struct _snd_hctl {
/* make local functions really local */
#define snd_ctl_new snd1_ctl_new
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name);
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mode);
int _snd_ctl_poll_descriptor(snd_ctl_t *ctl);
#define _snd_ctl_async_descriptor _snd_ctl_poll_descriptor
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode);
@ -124,3 +128,12 @@ int __snd_ctl_add_elem_set(snd_ctl_t *ctl, snd_ctl_elem_info_t *info,
int __snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst,
const char *str,
const char **ret_ptr);
static inline int
__snd_pcm_info_eld_fixup_check(snd_pcm_info_t *info)
{
return info->stream == SND_PCM_STREAM_PLAYBACK &&
strncmp((char *)info->name, "HDMI ", 5) == 0;
}
int __snd_pcm_info_eld_fixup(snd_pcm_info_t *info);

View File

@ -25,14 +25,15 @@
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include "control_local.h"
#ifndef DOC_HIDDEN
#if 0
#define REMAP_DEBUG 1
#define debug(format, args...) fprintf(stderr, format, ##args)
@ -48,6 +49,7 @@
#endif
#define EREMAPNOTFOUND (888899)
#endif /* DOC_HIDDEN */
#ifndef PIC
/* entry for static linking */
@ -146,7 +148,7 @@ static snd_ctl_numid_t *remap_numid_child_new(snd_ctl_remap_t *priv, unsigned in
if (numid_child == 0)
return NULL;
if (remap_find_numid_app(priv, numid_child)) {
if (priv->numid_remap_active && remap_find_numid_app(priv, numid_child)) {
while (remap_find_numid_app(priv, priv->numid_app_last))
priv->numid_app_last++;
numid_app = priv->numid_app_last;
@ -220,6 +222,7 @@ static snd_ctl_map_t *remap_find_map_numid(snd_ctl_remap_t *priv, unsigned int n
}
return NULL;
}
static snd_ctl_map_t *remap_find_map_id(snd_ctl_remap_t *priv, snd_ctl_elem_id_t *id)
{
size_t count;
@ -379,10 +382,12 @@ static int snd_ctl_remap_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list)
return 0;
}
#ifndef DOC_HIDDEN
#define ACCESS_BITS(bits) \
(bits & (SNDRV_CTL_ELEM_ACCESS_READWRITE|\
SNDRV_CTL_ELEM_ACCESS_VOLATILE|\
SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE))
#endif /* DOC_HIDDEN */
static int remap_map_elem_info(snd_ctl_remap_t *priv, snd_ctl_elem_info_t *info)
{
@ -1141,6 +1146,7 @@ static int parse_map(snd_ctl_remap_t *priv, snd_config_t *conf)
* \param name Name of control device
* \param remap Remap configuration
* \param map Map configuration
* \param child child configuration root
* \param mode Control handle mode
* \retval zero on success otherwise a negative error code
* \warning Using of this function might be dangerous in the sense
@ -1148,7 +1154,7 @@ static int parse_map(snd_ctl_remap_t *priv, snd_config_t *conf)
* changed in future.
*/
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 ATTRIBUTE_UNUSED)
snd_config_t *map, snd_ctl_t *child, int mode)
{
snd_ctl_remap_t *priv;
snd_ctl_t *ctl;
@ -1195,7 +1201,7 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema
priv->numid_remap_active = priv->map_items > 0;
priv->child = child;
err = snd_ctl_new(&ctl, SND_CTL_TYPE_REMAP, name);
err = snd_ctl_new(&ctl, SND_CTL_TYPE_REMAP, name, mode);
if (err < 0) {
result = err;
goto _err;
@ -1326,4 +1332,6 @@ int _snd_ctl_remap_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd
snd_ctl_close(cctl);
return err;
}
#ifndef DOC_HIDDEN
SND_DLSYM_BUILD_VERSION(_snd_ctl_remap_open, SND_CONTROL_DLSYM_VERSION);
#endif

View File

@ -51,7 +51,7 @@ static int snd_ctl_shm_action(snd_ctl_t *ctl)
{
snd_ctl_shm_t *shm = ctl->private_data;
int err;
char buf[1];
char buf[1] = {0};
volatile snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
err = write(shm->socket, buf, 1);
if (err != 1)
@ -502,7 +502,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
shm->socket = sock;
shm->ctrl = ctrl;
err = snd_ctl_new(&ctl, SND_CTL_TYPE_SHM, name);
err = snd_ctl_new(&ctl, SND_CTL_TYPE_SHM, name, mode);
if (err < 0) {
result = err;
goto _err;

View File

@ -1,23 +1,3 @@
/*
* ALSA lib C file ctl_symbols_list.c
* Copyright (c) 2022 Huawei Device Co., Ltd.
*
* 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
*
*/
&_snd_module_control_remap,
&_snd_module_control_shm,
&_snd_module_control_ext,

View File

@ -25,11 +25,11 @@
*
*/
#include "control_local.h"
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "control_local.h"
/* Function to convert from percentage to volume. val = percentage */

109
src/control/eld.c Normal file
View File

@ -0,0 +1,109 @@
/**
* \file control/eld.c
* \brief ELD decoder
* \author Jaroslav Kysela <perex@perex>
* \date 2022
*/
/*
* Control Interface - Decode ELD
*
* Copyright (c) 2022 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
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
static void __fill_eld_ctl_id(snd_ctl_elem_id_t *id, int dev, int subdev)
{
snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_PCM);
snd_ctl_elem_id_set_name(id, "ELD");
snd_ctl_elem_id_set_device(id, dev);
snd_ctl_elem_id_set_index(id, subdev);
}
int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
{
snd_ctl_t *ctl;
snd_ctl_elem_info_t cinfo = {0};
snd_ctl_elem_value_t value = {0};
unsigned char *eld;
unsigned int l, spc;
char *s, c;
int ret, valid;
ret = snd_ctl_hw_open(&ctl, NULL, info->card, 0);
if (ret < 0) {
SYSMSG("Cannot open the associated CTL");
return ret;
}
__fill_eld_ctl_id(&cinfo.id, info->device, info->subdevice);
value.id = cinfo.id;
ret = snd_ctl_elem_info(ctl, &cinfo);
if (ret >= 0 && cinfo.type == SND_CTL_ELEM_TYPE_BYTES)
ret = snd_ctl_elem_read(ctl, &value);
snd_ctl_close(ctl);
if (ret == -ENOENT || cinfo.type != SND_CTL_ELEM_TYPE_BYTES || cinfo.count == 0)
return 0;
if (ret < 0) {
SYSMSG("Cannot read ELD");
return ret;
}
/* decode connected HDMI device name */
eld = value.value.bytes.data;
if (cinfo.count < 20 || cinfo.count > 256)
return -EIO;
l = eld[4] & 0x1f;
if (l == 0)
/* no monitor name detected */
goto __present;
if (l > 16 || 20 + l > cinfo.count) {
SNDERR("ELD decode failed, using old HDMI output names");
return 0;
}
s = alloca(l + 1);
/* sanitize */
valid = 0;
spc = 0;
while (l > 0) {
l--;
c = eld[20 + l];
if (c <= ' ' || c >= 0x7f) {
s[l] = ' ';
} else {
valid += !!isalnum(c);
s[l] = c;
if (spc == 0)
spc = l + 1;
}
}
if (valid > 3) {
s[spc] = '\0';
snd_strlcpy((char *)info->name, s, sizeof(info->name));
} else {
__present:
strncat((char *)info->name, " *", sizeof(info->name) - 1);
((char *)info->name)[sizeof(info->name)-1] = '\0';
}
return 0;
}

View File

@ -42,13 +42,13 @@ to reduce overhead accessing the real controls in kernel drivers.
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "control_local.h"
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
#endif
@ -680,7 +680,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
npfds = snd_hctl_poll_descriptors_count(hctl);
if (npfds <= 0 || npfds >= 16) {
SNDERR("Invalid poll_fds %d\n", npfds);
SNDERR("Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
@ -689,14 +689,14 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
if (err < 0)
return err;
if (err != npfds) {
SNDMSG("invalid poll descriptors %d\n", err);
SNDMSG("invalid poll descriptors %d", err);
return -EIO;
}
do {
pollio = 0;
err_poll = poll(pfd, npfds, timeout);
if (err_poll < 0) {
if (errno == EINTR && !CTLINABORT(hctl->ctl))
if (errno == EINTR && !CTLINABORT(hctl->ctl) && !(hctl->ctl->mode & SND_CTL_EINTR))
continue;
return -errno;
}

View File

@ -1,5 +1,6 @@
/**
* \file control/namehint.c
* \ingroup Configuration
* \brief Give device name hints
* \author Jaroslav Kysela <perex@perex.cz>
* \date 2006
@ -602,9 +603,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
list.siface = iface;
list.show_all = 0;
list.cardname = NULL;
if (strcmp(iface, "card") == 0)
list.iface = SND_CTL_ELEM_IFACE_CARD;
else if (strcmp(iface, "pcm") == 0)
if (strcmp(iface, "pcm") == 0)
list.iface = SND_CTL_ELEM_IFACE_PCM;
else if (strcmp(iface, "rawmidi") == 0)
list.iface = SND_CTL_ELEM_IFACE_RAWMIDI;

View File

@ -29,13 +29,13 @@
*
*/
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "local.h"
#ifndef DOC_HIDDEN
typedef struct {
@ -311,7 +311,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
unsigned int idx = 0;
if (len % 2 != 0 || len > count * 2) {
_bad_content:
SNDERR("bad value content\n");
SNDERR("bad value content");
return -EINVAL;
}
while (*buf) {

View File

@ -26,6 +26,7 @@
*
*/
#include "control_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -33,7 +34,6 @@
#ifndef HAVE_SOFT_FLOAT
#include <math.h>
#endif
#include "control_local.h"
#ifndef DOC_HIDDEN
/* convert to index of integer array */

View File

@ -27,8 +27,8 @@
*
*/
#include "list.h"
#include "local.h"
#include "list.h"
#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
#endif
@ -170,8 +170,10 @@ EXPORT_SYMBOL void *INTERNAL(snd_dlopen_old)(const char *name, int mode)
}
#endif
#ifndef DOC_HIDDEN
use_symbol_version(__snd_dlopen_old, snd_dlopen, ALSA_0.9);
use_default_symbol_version(__snd_dlopen, snd_dlopen, ALSA_1.1.6);
#endif /* DOC_HIDDEN */
/**
* \brief Closes a dynamic library - ALSA wrapper for \c dlclose.

View File

@ -28,11 +28,11 @@
*
*/
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "local.h"
/**
* Array of error codes in US ASCII.

View File

@ -28,13 +28,13 @@
*
*/
#include "hwdep_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "hwdep_local.h"
static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
const char *name, snd_config_t *hwdep_root,

View File

@ -19,13 +19,13 @@
*
*/
#include "hwdep_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "hwdep_local.h"
#ifndef PIC
/* entry for static linking */

View File

@ -19,10 +19,10 @@
*
*/
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "local.h"
typedef struct {
int (*close)(snd_hwdep_t *hwdep);

View File

@ -27,11 +27,11 @@
*
*/
#include "local.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "local.h"
#ifndef DOC_HIDDEN

View File

@ -39,13 +39,13 @@ This is an abstraction layer over the hcontrol layer.
*/
#include "mixer_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "mixer_local.h"
#ifndef DOC_HIDDEN
typedef struct _snd_mixer_slave {
@ -87,6 +87,11 @@ int snd_mixer_open(snd_mixer_t **mixerp, int mode ATTRIBUTE_UNUSED)
* \return 0 on success otherwise a negative error code
*
* For use by mixer element class specific code.
*
* The implementation of mixer class typically calls it at #SND_CTL_EVENT_MASK_ADD event. Once
* attaching, the implementation should make sure to detach it by call of #snd_mixer_elem_detach()
* at #SND_CTL_EVENT_MASK_REMOVE event. Unless detaching, mixer API internal hits assertion due
* to unsatisfied postcondition after the event.
*/
int snd_mixer_elem_attach(snd_mixer_elem_t *melem,
snd_hctl_elem_t *helem)
@ -106,6 +111,10 @@ int snd_mixer_elem_attach(snd_mixer_elem_t *melem,
* \return 0 on success otherwise a negative error code
*
* For use by mixer element class specific code.
*
* The implementation of mixer class typically calls it at #SND_CTL_EVENT_MASK_REMOVE event for
* attached mixer element at #SND_CTL_EVENT_MASK_ADD. Unless detaching, mixer API internal hits
* assertion due to unsatisfied postcondition after the event.
*/
int snd_mixer_elem_detach(snd_mixer_elem_t *melem,
snd_hctl_elem_t *helem)
@ -146,6 +155,9 @@ static int hctl_elem_event_handler(snd_hctl_elem_t *helem,
if (err < 0)
res = err;
}
// NOTE: Unsatisfied postcondition. Typically, some of registerd implementation of
// mixer class forget to detach mixer element from hcontrol element which has been
// attached at ADD event.
assert(bag_empty(bag));
bag_free(bag);
return res;
@ -470,7 +482,6 @@ int snd_mixer_elem_remove(snd_mixer_elem_t *elem)
/**
* \brief Free a mixer element
* \param elem Mixer element
* \return 0 on success otherwise a negative error code
*
* For use by mixer element class specific code.
*/

View File

@ -29,6 +29,8 @@
*
*/
#include "mixer_local.h"
#include "mixer_simple.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -36,9 +38,6 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <math.h>
#include "config.h"
#include "mixer_local.h"
#include "mixer_simple.h"
/**
* \brief Register mixer simple element class

View File

@ -27,6 +27,8 @@
*
*/
#include "mixer_local.h"
#include "mixer_simple.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -35,8 +37,6 @@
#include <sys/ioctl.h>
#include <math.h>
#include <dlfcn.h>
#include "mixer_local.h"
#include "mixer_simple.h"
#ifndef DOC_HIDDEN

View File

@ -29,6 +29,8 @@
*
*/
#include "local.h"
#include "mixer_simple.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -38,9 +40,6 @@
#include <assert.h>
#include <math.h>
#include <limits.h>
#include "local.h"
#include "config.h"
#include "mixer_simple.h"
#ifndef DOC_HIDDEN
@ -1156,11 +1155,12 @@ static selem_ctl_t *get_selem_ctl(selem_none_t *s, int dir)
c = &s->ctls[CTL_CAPTURE_VOLUME];
else
return NULL;
if (! c->elem) {
if (! c->elem)
c = &s->ctls[CTL_GLOBAL_VOLUME];
if (! c->elem)
return NULL;
}
if (! c->elem)
c = &s->ctls[CTL_SINGLE];
if (! c->elem)
return NULL;
if (c->type != SND_CTL_ELEM_TYPE_INTEGER)
return NULL;
return c;

View File

@ -30,10 +30,10 @@
*
*/
#include "local.h"
#include <stdarg.h>
#include <limits.h>
#include <sys/stat.h>
#include "local.h"
/**
* \brief This function is unimplemented.

View File

@ -27,11 +27,11 @@
*
*/
#include "local.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "local.h"
#ifndef DOC_HIDDEN
typedef struct _snd_output_ops {

View File

@ -22,9 +22,9 @@
#define SND_INTERVAL_C
#define SND_INTERVAL_INLINE
#include "pcm_local.h"
#include <sys/types.h>
#include <limits.h>
#include "pcm_local.h"
static inline void div64_32(uint64_t *n, uint32_t d, uint32_t *rem)
{

View File

@ -22,6 +22,7 @@
#define SND_MASK_C
#define SND_MASK_INLINE
#include "config.h"
#include <sys/types.h>
#include <limits.h>
#include "pcm_local.h"

View File

@ -96,7 +96,7 @@ standard C open function - see 'man 2 open'). In non-blocked behaviour,
these I/O functions never stops, they return -EAGAIN error code, when no
data can be transferred (the ring buffer is full in our case). In blocked
behaviour, these I/O functions stop and wait until there is a room in the
ring buffer (playback) or until there are a new samples (capture). The ALSA
ring buffer (playback) or until there are new samples (capture). The ALSA
implementation can be found in the \ref alsa_pcm_rw section.
\subsection pcm_transfer_event Event waiting routines
@ -215,7 +215,8 @@ range, thus you may get the significant bits for linear samples via
#snd_pcm_hw_params_get_sbits() function. The example: ICE1712
chips support 32-bit sample processing, but low byte is ignored (playback)
or zero (capture). The function snd_pcm_hw_params_get_sbits()
returns 24 in this case.
returns 24 in this case. The significant bits are related to the usable
sample bits (width) not the physical sample space.
\section alsa_transfers ALSA transfers
@ -223,7 +224,7 @@ There are two methods to transfer samples in application. The first method
is the standard read / write one. The second method, uses the direct audio
buffer to communicate with the device while ALSA library manages this space
itself. You can find examples of all communication schemes for playback
in \ref example_test_pcm "Sine-wave generator example". To complete the
in \link example_test_pcm Sine-wave generator example \endlink. To complete the
list, we should note that #snd_pcm_wait() function contains
embedded poll waiting implementation.
@ -351,9 +352,9 @@ enumeration.
These parameters - #snd_pcm_sw_params_t can be modified at
any time including the running state.
\par Minimum available count of samples
\par Minimum available count of frames
This parameter controls the wakeup point. If the count of available samples
This parameter controls the wakeup point. If the count of available frames
is equal or greater than this value, then application will be activated.
\par Timestamp mode
@ -372,29 +373,29 @@ is ignored by device. Usually, this value is set to one (no align).
\par Start threshold
The start threshold parameter is used to determine the start point in
stream. For playback, if samples in ring buffer is equal or greater than
the start threshold parameters and the stream is not running, the stream will
be started automatically from the device. For capture, if the application wants
to read count of samples equal or greater then the stream will be started.
If you want to use explicit start (#snd_pcm_start), you can
set this value greater than ring buffer size (in samples), but use the
constant MAXINT is not a bad idea.
stream. For playback, if the frame count in the ring buffer is equal or greater
than the start threshold parameter and the stream is not running, the stream
will be started automatically from the device. For capture, if the application
wants to read count of frames equal or greater then the stream will be started.
If you want to use explicit start (#snd_pcm_start), you can set this value
greater than the ring buffer size (in frames). For that simply using a large
constant such as LONG_MAX or the boundary value is not a bad idea.
\par Stop threshold
Similarly, the stop threshold parameter is used to automatically stop
the running stream, when the available samples crosses this boundary.
the running stream, when the available frames crosses this boundary.
It means, for playback, the empty samples in ring buffer and for capture,
the filled (used) samples in ring buffer.
\par Silence threshold
The silence threshold specifies count of samples filled with silence
ahead of the current application pointer for playback. It is usable
for applications when an overrun is possible (like tasks depending on
network I/O etc.). If application wants to manage the ahead samples itself,
the #snd_pcm_rewind() function allows to forget the last
samples in the stream.
The silence threshold specifies the count of frames before an underrun when the
buffer gets filled with frames of silence according to the silence size parameter
ahead of the current application pointer for playback. It is usable for applications
when an underrun is possible (like tasks depending on network I/O etc.). If
application wants to manage the ahead samples itself, the #snd_pcm_rewind() function
allows to forget the last samples in the stream.
\section pcm_status Obtaining stream status
@ -402,11 +403,11 @@ The stream status is stored in #snd_pcm_status_t structure.
These parameters can be obtained: the current stream state -
#snd_pcm_status_get_state(), timestamp of trigger -
#snd_pcm_status_get_trigger_tstamp(), timestamp of last
pointer update #snd_pcm_status_get_tstamp(), delay in samples -
#snd_pcm_status_get_delay(), available count in samples -
#snd_pcm_status_get_avail(), maximum available samples -
pointer update #snd_pcm_status_get_tstamp(), delay in frames -
#snd_pcm_status_get_delay(), available count in frames -
#snd_pcm_status_get_avail(), maximum available frames -
#snd_pcm_status_get_avail_max(), ADC over-range count in
samples - #snd_pcm_status_get_overrange(). The last two
frames - #snd_pcm_status_get_overrange(). The last two
parameters - avail_max and overrange are reset to zero after the status
call.
@ -414,7 +415,7 @@ call.
<p>
The function #snd_pcm_avail_update() updates the current
available count of samples for writing (playback) or filled samples for
available count of frames for writing (playback) or filled frames for
reading (capture). This call is mandatory for updating actual r/w pointer.
Using standalone, it is a light method to obtain current stream position,
because it does not require the user <-> kernel context switch, but the value
@ -427,10 +428,10 @@ The function #snd_pcm_avail() reads the current hardware pointer
in the ring buffer from hardware and calls #snd_pcm_avail_update() then.
</p>
<p>
The function #snd_pcm_delay() returns the delay in samples.
For playback, it means count of samples in the ring buffer before
the next sample will be sent to DAC. For capture, it means count of samples
in the ring buffer before the next sample will be captured from ADC. It works
The function #snd_pcm_delay() returns the delay in frames.
For playback, it means count of frames in the ring buffer before
the next frames will be sent to DAC. For capture, it means count of frames
in the ring buffer before the next frames will be captured from ADC. It works
only when the stream is in the running or draining (playback only) state.
Note that this function does not update the current r/w pointer for applications,
so the function #snd_pcm_avail_update() must be called afterwards
@ -632,42 +633,53 @@ The null device is null plugin. This device has not any arguments.
The full featured examples with cross-links can be found in Examples section
(see top of page):
\anchor example_test_pcm
\par Sine-wave generator
\par
alsa-lib/test/pcm.c example shows various transfer methods for the playback direction.
\link example_test_pcm alsa-lib/test/pcm.c \endlink
example shows various transfer methods for the playback direction.
\par Minimalistic PCM playback code
\par
alsa-lib/test/pcm_min.c example shows the minimal code to produce a sound.
\link example_test_minimal alsa-lib/test/pcm_min.c \endlink
example shows the minimal code to produce a sound.
\par Latency measuring tool
\par
alsa-lib/test/latency.c example shows the measuring of minimal latency between capture and
\link example_test_latency alsa-lib/test/latency.c \endlink
example shows the measuring of minimal latency between capture and
playback devices.
*/
/**
\example ../../test/pcm.c
\anchor example_test_pcm
Shows various transfer methods for the playback direction.
*/
/**
\example ../../test/pcm_min.c
\anchor example_test_minimal
Shows the minimal code to produce a sound.
*/
/**
\example ../../test/latency.c
\anchor example_test_latency
Shows the measuring of minimal latency between capture and
playback devices.
*/
#include "pcm_local.h"
#include <stdio.h>
#include <string.h>
#if HAVE_MALLOC_H
#include <malloc.h>
#endif
#include <stdarg.h>
#include <signal.h>
#include <ctype.h>
#include <poll.h>
#include <sys/mman.h>
#include <limits.h>
#include "pcm_local.h"
#ifndef DOC_HIDDEN
/* return specific error codes for known bad PCM states */
@ -883,6 +895,7 @@ int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
* \param pcm PCM handle
* \param params Configuration space definition container
* \return 0 on success otherwise a negative error code
* \retval -EBADFD no hardware configuration is set
*/
int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
@ -949,6 +962,8 @@ int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
/** \brief Remove PCM hardware configuration and free associated resources
* \param pcm PCM handle
* \return 0 on success otherwise a negative error code
*
* The function will also report success if no configuration is set.
*/
int snd_pcm_hw_free(snd_pcm_t *pcm)
{
@ -1703,7 +1718,7 @@ int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
assert(pcm1);
assert(pcm2);
if (pcm1->fast_ops->link)
err = pcm1->fast_ops->link(pcm1, pcm2);
err = pcm1->fast_ops->link(pcm1->fast_op_arg, pcm2);
else
err = -ENOSYS;
return err;
@ -1720,7 +1735,7 @@ int snd_pcm_unlink(snd_pcm_t *pcm)
assert(pcm);
if (pcm->fast_ops->unlink)
err = pcm->fast_ops->unlink(pcm);
err = pcm->fast_ops->unlink(pcm->fast_op_arg);
else
err = -ENOSYS;
return err;
@ -1797,6 +1812,12 @@ static int __snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds,
* corresponding FD_SET arrays and demangle events using
* \link ::snd_pcm_poll_descriptors_revents() \endlink .
*
* It is guaranteed that for the given PCM handle, the output poll
* descriptor structs (and their count) will not change after
* hardware and software parameters setup. Thus it is valid to call
* the function once when all parameters are set and reuse its output
* for the lifetime of the stream parameters.
*
* The function is thread-safe when built with the proper option.
*/
int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
@ -1832,6 +1853,13 @@ static int __snd_pcm_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds,
* Note: Even if multiple poll descriptors are used (i.e. pfds > 1),
* this function returns only a single event.
*
* The passed in count of poll descriptors must be equal to
* \link ::snd_pcm_poll_descriptors_count() \endlink and the passed in array
* must match the array returned by \link ::snd_pcm_poll_descriptors() \endlink
* (in its full length and original order) with the revent fields updated
* according to the poll() result. This function will not modify the file
* descriptor or event field of any element of the given poll descriptor array.
*
* The function is thread-safe when built with the proper option.
*/
int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
@ -2059,10 +2087,16 @@ static const char *const snd_pcm_type_names[] = {
static const char *const snd_pcm_subformat_names[] = {
SUBFORMAT(STD),
SUBFORMAT(MSBITS_MAX),
SUBFORMAT(MSBITS_20),
SUBFORMAT(MSBITS_24),
};
static const char *const snd_pcm_subformat_descriptions[] = {
SUBFORMATD(STD, "Standard"),
SUBFORMATD(MSBITS_MAX, "Maximum based on PCM format"),
SUBFORMATD(MSBITS_20, "20 most significant bits"),
SUBFORMATD(MSBITS_24, "24 most significant bits"),
};
static const char *const snd_pcm_start_mode_names[] = {
@ -2186,6 +2220,30 @@ const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat)
return snd_pcm_subformat_descriptions[subformat];
}
/**
* \brief get PCM sample subformat from name
* \param name PCM sample subformat name (case insensitive)
* \return PCM sample subformat
*/
snd_pcm_subformat_t snd_pcm_subformat_value(const char* name)
{
snd_pcm_subformat_t subformat;
for (subformat = 0; subformat <= SND_PCM_SUBFORMAT_LAST; subformat++) {
if (snd_pcm_subformat_names[subformat] &&
!strcasecmp(name, snd_pcm_subformat_names[subformat]))
return subformat;
}
for (subformat = 0; subformat <= SND_PCM_SUBFORMAT_LAST; subformat++) {
if (snd_pcm_subformat_descriptions[subformat] &&
!strcasecmp(name, snd_pcm_subformat_descriptions[subformat]))
return subformat;
}
return SND_PCM_SUBFORMAT_UNKNOWN;
}
/**
* \brief (DEPRECATED) get name of PCM start mode setting
* \param mode PCM start mode
@ -2232,7 +2290,7 @@ const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode)
/**
* \brief get name of PCM tstamp type setting
* \param mode PCM tstamp type
* \param type PCM tstamp type
* \return ascii name of PCM tstamp type setting
*/
const char *snd_pcm_tstamp_type_name(snd_pcm_tstamp_type_t type)
@ -2832,7 +2890,8 @@ int snd_pcm_open_named_slave(snd_pcm_t **pcmp, const char *name,
* \brief Wait for a PCM to become ready
* \param pcm PCM handle
* \param timeout maximum time in milliseconds to wait,
* a negative value means infinity
* a -1 value means infinity (SND_PCM_WAIT_INFINITE),
* see also SND_PCM_WAIT_IO and SND_PCM_WAIT_DRAIN
* \return a positive value on success otherwise a negative error code
* (-EPIPE for the xrun and -ESTRPIPE for the suspended status,
* others for general errors)
@ -2867,6 +2926,37 @@ int __snd_pcm_wait_in_lock(snd_pcm_t *pcm, int timeout)
return snd_pcm_wait_nocheck(pcm, timeout);
}
static int __snd_pcm_wait_io_timeout(snd_pcm_t *pcm)
{
int timeout;
/* period size is the time boundary */
timeout = (pcm->period_size * 1000ULL) / pcm->rate;
/* should not happen */
if (timeout < 0)
timeout = 0;
/* add extra time of 200 milliseconds */
timeout += 200;
return timeout;
}
static int __snd_pcm_wait_drain_timeout(snd_pcm_t *pcm)
{
int timeout;
/* for capture, there's no reason to wait, just one iteration */
if (snd_pcm_stream(pcm) == SND_PCM_STREAM_CAPTURE)
return 0;
/* result is in milliseconds */
timeout = (snd_pcm_mmap_playback_delay(pcm) * 1000LL) / pcm->rate;
/* should not happen */
if (timeout < 0)
timeout = 0;
/* add extra time of 200 milliseconds */
timeout += 200;
return timeout;
}
/*
* like snd_pcm_wait() but doesn't check mmap_avail before calling poll()
*
@ -2882,7 +2972,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
npfds = __snd_pcm_poll_descriptors_count(pcm);
if (npfds <= 0 || npfds >= 16) {
SNDERR("Invalid poll_fds %d\n", npfds);
SNDERR("Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
@ -2890,15 +2980,21 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
if (err < 0)
return err;
if (err != npfds) {
SNDMSG("invalid poll descriptors %d\n", err);
SNDMSG("invalid poll descriptors %d", err);
return -EIO;
}
if (timeout == SND_PCM_WAIT_IO)
timeout = __snd_pcm_wait_io_timeout(pcm);
else if (timeout == SND_PCM_WAIT_DRAIN)
timeout = __snd_pcm_wait_drain_timeout(pcm);
else if (timeout < -1)
SNDMSG("invalid snd_pcm_wait timeout argument %d", timeout);
do {
__snd_pcm_unlock(pcm->fast_op_arg);
err_poll = poll(pfd, npfds, timeout);
__snd_pcm_lock(pcm->fast_op_arg);
if (err_poll < 0) {
if (errno == EINTR && !PCMINABORT(pcm))
if (errno == EINTR && !PCMINABORT(pcm) && !(pcm->mode & SND_PCM_EINTR))
continue;
return -errno;
}
@ -3399,12 +3495,12 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_
/**
* \brief Copy one or more areas
* \param dst_areas destination areas specification (one for each channel)
* \param dst_channels destination areas specification (one for each channel)
* \param dst_offset offset in frames inside destination area
* \param dst_size size in frames of the destination buffer
* \param src_areas source areas specification (one for each channel)
* \param src_channels source areas specification (one for each channel)
* \param src_offset offset in frames inside source area
* \param dst_size size in frames of the source buffer
* \param src_size size in frames of the source buffer
* \param channels channels count
* \param frames frames to copy
* \param format PCM sample format
@ -3705,6 +3801,29 @@ int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *param
return !!(params->info & SNDRV_PCM_INFO_NO_PERIOD_WAKEUP);
}
/**
* \brief Check if hardware is capable of perfect drain
* \param params Configuration space
* \retval 0 Hardware doesn't do perfect drain
* \retval 1 Hardware does perfect drain
*
* This function should only be called when the configuration space
* contains a single configuration. Call #snd_pcm_hw_params to choose
* a single configuration from the configuration space.
*
* Perfect drain means that the hardware does not use samples
* beyond the stream application pointer.
*/
int snd_pcm_hw_params_is_perfect_drain(const snd_pcm_hw_params_t *params)
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
SNDMSG("invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_PERFECT_DRAIN);
}
/**
* \brief Check if hardware supports audio wallclock timestamps
* \param params Configuration space
@ -3785,7 +3904,16 @@ int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
/**
* \brief Get sample resolution info from a configuration space
* \param params Configuration space
* \return signification bits in sample otherwise a negative error code if the info is not available
* \return sample resolution (in bits) otherwise a negative error code if the info is not available
*
* For linear formats, this function returns sample resolution -
* used bits starting from the first usable significant bit defined by
* the format (e.g. bit 31 for S32_LE format or bit 23 for S24_LE format -
* starting from bit zero). Application may use full sample bit range defined
* by the format, but additional bits (outside this sample resolution) are
* stripped (not processed).
*
* For non-linear formats, this value may have a special meaning which may be defined in future.
*
* This function should only be called when the configuration space
* contains a single configuration. Call #snd_pcm_hw_params to choose
@ -3827,6 +3955,11 @@ int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
*
* The configuration space will be filled with all possible ranges
* for the PCM device.
*
* Note that the configuration space may be constrained by the
* currently installed configuration on the PCM device. To remove
* any constrains, free the configuration with #snd_pcm_hw_free
* first.
*/
int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
@ -4393,7 +4526,7 @@ EXPORT_SYMBOL int INTERNAL(snd_pcm_hw_params_get_subformat)(const snd_pcm_hw_par
int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
#endif
{
return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, (unsigned int *)subformat, NULL);
}
/**
@ -4433,7 +4566,7 @@ EXPORT_SYMBOL int INTERNAL(snd_pcm_hw_params_set_subformat_first)(snd_pcm_t *pcm
int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
#endif
{
return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, (unsigned int *)subformat, NULL);
}
/**
@ -4449,7 +4582,7 @@ EXPORT_SYMBOL int INTERNAL(snd_pcm_hw_params_set_subformat_last)(snd_pcm_t *pcm,
int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
#endif
{
return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL);
return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, (unsigned int *)subformat, NULL);
}
/**
@ -4933,6 +5066,43 @@ int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
return 0;
}
/**
* \brief Restrict a configuration space to fill the end of playback stream with silence when drain() is invoked
* \param pcm PCM handle
* \param params Configuration space
* \param val 0 = disabled, 1 = enabled (default) fill the end of the playback stream with silence when drain() is invoked
* \return Zero on success, otherwise a negative error code.
*
* When disabled, the application should handle the end of stream gracefully
* (fill the silent samples to align to the period size plus some extra
* samples for hardware / driver without perfect drain). Note that the rewind
* may be used for this purpose or the sw_params silencing mechanism.
*/
int snd_pcm_hw_params_set_drain_silence(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
{
assert(pcm && params);
if (val)
params->flags &= ~SND_PCM_HW_PARAMS_NO_DRAIN_SILENCE;
else
params->flags |= SND_PCM_HW_PARAMS_NO_DRAIN_SILENCE;
params->rmask = ~0;
return snd_pcm_hw_refine(pcm, params);
}
/**
* \brief Extract drain with the filling of silence samples from a configuration space
* \param pcm PCM handle
* \param params Configuration space
* \param val 0 = disabled, 1 = enabled
* \return 0 otherwise a negative error code
*/
int snd_pcm_hw_params_get_drain_silence(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
{
assert(pcm && params && val);
*val = params->flags & SND_PCM_HW_PARAMS_NO_DRAIN_SILENCE ? 0 : 1;
return 0;
}
/**
* \brief Extract period time from a configuration space
* \param params Configuration space
@ -6165,6 +6335,25 @@ int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_u
return 0;
}
#ifndef DOXYGEN
void snd_pcm_sw_params_current_no_lock(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
{
params->proto = SNDRV_PCM_VERSION;
params->tstamp_mode = pcm->tstamp_mode;
params->tstamp_type = pcm->tstamp_type;
params->period_step = pcm->period_step;
params->sleep_min = 0;
params->avail_min = pcm->avail_min;
sw_set_period_event(params, pcm->period_event);
params->xfer_align = 1;
params->start_threshold = pcm->start_threshold;
params->stop_threshold = pcm->stop_threshold;
params->silence_threshold = pcm->silence_threshold;
params->silence_size = pcm->silence_size;
params->boundary = pcm->boundary;
}
#endif
/**
* \brief Return current software configuration for a PCM
* \param pcm PCM handle
@ -6181,19 +6370,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
return -EIO;
}
__snd_pcm_lock(pcm); /* forced lock due to pcm field changes */
params->proto = SNDRV_PCM_VERSION;
params->tstamp_mode = pcm->tstamp_mode;
params->tstamp_type = pcm->tstamp_type;
params->period_step = pcm->period_step;
params->sleep_min = 0;
params->avail_min = pcm->avail_min;
sw_set_period_event(params, pcm->period_event);
params->xfer_align = 1;
params->start_threshold = pcm->start_threshold;
params->stop_threshold = pcm->stop_threshold;
params->silence_threshold = pcm->silence_threshold;
params->silence_size = pcm->silence_size;
params->boundary = pcm->boundary;
snd_pcm_sw_params_current_no_lock(pcm, params);
__snd_pcm_unlock(pcm);
return 0;
}
@ -6292,7 +6469,7 @@ int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params
params->start_threshold = pcm->boundary;
break;
default:
SNDMSG("invalid start mode value %d\n", val);
SNDMSG("invalid start mode value %d", val);
return -EINVAL;
}
return 0;
@ -6340,7 +6517,7 @@ int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
params->stop_threshold = pcm->boundary;
break;
default:
SNDMSG("invalid xrun mode value %d\n", val);
SNDMSG("invalid xrun mode value %d", val);
return -EINVAL;
}
return 0;
@ -6728,6 +6905,10 @@ int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, s
* underrun is nearer than silence threshold (see
* #snd_pcm_sw_params_set_silence_threshold)
*
* When drain silence (see #snd_pcm_hw_params_get_drain_silence) is disabled,
* this will also apply for draining, i.e. silence is written also when the
* drain end is nearer than the silence threshold.
*
* The special case is when silence size value is equal or greater than
* boundary. The unused portion of the ring buffer (initial written samples
* are untouched) is filled with silence at start. Later, only just processed
@ -6915,7 +7096,7 @@ void snd_pcm_status_get_driver_htstamp(const snd_pcm_status_t *obj, snd_htimesta
/**
* \brief Get audio_tstamp_report from a PCM status container
* \param obj pointer to #snd_pcm_status_t
* \param ptr Pointer to returned report (valid fields are accuracy and type)
* \param audio_tstamp_report Pointer to returned report
*/
void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj,
snd_pcm_audio_tstamp_report_t *audio_tstamp_report)
@ -6929,7 +7110,7 @@ void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj,
/**
* \brief set audio_tstamp_config from a PCM status container
* \param obj pointer to #snd_pcm_status_t
* \param ptr Pointer to config (valid fields are type and report_analog_delay)
* \param audio_tstamp_config Pointer to config (valid fields are type_requested and report_delay)
*/
void snd_pcm_status_set_audio_htstamp_config(snd_pcm_status_t *obj,
snd_pcm_audio_tstamp_config_t *audio_tstamp_config)
@ -7324,7 +7505,7 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas,
_skip:
\endcode
*
* Look to the \ref example_test_pcm "Sine-wave generator" example
* Look to the \link example_test_pcm Sine-wave generator \endlink example
* for more details about the generate_sine function.
*
* The function is thread-safe when built with the proper option.
@ -7456,7 +7637,7 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
goto _end;
}
err = __snd_pcm_wait_in_lock(pcm, -1);
err = __snd_pcm_wait_in_lock(pcm, SND_PCM_WAIT_IO);
if (err < 0)
break;
goto _again;
@ -7525,7 +7706,7 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
goto _end;
}
err = snd_pcm_wait_nocheck(pcm, -1);
err = snd_pcm_wait_nocheck(pcm, SND_PCM_WAIT_IO);
if (err < 0)
break;
goto _again;
@ -7554,7 +7735,8 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
/* some plugins might automatically start the stream */
state = __snd_pcm_state(pcm);
if (state == SND_PCM_STATE_PREPARED &&
hw_avail >= (snd_pcm_sframes_t) pcm->start_threshold) {
hw_avail >= 0 &&
(snd_pcm_uframes_t) hw_avail >= pcm->start_threshold) {
err = __snd_pcm_start(pcm);
if (err < 0)
goto _end;

View File

@ -56,11 +56,10 @@ IMA compatibility project proceedings, Vol 2, Issue 2, May 1992.
come across a good description of XA yet.
*/
#include "bswap.h"
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "plugin_ops.h"
#include "bswap.h"
#ifndef PIC
/* entry for static linking */

View File

@ -26,8 +26,8 @@
*
*/
#include "bswap.h"
#include "pcm_local.h"
#include "bswap.h"
#include "pcm_plugin.h"
#include "plugin_ops.h"

View File

@ -26,9 +26,9 @@
*
*/
#include "bswap.h"
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "bswap.h"
#ifndef PIC
/* entry for static linking */

View File

@ -19,6 +19,7 @@
*
*/
#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@ -44,12 +45,16 @@
*
*/
#if !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__ANDROID__)
union semun {
int val; /* Value for SETVAL */
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
unsigned short *array; /* Array for GETALL, SETALL */
#if defined(__linux__)
struct seminfo *__buf; /* Buffer for IPC_INFO (Linux specific) */
#endif
};
#endif
/*
* FIXME:
@ -560,8 +565,11 @@ int snd_pcm_direct_timer_stop(snd_pcm_direct_t *dmix)
return 0;
}
#define RECOVERIES_FLAG_SUSPENDED (1U << 31)
#define RECOVERIES_MASK ((1U << 31) - 1)
/*
* Recover slave on XRUN.
* Recover slave on XRUN or SUSPENDED.
* Even if direct plugins disable xrun detection, there might be an xrun
* raised directly by some drivers.
* The first client recovers slave pcm.
@ -569,6 +577,8 @@ int snd_pcm_direct_timer_stop(snd_pcm_direct_t *dmix)
*/
int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
{
unsigned int recoveries;
int state;
int ret;
int semerr;
@ -579,7 +589,8 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
return semerr;
}
if (snd_pcm_state(direct->spcm) != SND_PCM_STATE_XRUN) {
state = snd_pcm_state(direct->spcm);
if (state != SND_PCM_STATE_XRUN && state != SND_PCM_STATE_SUSPENDED) {
/* ignore... someone else already did recovery */
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
@ -590,6 +601,24 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
return 0;
}
recoveries = direct->shmptr->s.recoveries;
recoveries = (recoveries + 1) & RECOVERIES_MASK;
if (state == SND_PCM_STATE_SUSPENDED)
recoveries |= RECOVERIES_FLAG_SUSPENDED;
direct->shmptr->s.recoveries = recoveries;
/* some buggy drivers require the device resumed before prepared;
* when a device has RESUME flag and is in SUSPENDED state, resume
* here but immediately drop to bring it to a sane active state.
*/
if (state == SND_PCM_STATE_SUSPENDED &&
(direct->spcm->info & SND_PCM_INFO_RESUME)) {
snd_pcm_resume(direct->spcm);
snd_pcm_drop(direct->spcm);
snd_pcm_direct_timer_stop(direct);
snd_pcm_direct_clear_timer_queue(direct);
}
ret = snd_pcm_prepare(direct->spcm);
if (ret < 0) {
SNDERR("recover: unable to prepare slave");
@ -621,7 +650,6 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
}
return ret;
}
direct->shmptr->s.recoveries++;
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
@ -632,25 +660,49 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
}
/*
* enter xrun state, if slave xrun occurred
* @return: 0 - no xrun >0: xrun happened
* enter xrun or suspended state, if slave xrun occurred or suspended
* @return: 0 for no xrun/suspend or a negative error code for xrun/suspend
*/
int snd_pcm_direct_client_chk_xrun(snd_pcm_direct_t *direct, snd_pcm_t *pcm)
int snd_pcm_direct_check_xrun(snd_pcm_direct_t *direct, snd_pcm_t *pcm)
{
int err;
switch (snd_pcm_state(direct->spcm)) {
case SND_PCM_STATE_DISCONNECTED:
direct->state = SNDRV_PCM_STATE_DISCONNECTED;
return -ENODEV;
case SND_PCM_STATE_XRUN:
case SND_PCM_STATE_SUSPENDED:
if ((err = snd_pcm_direct_slave_recover(direct)) < 0)
return err;
break;
default:
break;
}
if (direct->state == SND_PCM_STATE_XRUN)
return -EPIPE;
else if (direct->state == SND_PCM_STATE_SUSPENDED)
return -ESTRPIPE;
if (direct->shmptr->s.recoveries != direct->recoveries) {
/* no matter how many xruns we missed -
* so don't increment but just update to actual counter
*/
direct->recoveries = direct->shmptr->s.recoveries;
pcm->fast_ops->drop(pcm);
pcm->fast_ops->drop(pcm->fast_op_arg);
/* trigger_tstamp update is missing in drop callbacks */
gettimestamp(&direct->trigger_tstamp, pcm->tstamp_type);
/* no timer clear:
* if slave already entered xrun again the event is lost.
* snd_pcm_direct_clear_timer_queue(direct);
*/
direct->state = SND_PCM_STATE_XRUN;
return 1;
if (direct->recoveries & RECOVERIES_FLAG_SUSPENDED) {
direct->state = SND_PCM_STATE_SUSPENDED;
return -ESTRPIPE;
} else {
direct->state = SND_PCM_STATE_XRUN;
return -EPIPE;
}
}
return 0;
}
@ -718,19 +770,11 @@ timer_changed:
}
empty = avail < pcm->avail_min;
}
switch (snd_pcm_state(dmix->spcm)) {
case SND_PCM_STATE_XRUN:
/* recover slave and update client state to xrun
* before returning POLLERR
*/
snd_pcm_direct_slave_recover(dmix);
snd_pcm_direct_client_chk_xrun(dmix, pcm);
/* fallthrough */
case SND_PCM_STATE_SUSPENDED:
case SND_PCM_STATE_SETUP:
if (snd_pcm_direct_check_xrun(dmix, pcm) < 0 ||
snd_pcm_state(dmix->spcm) == SND_PCM_STATE_SETUP) {
events |= POLLERR;
break;
default:
} else {
if (empty) {
/* here we have a race condition:
* if period event arrived after the avail_update call
@ -754,7 +798,6 @@ timer_changed:
break;
}
}
break;
}
*revents = events;
return 0;
@ -1028,7 +1071,34 @@ int snd_pcm_direct_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
snd_pcm_chmap_query_t **snd_pcm_direct_query_chmaps(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dmix = pcm->private_data;
return snd_pcm_query_chmaps(dmix->spcm);
snd_pcm_chmap_query_t **smaps, **maps;
unsigned int i, j;
if (dmix->bindings == NULL)
return snd_pcm_query_chmaps(dmix->spcm);
maps = calloc(2, sizeof(*maps));
if (!maps)
return NULL;
maps[0] = calloc(dmix->channels + 2, sizeof(int *));
if (!maps[0]) {
free(maps);
return NULL;
}
smaps = snd_pcm_query_chmaps(dmix->spcm);
if (smaps == NULL) {
snd_pcm_free_chmaps(maps);
return NULL;
}
maps[0]->type = SND_CHMAP_TYPE_FIXED;
maps[0]->map.channels = dmix->channels;
for (i = 0; i < dmix->channels; i++) {
j = dmix->bindings[i];
if (j == UINT_MAX || smaps[0]->map.channels < j)
continue;
maps[0]->map.pos[i] = smaps[0]->map.pos[j];
}
return maps;
}
snd_pcm_chmap_t *snd_pcm_direct_get_chmap(snd_pcm_t *pcm)
@ -1073,27 +1143,10 @@ int snd_pcm_direct_prepare(snd_pcm_t *pcm)
int snd_pcm_direct_resume(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_t *spcm = dmix->spcm;
int err;
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
/* some buggy drivers require the device resumed before prepared;
* when a device has RESUME flag and is in SUSPENDED state, resume
* here but immediately drop to bring it to a sane active state.
*/
if ((spcm->info & SND_PCM_INFO_RESUME) &&
snd_pcm_state(spcm) == SND_PCM_STATE_SUSPENDED) {
snd_pcm_resume(spcm);
snd_pcm_drop(spcm);
snd_pcm_direct_timer_stop(dmix);
snd_pcm_direct_clear_timer_queue(dmix);
snd_pcm_areas_silence(snd_pcm_mmap_areas(spcm), 0,
spcm->channels, spcm->buffer_size,
spcm->format);
snd_pcm_prepare(spcm);
snd_pcm_start(spcm);
}
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
return -ENOSYS;
err = snd_pcm_direct_slave_recover(dmix);
return err < 0 ? err : -ENOSYS;
}
#define COPY_SLAVE(field) (dmix->shmptr->s.field = spcm->field)
@ -1689,7 +1742,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
SNDERR("invalid client channel in binding: %s\n", id);
SNDERR("invalid client channel in binding: %s", id);
return -EINVAL;
}
if ((unsigned)cchannel >= count)
@ -1714,7 +1767,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
continue;
safe_strtol(id, &cchannel);
if (snd_config_get_integer(n, &schannel) < 0) {
SNDERR("unable to get slave channel (should be integer type) in binding: %s\n", id);
SNDERR("unable to get slave channel (should be integer type) in binding: %s", id);
free(bindings);
return -EINVAL;
}
@ -1818,11 +1871,11 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
if (strcmp(id, "type") == 0) {
err = snd_config_get_string(n, &str);
if (err < 0) {
SNDERR("Invalid value for PCM type definition\n");
SNDERR("Invalid value for PCM type definition");
return -EINVAL;
}
if (strcmp(str, "hw")) {
SNDERR("Invalid type '%s' for slave PCM\n", str);
SNDERR("Invalid type '%s' for slave PCM", str);
return -EINVAL;
}
continue;
@ -1936,7 +1989,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
SNDERR("Invalid type for %s", id);
return -EINVAL;
}
if (strcmp(str, "no") == 0)
if (strcmp(str, "no") == 0 || strcmp(str, "off") == 0)
rec->hw_ptr_alignment = SND_PCM_HW_PTR_ALIGNMENT_NO;
else if (strcmp(str, "roundup") == 0)
rec->hw_ptr_alignment = SND_PCM_HW_PTR_ALIGNMENT_ROUNDUP;
@ -2072,22 +2125,22 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
return 0;
}
void snd_pcm_direct_reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix)
void snd_pcm_direct_reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix,
snd_pcm_uframes_t hw_ptr)
{
dmix->slave_appl_ptr = dmix->slave_hw_ptr = hw_ptr;
if (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_ROUNDUP ||
(dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO &&
pcm->buffer_size <= pcm->period_size * 2))
(dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO &&
pcm->buffer_size <= pcm->period_size * 2))
dmix->slave_appl_ptr =
((dmix->slave_appl_ptr + dmix->slave_period_size - 1) /
dmix->slave_period_size) * dmix->slave_period_size;
dmix->slave_period_size) * dmix->slave_period_size;
else if (dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_ROUNDDOWN ||
(dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO &&
(dmix->slave_period_size * SEC_TO_MS) /
pcm->rate < LOW_LATENCY_PERIOD_TIME))
(dmix->hw_ptr_alignment == SND_PCM_HW_PTR_ALIGNMENT_AUTO &&
((dmix->slave_period_size * SEC_TO_MS) / pcm->rate) < LOW_LATENCY_PERIOD_TIME))
dmix->slave_appl_ptr = dmix->slave_hw_ptr =
((dmix->slave_hw_ptr / dmix->slave_period_size) *
dmix->slave_period_size);
dmix->slave_period_size);
}
int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type,

View File

@ -224,6 +224,8 @@ struct snd_pcm_direct {
snd1_pcm_direct_nonblock
#define snd_pcm_direct_async \
snd1_pcm_direct_async
#define snd_pcm_direct_poll_descriptors \
snd1_pcm_direct_poll_descriptors
#define snd_pcm_direct_poll_revents \
snd1_pcm_direct_poll_revents
#define snd_pcm_direct_info \
@ -264,6 +266,10 @@ struct snd_pcm_direct {
snd1_pcm_direct_set_chmap
#define snd_pcm_direct_reset_slave_ptr \
snd1_pcm_direct_reset_slave_ptr
#define snd_pcm_direct_check_xrun \
snd1_pcm_direct_check_xrun
#define snd_pcm_direct_slave_recover \
snd1_pcm_direct_slave_recover
int snd_pcm_direct_semaphore_create_or_connect(snd_pcm_direct_t *dmix);
@ -345,10 +351,10 @@ snd_pcm_chmap_query_t **snd_pcm_direct_query_chmaps(snd_pcm_t *pcm);
snd_pcm_chmap_t *snd_pcm_direct_get_chmap(snd_pcm_t *pcm);
int snd_pcm_direct_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map);
int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct);
int snd_pcm_direct_client_chk_xrun(snd_pcm_direct_t *direct, snd_pcm_t *pcm);
int snd_pcm_direct_check_xrun(snd_pcm_direct_t *direct, snd_pcm_t *pcm);
int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid);
struct timespec snd_pcm_hw_fast_tstamp(snd_pcm_t *pcm);
void snd_pcm_direct_reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix);
void snd_pcm_direct_reset_slave_ptr(snd_pcm_t *pcm, snd_pcm_direct_t *dmix, snd_pcm_uframes_t hw_ptr);
struct snd_pcm_direct_open_conf {
key_t ipc_key;

View File

@ -26,6 +26,7 @@
*
*/
#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@ -424,25 +425,17 @@ static int snd_pcm_dmix_sync_ptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr
static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_uframes_t slave_hw_ptr;
int err;
switch (snd_pcm_state(dmix->spcm)) {
case SND_PCM_STATE_DISCONNECTED:
dmix->state = SND_PCM_STATE_DISCONNECTED;
return -ENODEV;
case SND_PCM_STATE_XRUN:
if ((err = snd_pcm_direct_slave_recover(dmix)) < 0)
return err;
break;
default:
break;
}
if (snd_pcm_direct_client_chk_xrun(dmix, pcm))
return -EPIPE;
if (dmix->slowptr)
snd_pcm_hwsync(dmix->spcm);
slave_hw_ptr = *dmix->spcm->hw.ptr;
err = snd_pcm_direct_check_xrun(dmix, pcm);
if (err < 0)
return err;
return snd_pcm_dmix_sync_ptr0(pcm, *dmix->spcm->hw.ptr);
return snd_pcm_dmix_sync_ptr0(pcm, slave_hw_ptr);
}
/*
@ -452,22 +445,8 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
static snd_pcm_state_t snd_pcm_dmix_state(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dmix = pcm->private_data;
int err;
snd_pcm_state_t state;
state = snd_pcm_state(dmix->spcm);
switch (state) {
case SND_PCM_STATE_SUSPENDED:
case SND_PCM_STATE_DISCONNECTED:
dmix->state = state;
return state;
case SND_PCM_STATE_XRUN:
if ((err = snd_pcm_direct_slave_recover(dmix)) < 0)
return err;
break;
default:
break;
}
snd_pcm_direct_client_chk_xrun(dmix, pcm);
snd_pcm_direct_check_xrun(dmix, pcm);
if (dmix->state == STATE_RUN_PENDING)
return SNDRV_PCM_STATE_RUNNING;
return dmix->state;
@ -553,8 +532,7 @@ static int snd_pcm_dmix_reset(snd_pcm_t *pcm)
snd_pcm_direct_t *dmix = pcm->private_data;
dmix->hw_ptr %= pcm->period_size;
dmix->appl_ptr = dmix->last_appl_ptr = dmix->hw_ptr;
dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
snd_pcm_direct_reset_slave_ptr(pcm, dmix);
snd_pcm_direct_reset_slave_ptr(pcm, dmix, *dmix->spcm->hw.ptr);
return 0;
}
@ -563,8 +541,7 @@ static int snd_pcm_dmix_start_timer(snd_pcm_t *pcm, snd_pcm_direct_t *dmix)
int err;
snd_pcm_hwsync(dmix->spcm);
dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
snd_pcm_direct_reset_slave_ptr(pcm, dmix);
snd_pcm_direct_reset_slave_ptr(pcm, dmix, *dmix->spcm->hw.ptr);
err = snd_timer_start(dmix->timer);
if (err < 0)
return err;
@ -647,7 +624,7 @@ static int __snd_pcm_dmix_drain(snd_pcm_t *pcm)
if (dmix->state == SND_PCM_STATE_DRAINING) {
snd_pcm_dmix_sync_area(pcm);
if ((pcm->mode & SND_PCM_NONBLOCK) == 0) {
snd_pcm_wait_nocheck(pcm, -1);
snd_pcm_wait_nocheck(pcm, SND_PCM_WAIT_DRAIN);
snd_pcm_direct_clear_timer_queue(dmix); /* force poll to wait */
}
@ -830,18 +807,9 @@ static snd_pcm_sframes_t snd_pcm_dmix_mmap_commit(snd_pcm_t *pcm,
snd_pcm_direct_t *dmix = pcm->private_data;
int err;
switch (snd_pcm_state(dmix->spcm)) {
case SND_PCM_STATE_XRUN:
if ((err = snd_pcm_direct_slave_recover(dmix)) < 0)
return err;
break;
case SND_PCM_STATE_SUSPENDED:
return -ESTRPIPE;
default:
break;
}
if (snd_pcm_direct_client_chk_xrun(dmix, pcm))
return -EPIPE;
err = snd_pcm_direct_check_xrun(dmix, pcm);
if (err < 0)
return err;
if (! size)
return 0;
snd_pcm_mmap_appl_forward(pcm, size);
@ -1173,7 +1141,7 @@ pcm.name {
ipc_perm INT # IPC permissions (octal, default 0600)
hw_ptr_alignment STR # Slave application and hw pointer alignment type
# STR can be one of the below strings :
# no
# no (or off)
# roundup
# rounddown
# auto (default)

View File

@ -330,7 +330,7 @@ static void generic_mix_areas_32_swap(unsigned int size,
register signed int sample;
for (;;) {
sample = bswap_32(*src) >> 8;
sample = (signed int) bswap_32(*src) >> 8;
if (! *dst) {
*sum = sample;
*dst = *src;
@ -364,7 +364,7 @@ static void generic_remix_areas_32_swap(unsigned int size,
register signed int sample;
for (;;) {
sample = bswap_32(*src) >> 8;
sample = (signed int) bswap_32(*src) >> 8;
if (! *dst) {
*sum = -sample;
*dst = bswap_32(-sample);

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