From 1480a6e412fc633ea62a156487eb7ac6cb5b99f1 Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Tue, 26 Jan 2021 19:44:43 +0900 Subject: [PATCH] Imported Upstream version 1.0.29 Change-Id: I824d3df4d01369b86acc5841e978afd1dc96f07f --- INSTALL | 9 +- aserver/aserver.c | 24 +- configure | 24 +- configure.ac | 4 +- include/Makefile.am | 8 +- include/Makefile.in | 18 +- include/aserver.h | 1 - include/hwdep.h | 11 +- include/pcm.h | 17 +- include/sound/asound.h | 24 +- include/use-case.h | 15 +- include/version.h | 4 +- libtool | 2 +- modules/mixer/simple/sbase.c | 1 + src/conf.c | 1 + src/conf/cards/ICE1712.conf | 22 ++ src/conf/cards/USB-Audio.conf | 47 ++++ src/conf/ucm/GoogleNyan/GoogleNyan.conf | 5 + src/conf/ucm/GoogleNyan/HiFi.conf | 77 ++++++ src/conf/ucm/GoogleNyan/Makefile.am | 4 + src/conf/ucm/GoogleNyan/Makefile.in | 464 ++++++++++++++++++++++++++++++++ src/conf/ucm/Makefile.am | 2 +- src/conf/ucm/Makefile.in | 2 +- src/conf/ucm/PAZ00/HiFi.conf | 45 ++++ src/conf/ucm/PAZ00/Makefile.am | 4 + src/conf/ucm/PAZ00/Makefile.in | 464 ++++++++++++++++++++++++++++++++ src/conf/ucm/PAZ00/PAZ00.conf | 39 +++ src/conf/ucm/PAZ00/Record.conf | 65 +++++ src/control/control.c | 3 +- src/control/control_shm.c | 49 +--- src/control/ctlparse.c | 4 +- src/dlmisc.c | 3 +- src/mixer/mixer.c | 10 +- src/mixer/mixer_simple.h | 6 +- src/mixer/simple.c | 1 + src/mixer/simple_abst.c | 2 + src/mixer/simple_none.c | 2 +- src/pcm/pcm.c | 64 ++++- src/pcm/pcm_adpcm.c | 2 +- src/pcm/pcm_alaw.c | 2 +- src/pcm/pcm_copy.c | 2 +- src/pcm/pcm_direct.c | 5 +- src/pcm/pcm_direct.h | 2 +- src/pcm/pcm_dmix.c | 22 +- src/pcm/pcm_dshare.c | 18 +- src/pcm/pcm_dsnoop.c | 16 +- src/pcm/pcm_file.c | 12 +- src/pcm/pcm_generic.c | 2 +- src/pcm/pcm_hooks.c | 5 +- src/pcm/pcm_hw.c | 38 ++- src/pcm/pcm_iec958.c | 2 +- src/pcm/pcm_ioplug.c | 11 +- src/pcm/pcm_ladspa.c | 2 +- src/pcm/pcm_lfloat.c | 6 +- src/pcm/pcm_linear.c | 46 +--- src/pcm/pcm_local.h | 73 +++-- src/pcm/pcm_meter.c | 2 +- src/pcm/pcm_misc.c | 30 +++ src/pcm/pcm_mmap_emul.c | 2 +- src/pcm/pcm_mulaw.c | 2 +- src/pcm/pcm_multi.c | 2 +- src/pcm/pcm_null.c | 7 +- src/pcm/pcm_params.c | 2 + src/pcm/pcm_plug.c | 2 +- src/pcm/pcm_plugin.c | 6 +- src/pcm/pcm_plugin.h | 4 - src/pcm/pcm_rate.c | 16 +- src/pcm/pcm_route.c | 140 +++------- src/pcm/pcm_share.c | 10 +- src/pcm/pcm_shm.c | 53 +--- src/pcm/pcm_softvol.c | 2 +- src/pcm/plugin_ops.h | 81 ------ src/rawmidi/rawmidi.c | 5 +- src/socket.c | 49 ---- src/ucm/main.c | 120 +++++++-- src/ucm/parser.c | 10 + src/ucm/ucm_local.h | 1 + src/userfile.c | 5 +- test/audio_time.c | 13 + version | 2 +- 80 files changed, 1782 insertions(+), 597 deletions(-) create mode 100644 src/conf/ucm/GoogleNyan/GoogleNyan.conf create mode 100644 src/conf/ucm/GoogleNyan/HiFi.conf create mode 100644 src/conf/ucm/GoogleNyan/Makefile.am create mode 100644 src/conf/ucm/GoogleNyan/Makefile.in create mode 100644 src/conf/ucm/PAZ00/HiFi.conf create mode 100644 src/conf/ucm/PAZ00/Makefile.am create mode 100644 src/conf/ucm/PAZ00/Makefile.in create mode 100644 src/conf/ucm/PAZ00/PAZ00.conf create mode 100644 src/conf/ucm/PAZ00/Record.conf diff --git a/INSTALL b/INSTALL index 91a8648..47086e3 100644 --- a/INSTALL +++ b/INSTALL @@ -78,16 +78,13 @@ When you would like to cross-compile ALSA library (e.g. compile on i686 host but for arm architecture) you will need to call ./configure script with additional parameters: -CC=arm-linux-gcc ./configure --target=arm-linux +CC=arm-linux-gcc ./configure --host=arm-linux -In this example host where the library is build is guessed (should be -given with --host=platform) and target for which is the library build is -Linux on ARM architecture. You should omit setting 'CC' variable and -cross-compiler will be guessed too. +You can omit setting 'CC' variable and cross-compiler will be guessed too. So simplest version would be: -./configure --target=arm-linux +./configure --host=arm-linux For platform names in the form cpu-vendor-os (or aliases for this) you should look in 'config.guess' script. Target and all paths diff --git a/aserver/aserver.c b/aserver/aserver.c index 73ea4e9..1579da7 100644 --- a/aserver/aserver.c +++ b/aserver/aserver.c @@ -1013,11 +1013,10 @@ int main(int argc, char **argv) snd_config_t *conf; snd_config_iterator_t i, next; const char *sockname = NULL; - const char *host = NULL; long port = -1; int err; char *srvname; - struct hostent *h; + command = argv[0]; while ((c = getopt_long(argc, argv, "h", long_options, 0)) != -1) { switch (c) { @@ -1055,14 +1054,8 @@ int main(int argc, char **argv) continue; if (strcmp(id, "comment") == 0) continue; - if (strcmp(id, "host") == 0) { - err = snd_config_get_string(n, &host); - if (err < 0) { - ERROR("Invalid type for %s", id); - return 1; - } + if (strcmp(id, "host") == 0) continue; - } if (strcmp(id, "socket") == 0) { err = snd_config_get_string(n, &sockname); if (err < 0) { @@ -1082,19 +1075,6 @@ int main(int argc, char **argv) ERROR("Unknown field %s", id); return 1; } - if (!host) { - ERROR("host is not defined"); - return 1; - } - h = gethostbyname(host); - if (!h) { - ERROR("Cannot resolve %s", host); - return 1; - } - if (!snd_is_local(h)) { - ERROR("%s is not the local host", host); - return 1; - } if (!sockname && port < 0) { ERROR("either socket or port need to be defined"); return 1; diff --git a/configure b/configure index 25cfbbe..1693c5a 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for alsa-lib 1.0.28. +# Generated by GNU Autoconf 2.69 for alsa-lib 1.0.29. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='alsa-lib' PACKAGE_TARNAME='alsa-lib' -PACKAGE_VERSION='1.0.28' -PACKAGE_STRING='alsa-lib 1.0.28' +PACKAGE_VERSION='1.0.29' +PACKAGE_STRING='alsa-lib 1.0.29' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1443,7 +1443,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures alsa-lib 1.0.28 to adapt to many kinds of systems. +\`configure' configures alsa-lib 1.0.29 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1513,7 +1513,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of alsa-lib 1.0.28:";; + short | recursive ) echo "Configuration of alsa-lib 1.0.29:";; esac cat <<\_ACEOF @@ -1663,7 +1663,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -alsa-lib configure 1.0.28 +alsa-lib configure 1.0.29 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2028,7 +2028,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by alsa-lib $as_me 1.0.28, which was +It was created by alsa-lib $as_me 1.0.29, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2927,7 +2927,7 @@ fi # Define the identity of the package. PACKAGE='alsa-lib' - VERSION='1.0.28' + VERSION='1.0.29' cat >>confdefs.h <<_ACEOF @@ -13209,7 +13209,7 @@ if test ! -L "$srcdir"/include/alsa ; then ln -sf . "$srcdir"/include/alsa fi -ac_config_files="$ac_config_files Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg include/Makefile include/sound/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/conf/Makefile src/conf/alsa.conf.d/Makefile src/conf/cards/Makefile src/conf/pcm/Makefile src/conf/ucm/Makefile src/conf/ucm/DAISY-I2S/Makefile src/conf/ucm/PandaBoard/Makefile src/conf/ucm/PandaBoardES/Makefile src/conf/ucm/SDP4430/Makefile src/conf/ucm/tegraalc5632/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" +ac_config_files="$ac_config_files Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg include/Makefile include/sound/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/conf/Makefile src/conf/alsa.conf.d/Makefile src/conf/cards/Makefile src/conf/pcm/Makefile src/conf/ucm/Makefile src/conf/ucm/DAISY-I2S/Makefile src/conf/ucm/PandaBoard/Makefile src/conf/ucm/PandaBoardES/Makefile src/conf/ucm/SDP4430/Makefile src/conf/ucm/tegraalc5632/Makefile src/conf/ucm/PAZ00/Makefile src/conf/ucm/GoogleNyan/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" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -13921,7 +13921,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by alsa-lib $as_me 1.0.28, which was +This file was extended by alsa-lib $as_me 1.0.29, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13987,7 +13987,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -alsa-lib config.status 1.0.28 +alsa-lib config.status 1.0.29 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -14424,6 +14424,8 @@ do "src/conf/ucm/PandaBoardES/Makefile") CONFIG_FILES="$CONFIG_FILES src/conf/ucm/PandaBoardES/Makefile" ;; "src/conf/ucm/SDP4430/Makefile") CONFIG_FILES="$CONFIG_FILES src/conf/ucm/SDP4430/Makefile" ;; "src/conf/ucm/tegraalc5632/Makefile") CONFIG_FILES="$CONFIG_FILES src/conf/ucm/tegraalc5632/Makefile" ;; + "src/conf/ucm/PAZ00/Makefile") CONFIG_FILES="$CONFIG_FILES src/conf/ucm/PAZ00/Makefile" ;; + "src/conf/ucm/GoogleNyan/Makefile") CONFIG_FILES="$CONFIG_FILES src/conf/ucm/GoogleNyan/Makefile" ;; "modules/Makefile") CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;; "modules/mixer/Makefile") CONFIG_FILES="$CONFIG_FILES modules/mixer/Makefile" ;; "modules/mixer/simple/Makefile") CONFIG_FILES="$CONFIG_FILES modules/mixer/simple/Makefile" ;; diff --git a/configure.ac b/configure.ac index b8353a0..f0995e3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(alsa-lib, 1.0.28) +AC_INIT(alsa-lib, 1.0.29) AC_CONFIG_SRCDIR([src/control/control.c]) AC_CONFIG_MACRO_DIR([m4]) @@ -653,6 +653,8 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \ src/conf/ucm/PandaBoardES/Makefile \ src/conf/ucm/SDP4430/Makefile \ src/conf/ucm/tegraalc5632/Makefile \ + src/conf/ucm/PAZ00/Makefile \ + src/conf/ucm/GoogleNyan/Makefile \ modules/Makefile modules/mixer/Makefile modules/mixer/simple/Makefile \ alsalisp/Makefile aserver/Makefile \ test/Makefile test/lsb/Makefile \ diff --git a/include/Makefile.am b/include/Makefile.am index 0127d5c..4baa03a 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,7 +5,7 @@ alsaincludedir = ${includedir}/alsa alsainclude_HEADERS = asoundlib.h asoundef.h \ version.h global.h input.h output.h error.h \ - conf.h control.h iatomic.h use-case.h + conf.h control.h iatomic.h if BUILD_CTL_PLUGIN_EXT alsainclude_HEADERS += control_external.h @@ -17,7 +17,7 @@ if BUILD_PCM_PLUGIN alsainclude_HEADERS += pcm_plugin.h endif if BUILD_PCM_PLUGIN_RATE -alsainclude_HEADERS += pcm_rate.h +alsainclude_HEADERS += pcm_rate.h endif if BUILD_PCM_PLUGIN_EXTPLUG alsainclude_HEADERS += pcm_external.h pcm_extplug.h @@ -46,6 +46,10 @@ if BUILD_SEQ alsainclude_HEADERS += seq_event.h seq.h seqmid.h seq_midi_event.h endif +if BUILD_UCM +alsainclude_HEADERS += use-case.h +endif + if BUILD_ALISP alsainclude_HEADERS += alisp.h endif diff --git a/include/Makefile.in b/include/Makefile.in index 9e7aa52..08ecd0c 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -53,7 +53,7 @@ host_triplet = @host@ @BUILD_CTL_PLUGIN_EXT_TRUE@am__append_1 = control_external.h @BUILD_PCM_TRUE@am__append_2 = pcm.h pcm_old.h timer.h @BUILD_PCM_PLUGIN_TRUE@@BUILD_PCM_TRUE@am__append_3 = pcm_plugin.h -@BUILD_PCM_PLUGIN_RATE_TRUE@@BUILD_PCM_TRUE@am__append_4 = pcm_rate.h +@BUILD_PCM_PLUGIN_RATE_TRUE@@BUILD_PCM_TRUE@am__append_4 = pcm_rate.h @BUILD_PCM_PLUGIN_EXTPLUG_TRUE@@BUILD_PCM_TRUE@am__append_5 = pcm_external.h pcm_extplug.h @BUILD_PCM_PLUGIN_EXTPLUG_FALSE@@BUILD_PCM_PLUGIN_IOPLUG_TRUE@@BUILD_PCM_TRUE@am__append_6 = pcm_external.h @BUILD_PCM_PLUGIN_IOPLUG_TRUE@@BUILD_PCM_TRUE@am__append_7 = pcm_ioplug.h @@ -61,7 +61,8 @@ host_triplet = @host@ @BUILD_HWDEP_TRUE@am__append_9 = hwdep.h @BUILD_MIXER_TRUE@am__append_10 = mixer.h mixer_abst.h @BUILD_SEQ_TRUE@am__append_11 = seq_event.h seq.h seqmid.h seq_midi_event.h -@BUILD_ALISP_TRUE@am__append_12 = alisp.h +@BUILD_UCM_TRUE@am__append_12 = use-case.h +@BUILD_ALISP_TRUE@am__append_13 = alisp.h subdir = include DIST_COMMON = $(am__alsainclude_HEADERS_DIST) $(noinst_HEADERS) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ @@ -103,10 +104,10 @@ am__can_run_installinfo = \ esac am__alsainclude_HEADERS_DIST = asoundlib.h asoundef.h version.h \ global.h input.h output.h error.h conf.h control.h iatomic.h \ - use-case.h control_external.h pcm.h pcm_old.h timer.h \ - pcm_plugin.h pcm_rate.h pcm_external.h pcm_extplug.h \ - pcm_ioplug.h rawmidi.h hwdep.h mixer.h mixer_abst.h \ - seq_event.h seq.h seqmid.h seq_midi_event.h alisp.h + control_external.h pcm.h pcm_old.h timer.h pcm_plugin.h \ + pcm_rate.h pcm_external.h pcm_extplug.h pcm_ioplug.h rawmidi.h \ + hwdep.h mixer.h mixer_abst.h seq_event.h seq.h seqmid.h \ + seq_midi_event.h use-case.h alisp.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -302,11 +303,12 @@ SUBDIRS = sound sysincludedir = ${includedir}/sys alsaincludedir = ${includedir}/alsa alsainclude_HEADERS = asoundlib.h asoundef.h version.h global.h \ - input.h output.h error.h conf.h control.h iatomic.h use-case.h \ + input.h output.h error.h conf.h control.h iatomic.h \ $(am__append_1) $(am__append_2) $(am__append_3) \ $(am__append_4) $(am__append_5) $(am__append_6) \ $(am__append_7) $(am__append_8) $(am__append_9) \ - $(am__append_10) $(am__append_11) $(am__append_12) + $(am__append_10) $(am__append_11) $(am__append_12) \ + $(am__append_13) noinst_HEADERS = alsa sys.h search.h list.h aserver.h local.h alsa-symbols.h \ asoundlib-head.h asoundlib-tail.h diff --git a/include/aserver.h b/include/aserver.h index 2586832..5da2e54 100644 --- a/include/aserver.h +++ b/include/aserver.h @@ -23,7 +23,6 @@ #include "../src/control/control_local.h" int snd_receive_fd(int sock, void *data, size_t len, int *fd); -int snd_is_local(struct hostent *hent); typedef enum _snd_dev_type { SND_DEV_TYPE_PCM, diff --git a/include/hwdep.h b/include/hwdep.h index ab12822..3d3c31b 100644 --- a/include/hwdep.h +++ b/include/hwdep.h @@ -68,8 +68,14 @@ typedef enum _snd_hwdep_iface { SND_HWDEP_IFACE_USX2Y_PCM, /**< Tascam US122, US224 & US428 raw USB PCM */ SND_HWDEP_IFACE_PCXHR, /**< Digigram PCXHR */ SND_HWDEP_IFACE_SB_RC, /**< SB Extigy/Audigy2NX remote control */ - - SND_HWDEP_IFACE_LAST = SND_HWDEP_IFACE_SB_RC /**< last known hwdep interface */ + SND_HWDEP_IFACE_HDA, /**< HD-audio */ + SND_HWDEP_IFACE_USB_STREAM, /**< direct access to usb stream */ + SND_HWDEP_IFACE_FW_DICE, /**< TC DICE FireWire device */ + SND_HWDEP_IFACE_FW_FIREWORKS, /**< Echo Audio Fireworks based device */ + SND_HWDEP_IFACE_FW_BEBOB, /**< BridgeCo BeBoB based device */ + SND_HWDEP_IFACE_FW_OXFW, /**< Oxford OXFW970/971 based device */ + + SND_HWDEP_IFACE_LAST = SND_HWDEP_IFACE_FW_OXFW /**< last known hwdep interface */ } snd_hwdep_iface_t; /** open for reading */ @@ -97,6 +103,7 @@ typedef struct _snd_hwdep snd_hwdep_t; int snd_hwdep_open(snd_hwdep_t **hwdep, const char *name, int mode); int snd_hwdep_close(snd_hwdep_t *hwdep); int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space); +int snd_hwdep_poll_descriptors_count(snd_hwdep_t *hwdep); int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); int snd_hwdep_nonblock(snd_hwdep_t *hwdep, int nonblock); int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info); diff --git a/include/pcm.h b/include/pcm.h index 95b8aed..0655e7f 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -211,7 +211,13 @@ typedef enum _snd_pcm_format { SND_PCM_FORMAT_DSD_U8, /* Direct Stream Digital (DSD) in 2-byte samples (x16) */ SND_PCM_FORMAT_DSD_U16_LE, - SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U16_LE, + /* Direct Stream Digital (DSD) in 4-byte samples (x32) */ + SND_PCM_FORMAT_DSD_U32_LE, + /* Direct Stream Digital (DSD) in 2-byte samples (x16) */ + SND_PCM_FORMAT_DSD_U16_BE, + /* Direct Stream Digital (DSD) in 4-byte samples (x32) */ + SND_PCM_FORMAT_DSD_U32_BE, + SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_BE, #if __BYTE_ORDER == __LITTLE_ENDIAN /** Signed 16 bit CPU endian */ @@ -317,6 +323,13 @@ typedef enum _snd_pcm_tstamp { SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE } snd_pcm_tstamp_t; +typedef enum _snd_pcm_tstamp_type { + SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /** gettimeofday equivalent */ + SND_PCM_TSTAMP_TYPE_MONOTONIC, /** posix_clock_monotonic equivalent */ + SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /** monotonic_raw (no NTP) */ + SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, +} snd_pcm_tstamp_type_t; + /** Unsigned frames quantity */ typedef unsigned long snd_pcm_uframes_t; /** Signed frames quantity */ @@ -844,6 +857,8 @@ int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uf int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val); int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val); +int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t val); +int snd_pcm_sw_params_get_tstamp_type(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t *val); int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val); diff --git a/include/sound/asound.h b/include/sound/asound.h index 1774a5c..1f23cd6 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -93,9 +93,13 @@ enum { SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ + SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ + SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */ + SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */ + SNDRV_HWDEP_IFACE_FW_OXFW, /* Oxford OXFW970/971 based device */ /* Don't forget to change the following: */ - SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM + SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_OXFW }; struct snd_hwdep_info { @@ -136,7 +140,7 @@ struct snd_hwdep_dsp_image { * * *****************************************************************************/ -#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 11) +#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 12) typedef unsigned long snd_pcm_uframes_t; typedef signed long snd_pcm_sframes_t; @@ -214,7 +218,12 @@ typedef int __bitwise snd_pcm_format_t; #define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */ #define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ #define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ -#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B +#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */ +#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */ +#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */ +#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ +#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ +#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE #ifdef SNDRV_LITTLE_ENDIAN #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE @@ -386,7 +395,9 @@ struct snd_pcm_sw_params { snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ snd_pcm_uframes_t silence_size; /* silence block size */ snd_pcm_uframes_t boundary; /* pointers wrap point */ - unsigned char reserved[64]; /* reserved for future */ + unsigned int proto; /* protocol version */ + unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */ + unsigned char reserved[56]; /* reserved for future */ }; struct snd_pcm_channel_info { @@ -457,7 +468,8 @@ struct snd_xfern { enum { SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ - SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, + SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ + SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, }; /* channel positions */ @@ -815,6 +827,8 @@ typedef int __bitwise snd_ctl_elem_iface_t; #define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ #define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ +#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44 + struct snd_ctl_elem_id { unsigned int numid; /* numeric identifier, zero = invalid */ snd_ctl_elem_iface_t iface; /* interface identifier */ diff --git a/include/use-case.h b/include/use-case.h index 4e13249..697377a 100644 --- a/include/use-case.h +++ b/include/use-case.h @@ -224,8 +224,9 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, * \param value Value pointer * \return Zero if success, otherwise a negative error code * - * Note: String is dynamically allocated, use free() to - * deallocate this string. + * Note: The returned string is dynamically allocated, use free() to + * deallocate this string. (Yes, the value parameter shouldn't be marked as + * "const", but it's too late to fix it, sorry about that.) * * Known identifiers: * NULL - return current card @@ -258,7 +259,17 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, * Recommended names for values: * TQ - Tone Quality * PlaybackPCM - full PCM playback device name + * PlaybackPCMIsDummy - Valid values: "yes" and "no". If set to "yes", the + * PCM named by the PlaybackPCM value is a dummy device, + * meaning that opening it enables an audio path in the + * hardware, but writing to the PCM device has no + * effect. * CapturePCM - full PCM capture device name + * CapturePCMIsDummy - Valid values: "yes" and "no". If set to "yes", the + * PCM named by the CapturePCM value is a dummy device, + * meaning that opening it enables an audio path in the + * hardware, but reading from the PCM device has no + * effect. * PlaybackRate - playback device sample rate * PlaybackChannels - playback device channel count * PlaybackCTL - playback control device name diff --git a/include/version.h b/include/version.h index 482ba44..22c57da 100644 --- a/include/version.h +++ b/include/version.h @@ -4,12 +4,12 @@ #define SND_LIB_MAJOR 1 /**< major number of library version */ #define SND_LIB_MINOR 0 /**< minor number of library version */ -#define SND_LIB_SUBMINOR 28 /**< subminor number of library version */ +#define SND_LIB_SUBMINOR 29 /**< subminor number of library version */ #define SND_LIB_EXTRAVER 1000000 /**< extra version number, used mainly for betas */ /** library version */ #define SND_LIB_VERSION ((SND_LIB_MAJOR<<16)|\ (SND_LIB_MINOR<<8)|\ SND_LIB_SUBMINOR) /** library version (string) */ -#define SND_LIB_VERSION_STR "1.0.28" +#define SND_LIB_VERSION_STR "1.0.29" diff --git a/libtool b/libtool index b7f801f..5929050 100755 --- a/libtool +++ b/libtool @@ -1,7 +1,7 @@ #! /bin/sh # libtool - Provide generalized library-building support services. -# Generated automatically by config.status (alsa-lib) 1.0.28 +# Generated automatically by config.status (alsa-lib) 1.0.29 # Libtool was configured on host alsa.alsa-project.org: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # diff --git a/modules/mixer/simple/sbase.c b/modules/mixer/simple/sbase.c index 97feee8..bb2f59d 100644 --- a/modules/mixer/simple/sbase.c +++ b/modules/mixer/simple/sbase.c @@ -377,6 +377,7 @@ static int simple_event_add1(snd_mixer_class_t *class, if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) { __invalid_type: snd_mixer_selem_id_free(id); + free(hsimple); return -EINVAL; } break; diff --git a/src/conf.c b/src/conf.c index 5ccc8e1..bb256e7 100644 --- a/src/conf.c +++ b/src/conf.c @@ -4198,6 +4198,7 @@ static int _snd_config_evaluate(snd_config_t *src, snd_config_iterator_t i, next; if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) { SNDERR("Invalid type for func %s definition", str); + err = -EINVAL; goto _err; } snd_config_for_each(i, next, func_conf) { diff --git a/src/conf/cards/ICE1712.conf b/src/conf/cards/ICE1712.conf index 398fa7a..db62684 100644 --- a/src/conf/cards/ICE1712.conf +++ b/src/conf/cards/ICE1712.conf @@ -78,6 +78,7 @@ ICE1712.pcm.surround40.0 { + ICE1712.pcm.surround51.0 { @args [ CARD ] @@ -98,6 +99,27 @@ ICE1712.pcm.surround51.0 { slave.channels 10 } +ICE1712.pcm.surround71.0 { + @args [ CARD ] + @args.CARD { + type string + } + type route + ttable.0.0 1 + ttable.1.1 1 + ttable.2.2 1 + ttable.3.3 1 + ttable.4.4 1 + ttable.5.5 1 + ttable.6.6 1 + ttable.7.7 1 + slave.pcm { + type hw + card $CARD + } + slave.channels 10 +} + ICE1712.pcm.iec958.0 { diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf index ce3ae01..4cbf85e 100644 --- a/src/conf/cards/USB-Audio.conf +++ b/src/conf/cards/USB-Audio.conf @@ -30,6 +30,7 @@ USB-Audio.pcm.surround40_type { "OmniStudio" two_stereo_devices "Quattro" two_stereo_devices "SB Audigy 2 NX" six_channels + "USB AudioSport Quattro (tm)" two_stereo_devices } # If a device does not use the first PCM device for digital data, the device @@ -38,20 +39,31 @@ USB-Audio.pcm.iec958_device { # "NoiseBlaster 3000" 42 # The below don't have digital in/out, so prevent them from being opened. + "Andrea PureAudio USB-SA Headset" 999 "Blue Snowball" 999 "HP Digital Stereo Headset" 999 + "GN 9330" 999 "Logitech Speaker Lapdesk N700" 999 + "Logitech G35 Headset" 999 "Logitech USB Headset" 999 + "Logitech USB Headset H540" 999 "Logitech Wireless Headset" 999 "Plantronics GameCom 780" 999 "Plantronics USB Headset" 999 "Plantronics Wireless Audio" 999 "SB WoW Headset" 999 "Scarlett 2i2 USB" 999 + "Scarlett 2i4 USB" 999 "Sennheiser USB headset" 999 + "SWTOR Gaming Headset by Razer" 999 "USB Device 0x46d:0x992" 999 } +# Second iec958 device number, if any. +USB-Audio.pcm.iec958_2_device { + "PHIREE U2" 1 # 0 = PCM S/PDIF, 1 = non-PCM S/PDIF +} + # If a device requires non-standard definitions for front, surround40, # surround51, surround71 or iec958, they can be defined here. @@ -422,4 +434,39 @@ USB-Audio.pcm.iec958.0 { } } +USB-Audio.pcm.iec958.1 { + @args [ CARD AES0 AES1 AES2 AES3 ] + @args.CARD { type string } + @args.AES0 { type integer } + @args.AES1 { type integer } + @args.AES2 { type integer } + @args.AES3 { type integer } + @func refer + name { + @func concat + strings [ + "cards.USB-Audio." + { @func card_name card $CARD } + ".pcm.iec958_2:CARD=" $CARD + ",AES0=" $AES0 ",AES1=" $AES1 ",AES2=" $AES2 ",AES3=" $AES3 + ] + } + default { + # FIXME: we cannot set the AES parameters + type hw + card $CARD + device { + @func refer + name { + @func concat + strings [ + "cards.USB-Audio.pcm.iec958_2_device." + { @func card_name card $CARD } + ] + } + default 999 + } + } +} + # vim: ft=alsaconf diff --git a/src/conf/ucm/GoogleNyan/GoogleNyan.conf b/src/conf/ucm/GoogleNyan/GoogleNyan.conf new file mode 100644 index 0000000..efe6ad8 --- /dev/null +++ b/src/conf/ucm/GoogleNyan/GoogleNyan.conf @@ -0,0 +1,5 @@ +Comment "Nyan internal card" +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Default" +} diff --git a/src/conf/ucm/GoogleNyan/HiFi.conf b/src/conf/ucm/GoogleNyan/HiFi.conf new file mode 100644 index 0000000..b28fe91 --- /dev/null +++ b/src/conf/ucm/GoogleNyan/HiFi.conf @@ -0,0 +1,77 @@ +SectionVerb { + EnableSequence [ + cdev "hw:GoogleNyan" + cset "name='Left Speaker Mixer Left DAC Switch' on" + cset "name='Right Speaker Mixer Right DAC Switch' on" + cset "name='Headphone Left Switch' on" + cset "name='Headphone Right Switch' on" + cset "name='Digital EQ 3 Band Switch' off" + cset "name='Digital EQ 5 Band Switch' off" + cset "name='Digital EQ 7 Band Switch' off" + cset "name='Biquad Switch' off" + cset "name='Filter Mode' Music" + cset "name='ADC Oversampling Rate' 0" + cset "name='DMIC Mux' DMIC" + cset "name='MIC2 Mux' IN34" + cset "name='Right ADC Mixer MIC2 Switch' on" + cset "name='Left ADC Mixer MIC2 Switch' on" + cset "name='MIC2 Volume' 10" + cset "name='MIC2 Boost Volume' 0" + cset "name='Mic Jack Switch' off" + cset "name='Int Mic Switch' on" + cset "name='ADCR Boost Volume' 4" + cset "name='ADCL Boost Volume' 4" + cset "name='ADCR Volume' 11" + cset "name='ADCL Volume' 11" + cset "name='Left Speaker Mixer Left DAC Switch' on" + cset "name='Right Speaker Mixer Right DAC Switch' on" + cset "name='Speaker Left Mixer Volume' 2" + cset "name='Speaker Right Mixer Volume' 2" + cset "name='Record Path DC Blocking' on" + cset "name='Playback Path DC Blocking' on" + cset "name='Headphone Left Switch' on" + cset "name='Headphone Right Switch' on" + cset "name='Headphones Switch' off" + cset "name='Speaker Left Switch' on" + cset "name='Speaker Right Switch' on" + cset "name='Speakers Switch' on" + ] + DisableSequence [ + ] +} + +SectionDevice."Headphone".0 { + Value { + OutputDspName "" + } + EnableSequence [ + cdev "hw:GoogleNyan" + cset "name='Speakers Switch' off" + cset "name='Headphones Switch' on" + ] + DisableSequence [ + cdev "hw:GoogleNyan" + cset "name='Headphones Switch' off" + cset "name='Speakers Switch' on" + ] +} + +SectionDevice."Mic".0 { + Value { + CaptureControl "MIC2" + } + EnableSequence [ + cdev "hw:GoogleNyan" + cset "name='Int Mic Switch' off" + cset "name='DMIC Mux' ADC" + cset "name='Mic Jack Switch' on" + cset "name='Record Path DC Blocking' on" + ] + DisableSequence [ + cdev "hw:GoogleNyan" + cset "name='Mic Jack Switch' off" + cset "name='DMIC Mux' DMIC" + cset "name='Int Mic Switch' on" + cset "name='Record Path DC Blocking' off" + ] +} diff --git a/src/conf/ucm/GoogleNyan/Makefile.am b/src/conf/ucm/GoogleNyan/Makefile.am new file mode 100644 index 0000000..47c7fc9 --- /dev/null +++ b/src/conf/ucm/GoogleNyan/Makefile.am @@ -0,0 +1,4 @@ +alsaconfigdir = @ALSA_CONFIG_DIR@ +ucmdir = $(alsaconfigdir)/ucm/GoogleNyan +ucm_DATA = GoogleNyan.conf HiFi.conf +EXTRA_DIST = $(ucm_DATA) diff --git a/src/conf/ucm/GoogleNyan/Makefile.in b/src/conf/ucm/GoogleNyan/Makefile.in new file mode 100644 index 0000000..c8d4465 --- /dev/null +++ b/src/conf/ucm/GoogleNyan/Makefile.in @@ -0,0 +1,464 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/conf/ucm/GoogleNyan +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(ucmdir)" +DATA = $(ucm_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@ +ALSA_DEPLIBS = @ALSA_DEPLIBS@ +ALSA_PKGCONF_DIR = @ALSA_PKGCONF_DIR@ +ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIBS = @PYTHON_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@ +SND_LIB_MAJOR = @SND_LIB_MAJOR@ +SND_LIB_MINOR = @SND_LIB_MINOR@ +SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@ +SND_LIB_VERSION = @SND_LIB_VERSION@ +STRIP = @STRIP@ +SYMBOL_PREFIX = @SYMBOL_PREFIX@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +alsaconfigdir = @ALSA_CONFIG_DIR@ +ucmdir = $(alsaconfigdir)/ucm/GoogleNyan +ucm_DATA = GoogleNyan.conf HiFi.conf +EXTRA_DIST = $(ucm_DATA) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/conf/ucm/GoogleNyan/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/conf/ucm/GoogleNyan/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-ucmDATA: $(ucm_DATA) + @$(NORMAL_INSTALL) + @list='$(ucm_DATA)'; test -n "$(ucmdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(ucmdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(ucmdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(ucmdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(ucmdir)" || exit $$?; \ + done + +uninstall-ucmDATA: + @$(NORMAL_UNINSTALL) + @list='$(ucm_DATA)'; test -n "$(ucmdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(ucmdir)'; $(am__uninstall_files_from_dir) +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(ucmdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-ucmDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-ucmDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + install-ucmDATA installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-ucmDATA + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/conf/ucm/Makefile.am b/src/conf/ucm/Makefile.am index e089dde..14fc7ae 100644 --- a/src/conf/ucm/Makefile.am +++ b/src/conf/ucm/Makefile.am @@ -1 +1 @@ -SUBDIRS=DAISY-I2S PandaBoard PandaBoardES SDP4430 tegraalc5632 +SUBDIRS=DAISY-I2S PandaBoard PandaBoardES SDP4430 tegraalc5632 PAZ00 GoogleNyan diff --git a/src/conf/ucm/Makefile.in b/src/conf/ucm/Makefile.in index eba9992..19e62f9 100644 --- a/src/conf/ucm/Makefile.in +++ b/src/conf/ucm/Makefile.in @@ -248,7 +248,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = DAISY-I2S PandaBoard PandaBoardES SDP4430 tegraalc5632 +SUBDIRS = DAISY-I2S PandaBoard PandaBoardES SDP4430 tegraalc5632 PAZ00 GoogleNyan all: all-recursive .SUFFIXES: diff --git a/src/conf/ucm/PAZ00/HiFi.conf b/src/conf/ucm/PAZ00/HiFi.conf new file mode 100644 index 0000000..275516d --- /dev/null +++ b/src/conf/ucm/PAZ00/HiFi.conf @@ -0,0 +1,45 @@ +SectionVerb { + EnableSequence [ + cdev "hw:PAZ00" + + cset "name='Speaker Playback Switch' on" + cset "name='Int Spk Switch' on" + cset "name='Speaker Mix DAC2SPK Playback Switch' on" + ] + DisableSequence [ + cset "name='Speaker Playback Switch' off" + cset "name='Int Spk Switch' off" + cset "name='Speaker Mix DAC2SPK Playback Switch' off" + ] +} + +SectionDevice."Headset".0 { + Comment "3.5mm Headset" + + Value { + JackName "Paz00 Headset Jack" + } + + EnableSequence [ + cdev "hw:PAZ00" + + # Internal speaker + cset "name='Int Spk Switch' off" + + # Headphones + cset "name='Headphone Playback Switch' on" + cset "name='HPL Mix DACL2HP Playback Switch' on" + cset "name='HPR Mix DACR2HP Playback Switch' on" + ] + DisableSequence [ + cdev "hw:PAZ00" + + # Headphones + cset "name='Headphone Playback Switch' off" + cset "name='HPL Mix DACL2HP Playback Switch' off" + cset "name='HPR Mix DACR2HP Playback Switch' off" + + # Internal speaker + cset "name='Int Spk Switch' on" + ] +} diff --git a/src/conf/ucm/PAZ00/Makefile.am b/src/conf/ucm/PAZ00/Makefile.am new file mode 100644 index 0000000..1bf98a6 --- /dev/null +++ b/src/conf/ucm/PAZ00/Makefile.am @@ -0,0 +1,4 @@ +alsaconfigdir = @ALSA_CONFIG_DIR@ +ucmdir = $(alsaconfigdir)/ucm/PAZ00 +ucm_DATA = PAZ00.conf HiFi.conf Record.conf +EXTRA_DIST = $(ucm_DATA) diff --git a/src/conf/ucm/PAZ00/Makefile.in b/src/conf/ucm/PAZ00/Makefile.in new file mode 100644 index 0000000..36e0e41 --- /dev/null +++ b/src/conf/ucm/PAZ00/Makefile.in @@ -0,0 +1,464 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/conf/ucm/PAZ00 +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(ucmdir)" +DATA = $(ucm_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALSA_CONFIG_DIR = @ALSA_CONFIG_DIR@ +ALSA_DEPLIBS = @ALSA_DEPLIBS@ +ALSA_PKGCONF_DIR = @ALSA_PKGCONF_DIR@ +ALSA_PLUGIN_DIR = @ALSA_PLUGIN_DIR@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_VERSION_INFO = @LIBTOOL_VERSION_INFO@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIBS = @PYTHON_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SND_LIB_EXTRAVER = @SND_LIB_EXTRAVER@ +SND_LIB_MAJOR = @SND_LIB_MAJOR@ +SND_LIB_MINOR = @SND_LIB_MINOR@ +SND_LIB_SUBMINOR = @SND_LIB_SUBMINOR@ +SND_LIB_VERSION = @SND_LIB_VERSION@ +STRIP = @STRIP@ +SYMBOL_PREFIX = @SYMBOL_PREFIX@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +alsaconfigdir = @ALSA_CONFIG_DIR@ +ucmdir = $(alsaconfigdir)/ucm/PAZ00 +ucm_DATA = PAZ00.conf HiFi.conf Record.conf +EXTRA_DIST = $(ucm_DATA) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/conf/ucm/PAZ00/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/conf/ucm/PAZ00/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-ucmDATA: $(ucm_DATA) + @$(NORMAL_INSTALL) + @list='$(ucm_DATA)'; test -n "$(ucmdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(ucmdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(ucmdir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(ucmdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(ucmdir)" || exit $$?; \ + done + +uninstall-ucmDATA: + @$(NORMAL_UNINSTALL) + @list='$(ucm_DATA)'; test -n "$(ucmdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(ucmdir)'; $(am__uninstall_files_from_dir) +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: + for dir in "$(DESTDIR)$(ucmdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-ucmDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-ucmDATA + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + install-ucmDATA installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-ucmDATA + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/conf/ucm/PAZ00/PAZ00.conf b/src/conf/ucm/PAZ00/PAZ00.conf new file mode 100644 index 0000000..8b9d904 --- /dev/null +++ b/src/conf/ucm/PAZ00/PAZ00.conf @@ -0,0 +1,39 @@ +Comment "PAZ00 alc5632" + +ValueDefaults { + PlaybackCTL "hw:0" + CaptureCTL "hw:0" +} + +SectionDefaults [ + cdev "hw:PAZ00" + + cset "name='Master Playback Switch' on" + cset "name='Master Playback Volume' 44,44" + cset "name='Headphone Playback Volume' 21,21" + cset "name='Speaker Playback Volume' 21,21" + cset "name='SpeakerOut Mux' 2" + cset "name='SpeakerOut N Mux' LN/-R" + cset "name='AB-D Amp Mux' 0" + cset "name='Left Headphone Mux' 1" + cset "name='Right Headphone Mux' 1" + cset "name='DMIC Boost Capture Volume' 4" + cset "name='Rec Capture Volume' 24" + + # Fix external mic record volumes + cset "name='Mic 1 Boost Volume' 0" + cset "name='Mic 2 Boost Volume' 0" + cset "name='Mic1 Playback Volume' 0" + cset "name='Mic2 Playback Volume' 0" + cset "name='Rec Capture Volume' 0" +] + +SectionUseCase."HiFi" { + File "HiFi.conf" + Comment "Music playback" +} + +SectionUseCase."Record" { + File "Record.conf" + Comment "Playback and capture" +} diff --git a/src/conf/ucm/PAZ00/Record.conf b/src/conf/ucm/PAZ00/Record.conf new file mode 100644 index 0000000..568e2fb --- /dev/null +++ b/src/conf/ucm/PAZ00/Record.conf @@ -0,0 +1,65 @@ +SectionVerb { + EnableSequence [ + cdev "hw:PAZ00" + + cset "name='Speaker Playback Switch' on" + cset "name='Int Spk Switch' on" + cset "name='Speaker Mix DAC2SPK Playback Switch' on" + + cset "name='DMICL Mix DMICL2ADC Capture Switch' on" + cset "name='DMIC En Capture Switch' on" + cset "name='DMIC PreFilter Capture Switch' on" + ] + DisableSequence [ + cset "name='Speaker Playback Switch' off" + cset "name='Int Spk Switch' off" + cset "name='Speaker Mix DAC2SPK Playback Switch' off" + + cset "name='DMICL Mix DMICL2ADC Capture Switch' off" + cset "name='DMIC En Capture Switch' off" + cset "name='DMIC PreFilter Capture Switch' off" + ] +} + +SectionDevice."Headset".0 { + Comment "3.5mm Headset" + + Value { + JackName "Paz00 Headset Jack" + } + + EnableSequence [ + cdev "hw:PAZ00" + + # Internal speaker + cset "name='Int Spk Switch' off" + + # Internal mic + cset "name='DMIC En Capture Switch' off" + + # Headphones + cset "name='Headphone Playback Switch' on" + cset "name='HPL Mix DACL2HP Playback Switch' on" + cset "name='HPR Mix DACR2HP Playback Switch' on" + + # External min + cset "name='Left Capture Mix MIC12REC_L Capture Switch' on" + ] + DisableSequence [ + cdev "hw:PAZ00" + + # Headphones + cset "name='Headphone Playback Switch' off" + cset "name='HPL Mix DACL2HP Playback Switch' off" + cset "name='HPR Mix DACR2HP Playback Switch' off" + + # External mic + cset "name='Left Capture Mix MIC12REC_L Capture Switch' on" + + # Internal speaker + cset "name='Int Spk Switch' on" + + # Internal mic + cset "name='DMIC En Capture Switch' on" + ] +} diff --git a/src/control/control.c b/src/control/control.c index d66ed75..4a28cf6 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -213,7 +213,7 @@ int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsign /** * \brief Ask to be informed about events (poll, #snd_async_add_ctl_handler, #snd_ctl_read) * \param ctl CTL handle - * \param subscribe 0 = unsubscribe, 1 = subscribe + * \param subscribe 0 = unsubscribe, 1 = subscribe, -1 = check subscribe or not * \return 0 on success otherwise a negative error code */ int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe) @@ -864,6 +864,7 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, if (err >= 0) { if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) { SNDERR("Invalid type for CTL type %s definition", str); + err = -EINVAL; goto _err; } snd_config_for_each(i, next, type_conf) { diff --git a/src/control/control_shm.c b/src/control/control_shm.c index abab398..40bc705 100644 --- a/src/control/control_shm.c +++ b/src/control/control_shm.c @@ -441,29 +441,6 @@ static int make_local_socket(const char *filename) return sock; } -#if 0 -static int make_inet_socket(const char *host, int port) -{ - struct sockaddr_in addr; - int sock; - struct hostent *h = gethostbyname(host); - if (!h) - return -ENOENT; - - sock = socket(PF_INET, SOCK_STREAM, 0); - if (sock < 0) - return -errno; - - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - memcpy(&addr.sin_addr, h->h_addr_list[0], sizeof(struct in_addr)); - - if (connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) - return -errno; - return sock; -} -#endif - int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname, const char *sname, int mode) { snd_ctl_t *ctl; @@ -565,12 +542,10 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c const char *server = NULL; const char *ctl_name = NULL; snd_config_t *sconfig; - const char *host = NULL; const char *sockname = NULL; long port = -1; int err; - int local; - struct hostent *h; + snd_config_for_each(i, next, conf) { snd_config_t *n = snd_config_iterator_entry(i); const char *id; @@ -624,14 +599,8 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c continue; if (strcmp(id, "comment") == 0) continue; - if (strcmp(id, "host") == 0) { - err = snd_config_get_string(n, &host); - if (err < 0) { - SNDERR("Invalid type for %s", id); - goto _err; - } + if (strcmp(id, "host") == 0) continue; - } if (strcmp(id, "socket") == 0) { err = snd_config_get_string(n, &sockname); if (err < 0) { @@ -653,24 +622,10 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c goto _err; } - if (!host) { - SNDERR("host is not defined"); - goto _err; - } if (!sockname) { SNDERR("socket is not defined"); goto _err; } - h = gethostbyname(host); - if (!h) { - SNDERR("Cannot resolve %s", host); - goto _err; - } - local = snd_is_local(h); - if (!local) { - SNDERR("%s is not the local host", host); - goto _err; - } err = snd_ctl_shm_open(handlep, name, sockname, ctl_name, mode); _err: snd_config_delete(sconfig); diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c index 978977d..8d6c385 100644 --- a/src/control/ctlparse.c +++ b/src/control/ctlparse.c @@ -59,7 +59,7 @@ static long get_integer(const char **ptr, long min, long max) goto out; s = p; - val = strtol(s, &p, 10); + val = strtol(s, &p, 0); if (*p == '.') { p++; strtol(p, &p, 10); @@ -87,7 +87,7 @@ static long long get_integer64(const char **ptr, long long min, long long max) goto out; s = p; - val = strtol(s, &p, 10); + val = strtol(s, &p, 0); if (*p == '.') { p++; strtol(p, &p, 10); diff --git a/src/dlmisc.c b/src/dlmisc.c index 4b8a02c..b36c48f 100644 --- a/src/dlmisc.c +++ b/src/dlmisc.c @@ -177,11 +177,13 @@ void *snd_dlsym(void *handle, const char *name, const char *version) } #endif #ifdef HAVE_LIBDL +#ifdef VERSIONED_SYMBOLS if (version) { err = snd_dlsym_verify(handle, name, version); if (err < 0) return NULL; } +#endif return dlsym(handle, name); #else return NULL; @@ -324,7 +326,6 @@ void snd_dlobj_cache_cleanup(void) free(c); } - unlock: snd_dlobj_unlock(); } #endif diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c index 56e023d..3a79c8e 100644 --- a/src/mixer/mixer.c +++ b/src/mixer/mixer.c @@ -204,10 +204,8 @@ int snd_mixer_attach(snd_mixer_t *mixer, const char *name) if (err < 0) return err; err = snd_mixer_attach_hctl(mixer, hctl); - if (err < 0) { - snd_hctl_close(hctl); + if (err < 0) return err; - } return 0; } @@ -216,6 +214,8 @@ int snd_mixer_attach(snd_mixer_t *mixer, const char *name) * \param mixer Mixer handle * \param hctl the HCTL to be attached * \return 0 on success otherwise a negative error code + * + * Upon error, this function closes the given hctl handle automatically. */ int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl) { @@ -224,8 +224,10 @@ int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl) assert(hctl); slave = calloc(1, sizeof(*slave)); - if (slave == NULL) + if (slave == NULL) { + snd_hctl_close(hctl); return -ENOMEM; + } err = snd_hctl_nonblock(hctl, 1); if (err < 0) { snd_hctl_close(hctl); diff --git a/src/mixer/mixer_simple.h b/src/mixer/mixer_simple.h index 116eebd..f6117da 100644 --- a/src/mixer/mixer_simple.h +++ b/src/mixer/mixer_simple.h @@ -32,9 +32,9 @@ int snd_mixer_simple_none_register(snd_mixer_t *mixer, struct snd_mixer_selem_re #ifdef HAVE_LIBDL int snd_mixer_simple_basic_register(snd_mixer_t *mixer, struct snd_mixer_selem_regopt *options, snd_mixer_class_t **classp); #else -static inline int snd_mixer_simple_basic_register(snd_mixer_t *mixer, - struct snd_mixer_selem_regopt *options, - snd_mixer_class_t **classp) +static inline int snd_mixer_simple_basic_register(snd_mixer_t *mixer ATTRIBUTE_UNUSED, + struct snd_mixer_selem_regopt *options ATTRIBUTE_UNUSED, + snd_mixer_class_t **classp ATTRIBUTE_UNUSED) { return -ENXIO; } diff --git a/src/mixer/simple.c b/src/mixer/simple.c index ec22a9c..fd9ba93 100644 --- a/src/mixer/simple.c +++ b/src/mixer/simple.c @@ -36,6 +36,7 @@ #include #include #include +#include "config.h" #include "mixer_local.h" #include "mixer_simple.h" diff --git a/src/mixer/simple_abst.c b/src/mixer/simple_abst.c index 9e9aaf5..5297472 100644 --- a/src/mixer/simple_abst.c +++ b/src/mixer/simple_abst.c @@ -70,6 +70,8 @@ static int try_open(snd_mixer_class_t *class, const char *lib) void *h; int err = 0; + if (!lib) + return -ENXIO; path = getenv("ALSA_MIXER_SIMPLE_MODULES"); if (!path) path = SO_PATH; diff --git a/src/mixer/simple_none.c b/src/mixer/simple_none.c index 1c2774a..4e55660 100644 --- a/src/mixer/simple_none.c +++ b/src/mixer/simple_none.c @@ -39,8 +39,8 @@ #include #include #include -#include "mixer_simple.h" #include "config.h" +#include "mixer_simple.h" #ifndef DOC_HIDDEN diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 7e46014..e74e02f 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -897,6 +897,7 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params) if (err < 0) return err; pcm->tstamp_mode = params->tstamp_mode; + pcm->tstamp_type = params->tstamp_type; pcm->period_step = params->period_step; pcm->avail_min = params->avail_min; pcm->period_event = sw_get_period_event(params); @@ -1483,6 +1484,7 @@ int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsign #define XRUN(v) [SND_PCM_XRUN_##v] = #v #define SILENCE(v) [SND_PCM_SILENCE_##v] = #v #define TSTAMP(v) [SND_PCM_TSTAMP_##v] = #v +#define TSTAMP_TYPE(v) [SND_PCM_TSTAMP_TYPE_##v] = #v #define ACCESS(v) [SND_PCM_ACCESS_##v] = #v #define START(v) [SND_PCM_START_##v] = #v #define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v @@ -1564,6 +1566,9 @@ static const char *const snd_pcm_format_names[] = { FORMAT(G723_40_1B), FORMAT(DSD_U8), FORMAT(DSD_U16_LE), + FORMAT(DSD_U32_LE), + FORMAT(DSD_U16_BE), + FORMAT(DSD_U32_BE), }; static const char *const snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = { @@ -1623,6 +1628,9 @@ static const char *const snd_pcm_format_descriptions[] = { FORMATD(G723_40_1B, "G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte"), FORMATD(DSD_U8, "Direct Stream Digital, 1-byte (x8), oldest bit in MSB"), FORMATD(DSD_U16_LE, "Direct Stream Digital, 2-byte (x16), little endian, oldest bits in MSB"), + FORMATD(DSD_U32_LE, "Direct Stream Digital, 4-byte (x32), little endian, oldest bits in MSB"), + FORMATD(DSD_U16_BE, "Direct Stream Digital, 2-byte (x16), big endian, oldest bits in MSB"), + FORMATD(DSD_U32_BE, "Direct Stream Digital, 4-byte (x32), big endian, oldest bits in MSB"), }; static const char *const snd_pcm_type_names[] = { @@ -1680,6 +1688,12 @@ static const char *const snd_pcm_tstamp_mode_names[] = { TSTAMP(NONE), TSTAMP(ENABLE), }; + +static const char *const snd_pcm_tstamp_type_names[] = { + TSTAMP_TYPE(GETTIMEOFDAY), + TSTAMP_TYPE(MONOTONIC), + TSTAMP_TYPE(MONOTONIC_RAW), +}; #endif /** @@ -1826,6 +1840,18 @@ const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode) } /** + * \brief get name of PCM tstamp type setting + * \param mode PCM tstamp type + * \return ascii name of PCM tstamp type setting + */ +const char *snd_pcm_tstamp_type_name(snd_pcm_tstamp_type_t type) +{ + if (type > SND_PCM_TSTAMP_TYPE_LAST) + return NULL; + return snd_pcm_tstamp_type_names[type]; +} + +/** * \brief get name of PCM state * \param state PCM state * \return ascii name of PCM state @@ -1899,6 +1925,7 @@ int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out) return -EIO; } snd_output_printf(out, " tstamp_mode : %s\n", snd_pcm_tstamp_mode_name(pcm->tstamp_mode)); + snd_output_printf(out, " tstamp_type : %s\n", snd_pcm_tstamp_type_name(pcm->tstamp_type)); snd_output_printf(out, " period_step : %d\n", pcm->period_step); snd_output_printf(out, " avail_min : %ld\n", pcm->avail_min); snd_output_printf(out, " period_event : %i\n", pcm->period_event); @@ -2123,6 +2150,7 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, if (err >= 0) { if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) { SNDERR("Invalid type for PCM type %s definition", str); + err = -EINVAL; goto _err; } snd_config_for_each(i, next, type_conf) { @@ -5590,7 +5618,9 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params) SNDMSG("PCM not set up"); return -EIO; } + 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; @@ -5613,6 +5643,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params) int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out) { snd_output_printf(out, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(params->tstamp_mode)); + snd_output_printf(out, "tstamp_type: %s\n", snd_pcm_tstamp_type_name(params->tstamp_type)); snd_output_printf(out, "period_step: %u\n", params->period_step); snd_output_printf(out, "avail_min: %lu\n", params->avail_min); snd_output_printf(out, "start_threshold: %ld\n", params->start_threshold); @@ -5811,6 +5842,37 @@ int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm } /** + * \brief Set timestamp type inside a software configuration container + * \param pcm PCM handle + * \param params Software configuration container + * \param val Timestamp type + * \return 0 otherwise a negative error code + */ +int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t val) +{ + assert(pcm && params); + if (CHECK_SANITY(val > SND_PCM_TSTAMP_TYPE_LAST)) { + SNDMSG("invalid tstamp_type value %d", val); + return -EINVAL; + } + params->tstamp_type = val; + return 0; +} + +/** + * \brief Get timestamp type from a software configuration container + * \param params Software configuration container + * \param val Returned timestamp type + * \return 0 otherwise a negative error code + */ +int snd_pcm_sw_params_get_tstamp_type(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t *val) +{ + assert(params && val); + *val = params->tstamp_type; + return 0; +} + +/** * \brief (DEPRECATED) Set minimum number of ticks to sleep inside a software configuration container * \param pcm PCM handle * \param params Software configuration container @@ -7559,7 +7621,7 @@ int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf) return -ENOMEM; } if (map->pos[i] & SND_CHMAP_DRIVER_SPEC) - len += snprintf(buf + len, maxlen, "%d", p); + len += snprintf(buf + len, maxlen - len, "%d", p); else { const char *name = chmap_names[p]; if (name) diff --git a/src/pcm/pcm_adpcm.c b/src/pcm/pcm_adpcm.c index 6f0e7c4..1a83c5a 100644 --- a/src/pcm/pcm_adpcm.c +++ b/src/pcm/pcm_adpcm.c @@ -579,7 +579,7 @@ int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor pcm->private_data = adpcm; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &adpcm->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &adpcm->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_alaw.c b/src/pcm/pcm_alaw.c index 1b1bab8..db759e3 100644 --- a/src/pcm/pcm_alaw.c +++ b/src/pcm/pcm_alaw.c @@ -453,7 +453,7 @@ int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sform pcm->private_data = alaw; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &alaw->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &alaw->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_copy.c b/src/pcm/pcm_copy.c index 56a1f6b..66d3a47 100644 --- a/src/pcm/pcm_copy.c +++ b/src/pcm/pcm_copy.c @@ -209,7 +209,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int pcm->private_data = copy; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, ©->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, ©->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c index 5416cf7..195fddf 100644 --- a/src/pcm/pcm_direct.c +++ b/src/pcm/pcm_direct.c @@ -840,6 +840,7 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm) COPY_SLAVE(period_time); COPY_SLAVE(periods); COPY_SLAVE(tstamp_mode); + COPY_SLAVE(tstamp_type); COPY_SLAVE(period_step); COPY_SLAVE(avail_min); COPY_SLAVE(start_threshold); @@ -857,7 +858,6 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm) COPY_SLAVE(buffer_time); COPY_SLAVE(sample_bits); COPY_SLAVE(frame_bits); - COPY_SLAVE(monotonic); } #undef COPY_SLAVE @@ -1148,6 +1148,7 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix) dmix->timer_events = (1<info &= ~SND_PCM_INFO_PAUSE; spcm->boundary = recalc_boundary_size(dmix->shmptr->s.boundary, spcm->buffer_size); diff --git a/src/pcm/pcm_direct.h b/src/pcm/pcm_direct.h index 5ae39c0..9b1ddbc 100644 --- a/src/pcm/pcm_direct.h +++ b/src/pcm/pcm_direct.h @@ -85,8 +85,8 @@ typedef struct { unsigned int period_size; unsigned int period_time; snd_interval_t periods; - unsigned int monotonic; snd_pcm_tstamp_t tstamp_mode; + snd_pcm_tstamp_type_t tstamp_type; unsigned int period_step; unsigned int sleep_min; /* not used */ unsigned int avail_min; diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index 4aa6d4e..babde6a 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -428,7 +428,7 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm) dmix->avail_max = avail; if (avail >= pcm->stop_threshold) { snd_timer_stop(dmix->timer); - gettimestamp(&dmix->trigger_tstamp, pcm->monotonic); + gettimestamp(&dmix->trigger_tstamp, pcm->tstamp_type); if (dmix->state == SND_PCM_STATE_RUNNING) { dmix->state = SND_PCM_STATE_XRUN; return -EPIPE; @@ -477,7 +477,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status) memset(status, 0, sizeof(*status)); status->state = snd_pcm_dmix_state(pcm); status->trigger_tstamp = dmix->trigger_tstamp; - gettimestamp(&status->tstamp, pcm->monotonic); + gettimestamp(&status->tstamp, pcm->tstamp_type); status->avail = snd_pcm_mmap_playback_avail(pcm); status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max; dmix->avail_max = 0; @@ -596,7 +596,7 @@ static int snd_pcm_dmix_start(snd_pcm_t *pcm) return err; snd_pcm_dmix_sync_area(pcm); } - gettimestamp(&dmix->trigger_tstamp, pcm->monotonic); + gettimestamp(&dmix->trigger_tstamp, pcm->tstamp_type); return 0; } @@ -661,7 +661,7 @@ static int snd_pcm_dmix_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTRIB static snd_pcm_sframes_t snd_pcm_dmix_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_hw_avail(pcm); + return snd_pcm_mmap_playback_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_dmix_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) @@ -669,11 +669,15 @@ static snd_pcm_sframes_t snd_pcm_dmix_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_uframes_t slave_appl_ptr, slave_size; snd_pcm_uframes_t appl_ptr, size, transfer, result; + int err; const snd_pcm_channel_area_t *src_areas, *dst_areas; if (dmix->state == SND_PCM_STATE_RUNNING || - dmix->state == SND_PCM_STATE_DRAINING) - return snd_pcm_dmix_hwsync(pcm); + dmix->state == SND_PCM_STATE_DRAINING) { + err = snd_pcm_dmix_hwsync(pcm); + if (err < 0) + return err; + } if (dmix->last_appl_ptr < dmix->appl_ptr) size = dmix->appl_ptr - dmix->last_appl_ptr; @@ -747,9 +751,7 @@ static snd_pcm_sframes_t snd_pcm_dmix_forward(snd_pcm_t *pcm, snd_pcm_uframes_t { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_playback_avail(pcm); - if (avail < 0) - return 0; + avail = snd_pcm_dmix_forwardable(pcm); if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_forward(pcm, frames); @@ -1104,7 +1106,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, pcm->poll_fd = dmix->poll_fd; pcm->poll_events = POLLIN; /* it's different than other plugins */ - pcm->monotonic = spcm->monotonic; + pcm->tstamp_type = spcm->tstamp_type; pcm->mmap_rw = 1; snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0); diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c index f2d1103..020e6f7 100644 --- a/src/pcm/pcm_dshare.c +++ b/src/pcm/pcm_dshare.c @@ -195,7 +195,7 @@ static int snd_pcm_dshare_sync_ptr(snd_pcm_t *pcm) dshare->avail_max = avail; if (avail >= pcm->stop_threshold) { snd_timer_stop(dshare->timer); - gettimestamp(&dshare->trigger_tstamp, pcm->monotonic); + gettimestamp(&dshare->trigger_tstamp, pcm->tstamp_type); if (dshare->state == SND_PCM_STATE_RUNNING) { dshare->state = SND_PCM_STATE_XRUN; return -EPIPE; @@ -226,7 +226,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status) memset(status, 0, sizeof(*status)); status->state = snd_pcm_state(dshare->spcm); status->trigger_tstamp = dshare->trigger_tstamp; - gettimestamp(&status->tstamp, pcm->monotonic); + gettimestamp(&status->tstamp, pcm->tstamp_type); status->avail = snd_pcm_mmap_playback_avail(pcm); status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max; dshare->avail_max = 0; @@ -346,7 +346,7 @@ static int snd_pcm_dshare_start(snd_pcm_t *pcm) return err; snd_pcm_dshare_sync_area(pcm); } - gettimestamp(&dshare->trigger_tstamp, pcm->monotonic); + gettimestamp(&dshare->trigger_tstamp, pcm->tstamp_type); return 0; } @@ -412,16 +412,14 @@ static int snd_pcm_dshare_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTR static snd_pcm_sframes_t snd_pcm_dshare_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_playback_hw_avail(pcm); + return snd_pcm_mmap_playback_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_dshare_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_playback_hw_avail(pcm); - if (avail < 0) - return 0; + avail = snd_pcm_dshare_rewindable(pcm); if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_backward(pcm, frames); @@ -437,9 +435,7 @@ static snd_pcm_sframes_t snd_pcm_dshare_forward(snd_pcm_t *pcm, snd_pcm_uframes_ { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_playback_avail(pcm); - if (avail < 0) - return 0; + avail = snd_pcm_dshare_forwardable(pcm); if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_forward(pcm, frames); @@ -792,7 +788,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, pcm->poll_fd = dshare->poll_fd; pcm->poll_events = POLLIN; /* it's different than other plugins */ - pcm->monotonic = spcm->monotonic; + pcm->tstamp_type = spcm->tstamp_type; pcm->mmap_rw = 1; snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0); diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index 7637914..8333eef 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -159,7 +159,7 @@ static int snd_pcm_dsnoop_sync_ptr(snd_pcm_t *pcm) if (pcm->stop_threshold >= pcm->boundary) /* don't care */ return 0; if ((avail = snd_pcm_mmap_capture_hw_avail(pcm)) >= pcm->stop_threshold) { - gettimestamp(&dsnoop->trigger_tstamp, pcm->monotonic); + gettimestamp(&dsnoop->trigger_tstamp, pcm->tstamp_type); dsnoop->state = SND_PCM_STATE_XRUN; dsnoop->avail_max = avail; return -EPIPE; @@ -335,16 +335,14 @@ static int snd_pcm_dsnoop_pause(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int enable ATTR static snd_pcm_sframes_t snd_pcm_dsnoop_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_capture_avail(pcm); + return snd_pcm_mmap_capture_hw_avail(pcm); } static snd_pcm_sframes_t snd_pcm_dsnoop_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_capture_avail(pcm); - if (avail < 0) - return 0; + avail = snd_pcm_dsnoop_rewindable(pcm); if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_backward(pcm, frames); @@ -353,16 +351,14 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t static snd_pcm_sframes_t snd_pcm_dsnoop_forwardable(snd_pcm_t *pcm) { - return snd_pcm_mmap_capture_hw_avail(pcm); + return snd_pcm_mmap_capture_avail(pcm); } static snd_pcm_sframes_t snd_pcm_dsnoop_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { snd_pcm_sframes_t avail; - avail = snd_pcm_mmap_capture_hw_avail(pcm); - if (avail < 0) - return 0; + avail = snd_pcm_dsnoop_forwardable(pcm); if (frames > (snd_pcm_uframes_t)avail) frames = avail; snd_pcm_mmap_appl_forward(pcm, frames); @@ -690,7 +686,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, pcm->poll_fd = dsnoop->poll_fd; pcm->poll_events = POLLIN; /* it's different than other plugins */ - pcm->monotonic = spcm->monotonic; + pcm->tstamp_type = spcm->tstamp_type; pcm->mmap_rw = 1; snd_pcm_set_hw_ptr(pcm, &dsnoop->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dsnoop->appl_ptr, -1, 0); diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index b139f7f..9ab6964 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -454,7 +454,7 @@ static int snd_pcm_file_drain(snd_pcm_t *pcm) static snd_pcm_sframes_t snd_pcm_file_rewindable(snd_pcm_t *pcm) { snd_pcm_file_t *file = pcm->private_data; - snd_pcm_sframes_t res = snd_pcm_rewindable(pcm); + snd_pcm_sframes_t res = snd_pcm_rewindable(file->gen.slave); snd_pcm_sframes_t n = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes); if (res > n) res = n; @@ -482,7 +482,7 @@ static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f static snd_pcm_sframes_t snd_pcm_file_forwardable(snd_pcm_t *pcm) { snd_pcm_file_t *file = pcm->private_data; - snd_pcm_sframes_t res = snd_pcm_forwardable(pcm); + snd_pcm_sframes_t res = snd_pcm_forwardable(file->gen.slave); snd_pcm_sframes_t n = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes); if (res > n) res = n; @@ -758,6 +758,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, ifd = open(ifname, O_RDONLY); /* TODO: mind blocking mode */ if (ifd < 0) { SYSERR("open %s for reading failed", ifname); + free(file->fname); free(file); return -errno; } @@ -772,6 +773,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, err = snd_pcm_new(&pcm, SND_PCM_TYPE_FILE, name, slave->stream, slave->mode); if (err < 0) { free(file->fname); + free(file->ifname); free(file); return err; } @@ -781,10 +783,10 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; pcm->mmap_shadow = 1; + pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY; #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) - pcm->monotonic = clock_gettime(CLOCK_MONOTONIC, ×pec) == 0; -#else - pcm->monotonic = 0; + if (clock_gettime(CLOCK_MONOTONIC, ×pec) == 0) + pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC; #endif pcm->stream = stream; snd_pcm_link_hw_ptr(pcm, slave); diff --git a/src/pcm/pcm_generic.c b/src/pcm/pcm_generic.c index f068ee2..9b60591 100644 --- a/src/pcm/pcm_generic.c +++ b/src/pcm/pcm_generic.c @@ -294,7 +294,7 @@ int snd_pcm_generic_real_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, if (ok && (snd_pcm_uframes_t)avail1 == *avail) break; *avail = avail1; - gettimestamp(tstamp, pcm->monotonic); + gettimestamp(tstamp, pcm->tstamp_type); ok = 1; } return 0; diff --git a/src/pcm/pcm_hooks.c b/src/pcm/pcm_hooks.c index f837282..ce1cf36 100644 --- a/src/pcm/pcm_hooks.c +++ b/src/pcm/pcm_hooks.c @@ -240,7 +240,7 @@ int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; pcm->mmap_shadow = 1; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_link_hw_ptr(pcm, slave); snd_pcm_link_appl_ptr(pcm, slave); *pcmp = pcm; @@ -457,7 +457,8 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_ err = hook_add_dlobj(pcm, h); if (err < 0) { - snd_dlclose(h); + if(h) + snd_dlclose(h); return err; } return 0; diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index ed83197..c34b766 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -304,7 +304,8 @@ static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) if (params->info != ~0U) { params->info &= ~0xf0000000; - params->info |= (pcm->monotonic ? SND_PCM_INFO_MONOTONIC : 0); + if (pcm->tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY) + params->info |= SND_PCM_INFO_MONOTONIC; } return 0; @@ -328,7 +329,8 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) return err; } params->info &= ~0xf0000000; - params->info |= (pcm->monotonic ? SND_PCM_INFO_MONOTONIC : 0); + if (pcm->tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY) + params->info |= SND_PCM_INFO_MONOTONIC; err = sync_ptr(hw, 0); if (err < 0) return err; @@ -435,6 +437,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params) int old_period_event = sw_get_period_event(params); sw_set_period_event(params, 0); if ((snd_pcm_tstamp_t) params->tstamp_mode == pcm->tstamp_mode && + (snd_pcm_tstamp_type_t) params->tstamp_type == pcm->tstamp_type && params->period_step == pcm->period_step && params->start_threshold == pcm->start_threshold && params->stop_threshold == pcm->stop_threshold && @@ -444,11 +447,33 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params) hw->mmap_control->avail_min = params->avail_min; return sync_ptr(hw, 0); } + if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW && + hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) { + SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW"); + return -EINVAL; + } + if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC && + hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 5)) { + SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC"); + return -EINVAL; + } if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) { err = -errno; SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err); return err; } + if ((snd_pcm_tstamp_type_t) params->tstamp_type != pcm->tstamp_type) { + if (hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) { + int on = (snd_pcm_tstamp_type_t) params->tstamp_type == + SND_PCM_TSTAMP_TYPE_MONOTONIC; + if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) { + err = -errno; + SNDMSG("TSTAMP failed\n"); + return err; + } + } + pcm->tstamp_type = params->tstamp_type; + } sw_set_period_event(params, old_period_event); hw->mmap_control->avail_min = params->avail_min; if (hw->period_event != old_period_event) { @@ -634,7 +659,7 @@ static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable) static snd_pcm_sframes_t snd_pcm_hw_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_hw_avail(pcm); + return snd_pcm_mmap_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) @@ -1381,7 +1406,8 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd, int mmap_emulation ATTRIBUTE_UNUSED, int sync_ptr_ioctl) { - int ver, mode, monotonic = 0; + int ver, mode; + snd_pcm_tstamp_type_t tstamp_type = SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY; long fmode; snd_pcm_t *pcm = NULL; snd_pcm_hw_t *hw = NULL; @@ -1429,7 +1455,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, SNDMSG("TTSTAMP failed\n"); return ret; } - monotonic = 1; + tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC; } } else #endif @@ -1471,7 +1497,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, pcm->private_data = hw; pcm->poll_fd = fd; pcm->poll_events = info.stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN; - pcm->monotonic = monotonic; + pcm->tstamp_type = tstamp_type; ret = snd_pcm_hw_mmap_status(pcm); if (ret < 0) { diff --git a/src/pcm/pcm_iec958.c b/src/pcm/pcm_iec958.c index 0c61fc1..38c4ce7 100644 --- a/src/pcm/pcm_iec958.c +++ b/src/pcm/pcm_iec958.c @@ -534,7 +534,7 @@ int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo pcm->private_data = iec; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &iec->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &iec->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c index c1c3a98..fe9347c 100644 --- a/src/pcm/pcm_ioplug.c +++ b/src/pcm/pcm_ioplug.c @@ -448,7 +448,7 @@ static int snd_pcm_ioplug_start(snd_pcm_t *pcm) if (err < 0) return err; - gettimestamp(&io->trigger_tstamp, pcm->monotonic); + gettimestamp(&io->trigger_tstamp, pcm->tstamp_type); io->data->state = SND_PCM_STATE_RUNNING; return 0; @@ -463,7 +463,7 @@ static int snd_pcm_ioplug_drop(snd_pcm_t *pcm) io->data->callback->stop(io->data); - gettimestamp(&io->trigger_tstamp, pcm->monotonic); + gettimestamp(&io->trigger_tstamp, pcm->tstamp_type); io->data->state = SND_PCM_STATE_SETUP; return 0; @@ -503,7 +503,7 @@ static int snd_pcm_ioplug_pause(snd_pcm_t *pcm, int enable) static snd_pcm_sframes_t snd_pcm_ioplug_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_hw_avail(pcm); + return snd_pcm_mmap_hw_rewindable(pcm); } static snd_pcm_sframes_t snd_pcm_ioplug_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) @@ -1069,7 +1069,10 @@ int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug) { ioplug->pcm->poll_fd = ioplug->poll_fd; ioplug->pcm->poll_events = ioplug->poll_events; - ioplug->pcm->monotonic = (ioplug->flags & SND_PCM_IOPLUG_FLAG_MONOTONIC) != 0; + if (ioplug->flags & SND_PCM_IOPLUG_FLAG_MONOTONIC) + ioplug->pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC; + else + ioplug->pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY; ioplug->pcm->mmap_rw = ioplug->mmap_rw; return 0; } diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c index 7d1e3df..631ee0f 100644 --- a/src/pcm/pcm_ladspa.c +++ b/src/pcm/pcm_ladspa.c @@ -1641,7 +1641,7 @@ int snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name, pcm->private_data = ladspa; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &ladspa->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &ladspa->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_lfloat.c b/src/pcm/pcm_lfloat.c index bbf72c2..2f3e578 100644 --- a/src/pcm/pcm_lfloat.c +++ b/src/pcm/pcm_lfloat.c @@ -286,11 +286,11 @@ static int snd_pcm_lfloat_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format); } if (snd_pcm_format_linear(src_format)) { - lfloat->int32_idx = snd_pcm_linear_get32_index(src_format, SND_PCM_FORMAT_S32); + lfloat->int32_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S32); lfloat->float32_idx = snd_pcm_lfloat_put_s32_index(dst_format); lfloat->func = snd_pcm_lfloat_convert_integer_float; } else { - lfloat->int32_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format); + lfloat->int32_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, dst_format); lfloat->float32_idx = snd_pcm_lfloat_get_s32_index(src_format); lfloat->func = snd_pcm_lfloat_convert_float_integer; } @@ -412,7 +412,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo pcm->private_data = lfloat; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &lfloat->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &lfloat->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c index 7aa8941..9a92abd 100644 --- a/src/pcm/pcm_linear.c +++ b/src/pcm/pcm_linear.c @@ -107,11 +107,6 @@ int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_f } } -int snd_pcm_linear_get32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format) -{ - return snd_pcm_linear_get_index(src_format, dst_format); -} - int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format) { int sign, width, pwidth, endian; @@ -143,37 +138,6 @@ int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_f } } -int snd_pcm_linear_put32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format) -{ - int sign, width, pwidth, endian; - sign = (snd_pcm_format_signed(src_format) != - snd_pcm_format_signed(dst_format)); -#ifdef SND_LITTLE_ENDIAN - endian = snd_pcm_format_big_endian(dst_format); -#else - endian = snd_pcm_format_little_endian(dst_format); -#endif - if (endian < 0) - endian = 0; - pwidth = snd_pcm_format_physical_width(dst_format); - width = snd_pcm_format_width(dst_format); - if (pwidth == 24) { - switch (width) { - case 24: - width = 0; break; - case 20: - width = 1; break; - case 18: - default: - width = 2; break; - } - return width * 4 + endian * 2 + sign + 16; - } else { - width = width / 8 - 1; - return width * 4 + endian * 2 + sign; - } -} - void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset, const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset, unsigned int channels, snd_pcm_uframes_t frames, @@ -342,11 +306,11 @@ static int snd_pcm_linear_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) snd_pcm_format_physical_width(linear->sformat) == 24); if (linear->use_getput) { if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { - linear->get_idx = snd_pcm_linear_get32_index(format, SND_PCM_FORMAT_S32); - linear->put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, linear->sformat); + linear->get_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S32); + linear->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, linear->sformat); } else { - linear->get_idx = snd_pcm_linear_get32_index(linear->sformat, SND_PCM_FORMAT_S32); - linear->put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, format); + linear->get_idx = snd_pcm_linear_get_index(linear->sformat, SND_PCM_FORMAT_S32); + linear->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, format); } } else { if (pcm->stream == SND_PCM_STREAM_PLAYBACK) @@ -484,7 +448,7 @@ int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo pcm->private_data = linear; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &linear->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &linear->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 8a6c743..394505f 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #define _snd_mask sndrv_mask @@ -191,7 +192,6 @@ struct _snd_pcm { int poll_fd; unsigned short poll_events; int setup: 1, - monotonic: 1, compat: 1; snd_pcm_access_t access; /* access mode */ snd_pcm_format_t format; /* SND_PCM_FORMAT_* */ @@ -202,6 +202,7 @@ struct _snd_pcm { unsigned int period_time; /* period duration */ snd_interval_t periods; snd_pcm_tstamp_t tstamp_mode; /* timestamp mode */ + snd_pcm_tstamp_type_t tstamp_type; /* timestamp type */ unsigned int period_step; snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ int period_event; @@ -460,13 +461,25 @@ static inline snd_pcm_sframes_t snd_pcm_mmap_capture_hw_avail(snd_pcm_t *pcm) static inline snd_pcm_sframes_t snd_pcm_mmap_hw_avail(snd_pcm_t *pcm) { - snd_pcm_sframes_t avail; - avail = *pcm->hw.ptr - *pcm->appl.ptr; - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) - avail += pcm->buffer_size; - if (avail < 0) - avail += pcm->boundary; - return pcm->buffer_size - avail; + return pcm->buffer_size - snd_pcm_mmap_avail(pcm); +} + +static inline snd_pcm_sframes_t snd_pcm_mmap_playback_hw_rewindable(snd_pcm_t *pcm) +{ + snd_pcm_sframes_t ret = snd_pcm_mmap_playback_hw_avail(pcm); + return (ret >= 0) ? ret : 0; +} + +static inline snd_pcm_sframes_t snd_pcm_mmap_capture_hw_rewindable(snd_pcm_t *pcm) +{ + snd_pcm_sframes_t ret = snd_pcm_mmap_capture_hw_avail(pcm); + return (ret >= 0) ? ret : 0; +} + +static inline snd_pcm_uframes_t snd_pcm_mmap_hw_rewindable(snd_pcm_t *pcm) +{ + snd_pcm_sframes_t ret = snd_pcm_mmap_hw_avail(pcm); + return (ret >= 0) ? ret : 0; } static inline const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm) @@ -959,26 +972,40 @@ typedef union snd_tmp_double { } snd_tmp_double_t; /* get the current timestamp */ -static inline void gettimestamp(snd_htimestamp_t *tstamp, int monotonic) +#ifdef HAVE_CLOCK_GETTIME +static inline void gettimestamp(snd_htimestamp_t *tstamp, + snd_pcm_tstamp_type_t tstamp_type) { -#if defined(HAVE_CLOCK_GETTIME) -#if defined(CLOCK_MONOTONIC) - if (monotonic) { - clock_gettime(CLOCK_MONOTONIC, tstamp); - } else { -#endif - clock_gettime(CLOCK_REALTIME, tstamp); -#else - struct timeval tv; + clockid_t id; - gettimeofday(&tv, 0); - tstamp->tv_sec = tv.tv_sec; - tstamp->tv_nsec = tv.tv_usec * 1000L; + switch (tstamp_type) { +#ifdef CLOCK_MONOTONIC_RAW + case SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW: + id = CLOCK_MONOTONIC_RAW; + break; #endif -#if defined(HAVE_CLOCK_GETTIME) - } +#ifdef CLOCK_MONOTONIC + case SND_PCM_TSTAMP_TYPE_MONOTONIC: + id = CLOCK_MONOTONIC; + break; #endif + default: + id = CLOCK_REALTIME; + break; + } + clock_gettime(id, tstamp); +} +#else /* HAVE_CLOCK_GETTIME */ +static inline void gettimestamp(snd_htimestamp_t *tstamp, + snd_pcm_tstamp_type_t tstamp_type) +{ + struct timeval tv; + + gettimeofday(&tv, 0); + tstamp->tv_sec = tv.tv_sec; + tstamp->tv_nsec = tv.tv_usec * 1000L; } +#endif /* HAVE_CLOCK_GETTIME */ snd_pcm_chmap_query_t ** _snd_pcm_make_single_query_chmaps(const snd_pcm_chmap_t *src); diff --git a/src/pcm/pcm_meter.c b/src/pcm/pcm_meter.c index 676fbef..034f582 100644 --- a/src/pcm/pcm_meter.c +++ b/src/pcm/pcm_meter.c @@ -591,7 +591,7 @@ int snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, unsigned int frequenc pcm->private_data = meter; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_link_hw_ptr(pcm, slave); snd_pcm_link_appl_ptr(pcm, slave); *pcmp = pcm; diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c index d52160c..5870f82 100644 --- a/src/pcm/pcm_misc.c +++ b/src/pcm/pcm_misc.c @@ -62,6 +62,11 @@ int snd_pcm_format_signed(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_U20_3BE: case SNDRV_PCM_FORMAT_U18_3LE: case SNDRV_PCM_FORMAT_U18_3BE: + case SNDRV_PCM_FORMAT_DSD_U8: + case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: + case SNDRV_PCM_FORMAT_DSD_U16_BE: + case SNDRV_PCM_FORMAT_DSD_U32_BE: return 0; default: return -EINVAL; @@ -134,6 +139,8 @@ int snd_pcm_format_little_endian(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_U24_3LE: case SNDRV_PCM_FORMAT_U20_3LE: case SNDRV_PCM_FORMAT_U18_3LE: + case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: return 1; case SNDRV_PCM_FORMAT_S16_BE: case SNDRV_PCM_FORMAT_U16_BE: @@ -150,6 +157,8 @@ int snd_pcm_format_little_endian(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_U24_3BE: case SNDRV_PCM_FORMAT_U20_3BE: case SNDRV_PCM_FORMAT_U18_3BE: + case SNDRV_PCM_FORMAT_DSD_U16_BE: + case SNDRV_PCM_FORMAT_DSD_U32_BE: return 0; default: return -EINVAL; @@ -195,11 +204,14 @@ int snd_pcm_format_width(snd_pcm_format_t format) switch (format) { case SNDRV_PCM_FORMAT_S8: case SNDRV_PCM_FORMAT_U8: + case SNDRV_PCM_FORMAT_DSD_U8: return 8; case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_BE: case SNDRV_PCM_FORMAT_U16_LE: case SNDRV_PCM_FORMAT_U16_BE: + case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U16_BE: return 16; case SNDRV_PCM_FORMAT_S18_3LE: case SNDRV_PCM_FORMAT_S18_3BE: @@ -226,6 +238,8 @@ int snd_pcm_format_width(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_U32_BE: case SNDRV_PCM_FORMAT_FLOAT_LE: case SNDRV_PCM_FORMAT_FLOAT_BE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: + case SNDRV_PCM_FORMAT_DSD_U32_BE: return 32; case SNDRV_PCM_FORMAT_FLOAT64_LE: case SNDRV_PCM_FORMAT_FLOAT64_BE: @@ -253,11 +267,14 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format) switch (format) { case SNDRV_PCM_FORMAT_S8: case SNDRV_PCM_FORMAT_U8: + case SNDRV_PCM_FORMAT_DSD_U8: return 8; case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_BE: case SNDRV_PCM_FORMAT_U16_LE: case SNDRV_PCM_FORMAT_U16_BE: + case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U16_BE: return 16; case SNDRV_PCM_FORMAT_S18_3LE: case SNDRV_PCM_FORMAT_S18_3BE: @@ -284,6 +301,8 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format) case SNDRV_PCM_FORMAT_FLOAT_BE: case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE: case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: + case SNDRV_PCM_FORMAT_DSD_U32_BE: return 32; case SNDRV_PCM_FORMAT_FLOAT64_LE: case SNDRV_PCM_FORMAT_FLOAT64_BE: @@ -309,11 +328,14 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples) switch (format) { case SNDRV_PCM_FORMAT_S8: case SNDRV_PCM_FORMAT_U8: + case SNDRV_PCM_FORMAT_DSD_U8: return samples; case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_BE: case SNDRV_PCM_FORMAT_U16_LE: case SNDRV_PCM_FORMAT_U16_BE: + case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U16_BE: return samples * 2; case SNDRV_PCM_FORMAT_S18_3LE: case SNDRV_PCM_FORMAT_S18_3BE: @@ -338,6 +360,8 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples) case SNDRV_PCM_FORMAT_U32_BE: case SNDRV_PCM_FORMAT_FLOAT_LE: case SNDRV_PCM_FORMAT_FLOAT_BE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: + case SNDRV_PCM_FORMAT_DSD_U32_BE: return samples * 4; case SNDRV_PCM_FORMAT_FLOAT64_LE: case SNDRV_PCM_FORMAT_FLOAT64_BE: @@ -382,6 +406,12 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) return 0; case SNDRV_PCM_FORMAT_U8: return 0x8080808080808080ULL; + case SNDRV_PCM_FORMAT_DSD_U8: + case SNDRV_PCM_FORMAT_DSD_U16_LE: + case SNDRV_PCM_FORMAT_DSD_U32_LE: + case SNDRV_PCM_FORMAT_DSD_U16_BE: + case SNDRV_PCM_FORMAT_DSD_U32_BE: + return 0x6969696969696969ULL; #ifdef SNDRV_LITTLE_ENDIAN case SNDRV_PCM_FORMAT_U16_LE: return 0x8000800080008000ULL; diff --git a/src/pcm/pcm_mmap_emul.c b/src/pcm/pcm_mmap_emul.c index 63789bc..b2b15ef 100644 --- a/src/pcm/pcm_mmap_emul.c +++ b/src/pcm/pcm_mmap_emul.c @@ -428,7 +428,7 @@ int __snd_pcm_mmap_emul_open(snd_pcm_t **pcmp, const char *name, pcm->private_data = map; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &map->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &map->appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_mulaw.c b/src/pcm/pcm_mulaw.c index 7adce38..011b2a5 100644 --- a/src/pcm/pcm_mulaw.c +++ b/src/pcm/pcm_mulaw.c @@ -467,7 +467,7 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor pcm->private_data = mulaw; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &mulaw->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &mulaw->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index a84e0ce..4b8299e 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -1077,7 +1077,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, pcm->private_data = multi; pcm->poll_fd = multi->slaves[master_slave].pcm->poll_fd; pcm->poll_events = multi->slaves[master_slave].pcm->poll_events; - pcm->monotonic = multi->slaves[master_slave].pcm->monotonic; + pcm->tstamp_type = multi->slaves[master_slave].pcm->tstamp_type; snd_pcm_link_hw_ptr(pcm, multi->slaves[master_slave].pcm); snd_pcm_link_appl_ptr(pcm, multi->slaves[master_slave].pcm); *pcmp = pcm; diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c index 655261f..0529820 100644 --- a/src/pcm/pcm_null.c +++ b/src/pcm/pcm_null.c @@ -86,10 +86,7 @@ static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm) if (null->state == SND_PCM_STATE_PREPARED) { /* it is required to return the correct avail count for */ /* the prepared stream, otherwise the start is not called */ - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) - return snd_pcm_mmap_playback_avail(pcm); - else - return snd_pcm_mmap_capture_avail(pcm); + return snd_pcm_mmap_avail(pcm); } return pcm->buffer_size; } @@ -100,7 +97,7 @@ static int snd_pcm_null_status(snd_pcm_t *pcm, snd_pcm_status_t * status) memset(status, 0, sizeof(*status)); status->state = null->state; status->trigger_tstamp = null->trigger_tstamp; - gettimestamp(&status->tstamp, pcm->monotonic); + gettimestamp(&status->tstamp, pcm->tstamp_type); status->avail = snd_pcm_null_avail_update(pcm); status->avail_max = pcm->buffer_size; return 0; diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c index 0b66e8c..6e57904 100644 --- a/src/pcm/pcm_params.c +++ b/src/pcm/pcm_params.c @@ -2257,7 +2257,9 @@ static int snd_pcm_sw_params_default(snd_pcm_t *pcm, snd_pcm_sw_params_t *params { assert(pcm && params); assert(pcm->setup); + params->proto = SNDRV_PCM_VERSION; params->tstamp_mode = SND_PCM_TSTAMP_NONE; + params->tstamp_type = pcm->tstamp_type; params->period_step = 1; params->sleep_min = 0; params->avail_min = pcm->period_size; diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 7a6c2b9..5639b9e 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -1127,7 +1127,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp, pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; pcm->mmap_shadow = 1; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_link_hw_ptr(pcm, slave); snd_pcm_link_appl_ptr(pcm, slave); *pcmp = pcm; diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index 4ddf10c..c19e2f1 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -198,13 +198,13 @@ static int snd_pcm_plugin_reset(snd_pcm_t *pcm) static snd_pcm_sframes_t snd_pcm_plugin_rewindable(snd_pcm_t *pcm) { - return snd_pcm_mmap_hw_avail(pcm); + return snd_pcm_mmap_hw_rewindable(pcm); } snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { snd_pcm_plugin_t *plugin = pcm->private_data; - snd_pcm_sframes_t n = snd_pcm_mmap_hw_avail(pcm); + snd_pcm_sframes_t n = snd_pcm_plugin_rewindable(pcm); snd_pcm_sframes_t sframes; if ((snd_pcm_uframes_t)n < frames) @@ -232,7 +232,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_forwardable(snd_pcm_t *pcm) snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames) { snd_pcm_plugin_t *plugin = pcm->private_data; - snd_pcm_sframes_t n = snd_pcm_mmap_avail(pcm); + snd_pcm_sframes_t n = snd_pcm_plugin_forwardable(pcm); snd_pcm_sframes_t sframes; if ((snd_pcm_uframes_t)n < frames) diff --git a/src/pcm/pcm_plugin.h b/src/pcm/pcm_plugin.h index 19e82c3..b0a3e18 100644 --- a/src/pcm/pcm_plugin.h +++ b/src/pcm/pcm_plugin.h @@ -86,8 +86,6 @@ snd_pcm_sframes_t snd_pcm_plugin_undo_write_generic /* make local functions really local */ #define snd_pcm_linear_get_index snd1_pcm_linear_get_index #define snd_pcm_linear_put_index snd1_pcm_linear_put_index -#define snd_pcm_linear_get32_index snd1_pcm_linear_get32_index -#define snd_pcm_linear_put32_index snd1_pcm_linear_put32_index #define snd_pcm_linear_convert_index snd1_pcm_linear_convert_index #define snd_pcm_linear_convert snd1_pcm_linear_convert #define snd_pcm_linear_getput snd1_pcm_linear_getput @@ -100,8 +98,6 @@ snd_pcm_sframes_t snd_pcm_plugin_undo_write_generic int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format); int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format); -int snd_pcm_linear_get32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format); -int snd_pcm_linear_put32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format); int snd_pcm_linear_convert_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format); void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset, diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 7f667d4..c76db25 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -574,6 +574,8 @@ static inline void snd_pcm_rate_sync_hwptr(snd_pcm_t *pcm) rate->hw_ptr = (slave_hw_ptr / rate->gen.slave->period_size) * pcm->period_size + rate->ops.input_frames(rate->obj, slave_hw_ptr % rate->gen.slave->period_size); + + rate->hw_ptr %= pcm->boundary; } static int snd_pcm_rate_hwsync(snd_pcm_t *pcm) @@ -591,10 +593,7 @@ static int snd_pcm_rate_hwsync(snd_pcm_t *pcm) static int snd_pcm_rate_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { snd_pcm_rate_hwsync(pcm); - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) - *delayp = snd_pcm_mmap_playback_hw_avail(pcm); - else - *delayp = snd_pcm_mmap_capture_hw_avail(pcm); + *delayp = snd_pcm_mmap_hw_avail(pcm); return 0; } @@ -1059,7 +1058,7 @@ static snd_pcm_state_t snd_pcm_rate_state(snd_pcm_t *pcm) static int snd_pcm_rate_start(snd_pcm_t *pcm) { snd_pcm_rate_t *rate = pcm->private_data; - snd_pcm_uframes_t avail; + snd_pcm_sframes_t avail; if (pcm->stream == SND_PCM_STREAM_CAPTURE) return snd_pcm_start(rate->gen.slave); @@ -1067,9 +1066,12 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm) if (snd_pcm_state(rate->gen.slave) != SND_PCM_STATE_PREPARED) return -EBADFD; - gettimestamp(&rate->trigger_tstamp, pcm->monotonic); + gettimestamp(&rate->trigger_tstamp, pcm->tstamp_type); avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave); + if (avail < 0) /* can't happen on healthy drivers */ + return -EBADFD; + if (avail == 0) { /* postpone the trigger since we have no data committed yet */ rate->start_pending = 1; @@ -1370,7 +1372,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; pcm->mmap_rw = 1; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &rate->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &rate->appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index 751e36f..2a437e8 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -60,7 +60,7 @@ typedef struct { typedef struct snd_pcm_route_ttable_dst snd_pcm_route_ttable_dst_t; typedef struct { - enum {UINT32=0, UINT64=1, FLOAT=2} sum_idx; + enum {UINT64, FLOAT} sum_idx; unsigned int get_idx; unsigned int put_idx; unsigned int conv_idx; @@ -233,55 +233,34 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, const snd_pcm_route_ttable_dst_t* ttable, const snd_pcm_route_params_t *params) { -#define GETS_LABELS +#define GET32_LABELS #define PUT32_LABELS #include "plugin_ops.h" -#undef GETS_LABELS +#undef GET32_LABELS #undef PUT32_LABELS - static void *const zero_labels[3] = { - &&zero_int32, &&zero_int64, + static void *const zero_labels[2] = { + &&zero_int64, #if SND_PCM_PLUGIN_ROUTE_FLOAT &&zero_float #endif }; /* sum_type att */ - static void *const add_labels[3 * 2] = { - &&add_int32_noatt, &&add_int32_att, + static void *const add_labels[2 * 2] = { &&add_int64_noatt, &&add_int64_att, #if SND_PCM_PLUGIN_ROUTE_FLOAT &&add_float_noatt, &&add_float_att #endif }; - /* sum_type att shift */ - static void *const norm_labels[3 * 2 * 4] = { - 0, - &&norm_int32_8_noatt, - &&norm_int32_16_noatt, - &&norm_int32_24_noatt, - 0, - &&norm_int32_8_att, - &&norm_int32_16_att, - &&norm_int32_24_att, - &&norm_int64_0_noatt, - &&norm_int64_8_noatt, - &&norm_int64_16_noatt, - &&norm_int64_24_noatt, - &&norm_int64_0_att, - &&norm_int64_8_att, - &&norm_int64_16_att, - &&norm_int64_24_att, + /* sum_type att */ + static void *const norm_labels[2 * 2] = { + &&norm_int64_noatt, + &&norm_int64_att, #if SND_PCM_PLUGIN_ROUTE_FLOAT - &&norm_float_0, - &&norm_float_8, - &&norm_float_16, - &&norm_float_24, - &&norm_float_0, - &&norm_float_8, - &&norm_float_16, - &&norm_float_24, + &&norm_float, + &&norm_float, #endif }; - void *zero, *get, *add, *norm, *put32; + void *zero, *get32, *add, *norm, *put32; int nsrcs = ttable->nsrcs; char *dst; int dst_step; @@ -323,9 +302,9 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, } zero = zero_labels[params->sum_idx]; - get = gets_labels[params->get_idx]; + get32 = get32_labels[params->get_idx]; add = add_labels[params->sum_idx * 2 + ttable->att]; - norm = norm_labels[params->sum_idx * 8 + ttable->att * 4 + 4 - params->src_size]; + norm = norm_labels[params->sum_idx * 2 + ttable->att]; put32 = put32_labels[params->put_idx]; dst = snd_pcm_channel_area_addr(dst_area, dst_offset); dst_step = snd_pcm_channel_area_step(dst_area); @@ -336,9 +315,6 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, /* Zero sum */ goto *zero; - zero_int32: - sum.as_sint32 = 0; - goto zero_end; zero_int64: sum.as_sint64 = 0; goto zero_end; @@ -352,21 +328,14 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, const char *src = srcs[srcidx]; /* Get sample */ - goto *get; -#define GETS_END after_get + goto *get32; +#define GET32_END after_get #include "plugin_ops.h" -#undef GETS_END +#undef GET32_END after_get: /* Sum */ goto *add; - add_int32_att: - sum.as_sint32 += sample * ttp->as_int; - goto after_sum; - add_int32_noatt: - if (ttp->as_int) - sum.as_sint32 += sample; - goto after_sum; add_int64_att: sum.as_sint64 += (int64_t) sample * ttp->as_int; goto after_sum; @@ -390,48 +359,10 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, /* Normalization */ goto *norm; - norm_int32_8_att: - sum.as_sint64 = sum.as_sint32; - norm_int64_8_att: - sum.as_sint64 <<= 8; - norm_int64_0_att: + norm_int64_att: div(sum.as_sint64); - goto norm_int; - - norm_int32_16_att: - sum.as_sint64 = sum.as_sint32; - norm_int64_16_att: - sum.as_sint64 <<= 16; - div(sum.as_sint64); - goto norm_int; - - norm_int32_24_att: - sum.as_sint64 = sum.as_sint32; - norm_int64_24_att: - sum.as_sint64 <<= 24; - div(sum.as_sint64); - goto norm_int; - - norm_int32_8_noatt: - sum.as_sint64 = sum.as_sint32; - norm_int64_8_noatt: - sum.as_sint64 <<= 8; - goto norm_int; - - norm_int32_16_noatt: - sum.as_sint64 = sum.as_sint32; - norm_int64_16_noatt: - sum.as_sint64 <<= 16; - goto norm_int; - - norm_int32_24_noatt: - sum.as_sint64 = sum.as_sint32; - norm_int64_24_noatt: - sum.as_sint64 <<= 24; - goto norm_int; - - norm_int64_0_noatt: - norm_int: + /* fallthru */ + norm_int64_noatt: if (sum.as_sint64 > (int64_t)0x7fffffff) sample = 0x7fffffff; /* maximum positive value */ else if (sum.as_sint64 < -(int64_t)0x80000000) @@ -441,16 +372,6 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, goto after_norm; #if SND_PCM_PLUGIN_ROUTE_FLOAT - norm_float_8: - sum.as_float *= 1 << 8; - goto norm_float; - norm_float_16: - sum.as_float *= 1 << 16; - goto norm_float; - norm_float_24: - sum.as_float *= 1 << 24; - goto norm_float; - norm_float_0: norm_float: sum.as_float = rint(sum.as_float); if (sum.as_float > (int64_t)0x7fffffff) @@ -644,20 +565,19 @@ static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) } if (err < 0) return err; - route->params.use_getput = snd_pcm_format_physical_width(src_format) == 24 || - snd_pcm_format_physical_width(dst_format) == 24; - route->params.get_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S16); - route->params.put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format); + /* 3 bytes formats? */ + route->params.use_getput = + (snd_pcm_format_physical_width(src_format) + 7) / 3 == 3 || + (snd_pcm_format_physical_width(dst_format) + 7) / 3 == 3; + route->params.get_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S32); + route->params.put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, dst_format); route->params.conv_idx = snd_pcm_linear_convert_index(src_format, dst_format); route->params.src_size = snd_pcm_format_width(src_format) / 8; route->params.dst_sfmt = dst_format; #if SND_PCM_PLUGIN_ROUTE_FLOAT route->params.sum_idx = FLOAT; #else - if (snd_pcm_format_width(src_format) == 32) - route->params.sum_idx = UINT64; - else - route->params.sum_idx = UINT32; + route->params.sum_idx = UINT64; #endif return 0; } @@ -1122,7 +1042,7 @@ int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, pcm->private_data = route; pcm->poll_fd = slave->poll_fd; pcm->poll_events = slave->poll_events; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &route->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &route->plug.appl_ptr, -1, 0); err = route_load_ttable(&route->params, pcm->stream, tt_ssize, ttable, tt_cused, tt_sused); @@ -1227,7 +1147,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent snd_config_iterator_t j, jnext; long cchannel; const char *id; - if (!snd_config_get_id(in, &id) < 0) + if (snd_config_get_id(in, &id) < 0) continue; err = safe_strtol(id, &cchannel); if (err < 0 || diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c index 118ab26..4b68f1f 100644 --- a/src/pcm/pcm_share.c +++ b/src/pcm/pcm_share.c @@ -128,6 +128,8 @@ static snd_pcm_uframes_t snd_pcm_share_slave_avail(snd_pcm_share_slave_t *slave) avail += pcm->buffer_size; if (avail < 0) avail += pcm->boundary; + else if ((snd_pcm_uframes_t) avail >= pcm->boundary) + avail -= pcm->boundary; return avail; } @@ -367,6 +369,7 @@ static void *snd_pcm_share_thread(void *data) err = pipe(slave->poll); if (err < 0) { SYSERR("can't create a pipe"); + Pthread_mutex_unlock(&slave->mutex); return NULL; } while (slave->open_count > 0) { @@ -393,6 +396,7 @@ static void *snd_pcm_share_thread(void *data) err = snd_pcm_sw_params(spcm, &slave->sw_params); if (err < 0) { SYSERR("snd_pcm_sw_params error"); + Pthread_mutex_unlock(&slave->mutex); return NULL; } } @@ -971,7 +975,7 @@ static int snd_pcm_share_start(snd_pcm_t *pcm) } slave->running_count++; _snd_pcm_share_update(pcm); - gettimestamp(&share->trigger_tstamp, pcm->monotonic); + gettimestamp(&share->trigger_tstamp, pcm->tstamp_type); _end: Pthread_mutex_unlock(&slave->mutex); return err; @@ -1126,7 +1130,7 @@ static void _snd_pcm_share_stop(snd_pcm_t *pcm, snd_pcm_state_t state) return; } #endif - gettimestamp(&share->trigger_tstamp, pcm->monotonic); + gettimestamp(&share->trigger_tstamp, pcm->tstamp_type); if (pcm->stream == SND_PCM_STREAM_CAPTURE) { snd_pcm_areas_copy(pcm->stopped_areas, 0, pcm->running_areas, 0, @@ -1526,7 +1530,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname, pcm->private_data = share; pcm->poll_fd = share->client_socket; pcm->poll_events = stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN; - pcm->monotonic = slave->pcm->monotonic; + pcm->tstamp_type = slave->pcm->tstamp_type; snd_pcm_set_hw_ptr(pcm, &share->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &share->appl_ptr, -1, 0); diff --git a/src/pcm/pcm_shm.c b/src/pcm/pcm_shm.c index 69d0524..a815ac6 100644 --- a/src/pcm/pcm_shm.c +++ b/src/pcm/pcm_shm.c @@ -654,33 +654,6 @@ static int make_local_socket(const char *filename) return sock; } -#if 0 -static int make_inet_socket(const char *host, int port) -{ - struct sockaddr_in addr; - int sock; - struct hostent *h = gethostbyname(host); - if (!h) - return -ENOENT; - - sock = socket(PF_INET, SOCK_STREAM, 0); - if (sock < 0) { - SYSERR("socket failed"); - return -errno; - } - - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - memcpy(&addr.sin_addr, h->h_addr_list[0], sizeof(struct in_addr)); - - if (connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - SYSERR("connect failed"); - return -errno; - } - return sock; -} -#endif - /** * \brief Creates a new shared memory PCM * \param pcmp Returns created PCM handle @@ -842,12 +815,10 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *server = NULL; const char *pcm_name = NULL; snd_config_t *sconfig; - const char *host = NULL; const char *sockname = NULL; long port = -1; int err; - int local; - struct hostent *h; + snd_config_for_each(i, next, conf) { snd_config_t *n = snd_config_iterator_entry(i); const char *id; @@ -898,14 +869,8 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, continue; if (strcmp(id, "comment") == 0) continue; - if (strcmp(id, "host") == 0) { - err = snd_config_get_string(n, &host); - if (err < 0) { - SNDERR("Invalid type for %s", id); - goto _err; - } + if (strcmp(id, "host") == 0) continue; - } if (strcmp(id, "socket") == 0) { err = snd_config_get_string(n, &sockname); if (err < 0) { @@ -928,24 +893,10 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, goto __error; } - if (!host) { - SNDERR("host is not defined"); - goto _err; - } if (!sockname) { SNDERR("socket is not defined"); goto _err; } - h = gethostbyname(host); - if (!h) { - SNDERR("Cannot resolve %s", host); - goto _err; - } - local = snd_is_local(h); - if (!local) { - SNDERR("%s is not the local host", host); - goto _err; - } err = snd_pcm_shm_open(pcmp, name, sockname, pcm_name, stream, mode); __error: snd_config_delete(sconfig); diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c index 5da9204..c6cfd88 100644 --- a/src/pcm/pcm_softvol.c +++ b/src/pcm/pcm_softvol.c @@ -903,7 +903,7 @@ int snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name, * an extra buffer. */ pcm->mmap_shadow = 1; - pcm->monotonic = slave->monotonic; + pcm->tstamp_type = slave->tstamp_type; snd_pcm_set_hw_ptr(pcm, &svol->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &svol->plug.appl_ptr, -1, 0); *pcmp = pcm; diff --git a/src/pcm/plugin_ops.h b/src/pcm/plugin_ops.h index 21535c9..eb8c2c4 100644 --- a/src/pcm/plugin_ops.h +++ b/src/pcm/plugin_ops.h @@ -668,87 +668,6 @@ getu_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GETU_END; } #endif -#ifdef GETS_LABELS -/* width endswap sign_toggle */ -static void *const gets_labels[4 * 2 * 2] = { - &&gets_1_1, /* 8h -> 8h */ - &&gets_1_9, /* 8h ^> 8h */ - &&gets_1_1, /* 8s -> 8h */ - &&gets_1_9, /* 8s ^> 8h */ - &&gets_12_12, /* 16h -> 16h */ - &&gets_12_92, /* 16h ^> 16h */ - &&gets_12_21, /* 16s -> 16h */ - &&gets_12_A1, /* 16s ^> 16h */ - &&gets_0123_0123, /* 24h -> 24h */ - &&gets_0123_0923, /* 24h ^> 24h */ - &&gets_1230_0321, /* 24s -> 24h */ - &&gets_1230_0B21, /* 24s ^> 24h */ - &&gets_1234_1234, /* 32h -> 32h */ - &&gets_1234_9234, /* 32h ^> 32h */ - &&gets_1234_4321, /* 32s -> 32h */ - &&gets_1234_C321, /* 32s ^> 32h */ -}; -#endif - -#ifdef GETS_END -while (0) { -gets_1_1: sample = as_s8c(src); goto GETS_END; -gets_1_9: sample = (int8_t)(as_s8c(src) ^ 0x80); goto GETS_END; -gets_12_12: sample = as_s16c(src); goto GETS_END; -gets_12_92: sample = (int16_t)(as_s16c(src) ^ 0x8000); goto GETS_END; -gets_12_21: sample = (int16_t)bswap_16(as_s16c(src)); goto GETS_END; -gets_12_A1: sample = (int16_t)bswap_16(as_s16c(src) ^ 0x80); goto GETS_END; -gets_0123_0123: sample = sx24((int32_t)(as_s32c(src) << 8) >> 8); goto GETS_END; -gets_0123_0923: sample = sx24((int32_t)((as_s32c(src) ^ 0x800000) << 8) >> 8); goto GETS_END; -gets_1230_0321: sample = sx24((int32_t)(bswap_32(as_s32c(src)) << 8) >> 8); goto GETS_END; -gets_1230_0B21: sample = sx24((int32_t)(bswap_32(as_s32c(src) ^ 0x8000) << 8) >> 8); goto GETS_END; -gets_1234_1234: sample = as_s32c(src); goto GETS_END; -gets_1234_9234: sample = (int32_t)(as_s32c(src) ^ 0x80000000); goto GETS_END; -gets_1234_4321: sample = (int32_t)bswap_32(as_s32c(src)); goto GETS_END; -gets_1234_C321: sample = (int32_t)bswap_32(as_s32c(src) ^ 0x80); goto GETS_END; -} -#endif - -#ifdef PUT_LABELS -/* width endswap sign_toggle */ -static void *const put_labels[4 * 2 * 2] = { - &&put_1_1, /* 8h -> 8h */ - &&put_1_9, /* 8h ^> 8h */ - &&put_1_1, /* 8h -> 8s */ - &&put_1_9, /* 8h ^> 8s */ - &&put_12_12, /* 16h -> 16h */ - &&put_12_92, /* 16h ^> 16h */ - &&put_12_21, /* 16h -> 16s */ - &&put_12_29, /* 16h ^> 16s */ - &&put_0123_0123, /* 24h -> 24h */ - &&put_0123_0923, /* 24h ^> 24h */ - &&put_0123_3210, /* 24h -> 24s */ - &&put_0123_3290, /* 24h ^> 24s */ - &&put_1234_1234, /* 32h -> 32h */ - &&put_1234_9234, /* 32h ^> 32h */ - &&put_1234_4321, /* 32h -> 32s */ - &&put_1234_4329, /* 32h ^> 32s */ -}; -#endif - -#ifdef PUT_END -put_1_1: as_s8(dst) = sample; goto PUT_END; -put_1_9: as_u8(dst) = sample ^ 0x80; goto PUT_END; -put_12_12: as_s16(dst) = sample; goto PUT_END; -put_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT_END; -put_12_21: as_s16(dst) = bswap_16(sample); goto PUT_END; -put_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT_END; -/* this always writes the unused byte in 24-bit formats as 0x00 */ -put_0123_0123: as_s32(dst) = sx24(sample & 0x00ffffff); goto PUT_END; -put_0123_0923: as_u32(dst) = sx24((sample & 0x00ffffff) ^ 0x800000); goto PUT_END; -put_0123_3210: as_s32(dst) = sx24s(bswap_32(sample) & 0xffffff00); goto PUT_END; -put_0123_3290: as_u32(dst) = sx24s((bswap_32(sample) & 0xffffff00) ^ 0x8000); goto PUT_END; -put_1234_1234: as_s32(dst) = sample; goto PUT_END; -put_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT_END; -put_1234_4321: as_s32(dst) = bswap_32(sample); goto PUT_END; -put_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT_END; -#endif - #ifdef PUT32F_LABELS /* type (0 = float, 1 = float64), endswap */ static void *const put32float_labels[2 * 2] = { diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c index b835b47..ac699b4 100644 --- a/src/rawmidi/rawmidi.c +++ b/src/rawmidi/rawmidi.c @@ -256,8 +256,11 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp snd_config_delete(type_conf); if (err >= 0) err = open_func(inputp, outputp, name, rawmidi_root, rawmidi_conf, mode); - if (err < 0) + if (err < 0) { + if (h) + snd_dlclose(h); return err; + } if (inputp) { (*inputp)->dl_handle = h; h = NULL; snd_rawmidi_params_default(*inputp, ¶ms); diff --git a/src/socket.c b/src/socket.c index 97c919f..d40c845 100644 --- a/src/socket.c +++ b/src/socket.c @@ -106,53 +106,4 @@ int snd_receive_fd(int sock, void *data, size_t len, int *fd) *fd = *fds; return ret; } - -int snd_is_local(struct hostent *hent) -{ - int s; - int err; - struct ifconf conf; - size_t numreqs = 10; - size_t i; - struct in_addr *haddr = (struct in_addr*) hent->h_addr_list[0]; - - s = socket(PF_INET, SOCK_STREAM, 0); - if (s < 0) { - SYSERR("socket failed"); - return -errno; - } - - conf.ifc_len = numreqs * sizeof(struct ifreq); - conf.ifc_buf = malloc((unsigned int) conf.ifc_len); - if (! conf.ifc_buf) - return -ENOMEM; - while (1) { - err = ioctl(s, SIOCGIFCONF, &conf); - if (err < 0) { - SYSERR("SIOCGIFCONF failed"); - return -errno; - } - if ((size_t)conf.ifc_len < numreqs * sizeof(struct ifreq)) - break; - numreqs *= 2; - conf.ifc_len = numreqs * sizeof(struct ifreq); - conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len); - if (! conf.ifc_buf) - return -ENOMEM; - } - numreqs = conf.ifc_len / sizeof(struct ifreq); - for (i = 0; i < numreqs; ++i) { - struct ifreq *req = &conf.ifc_req[i]; - struct sockaddr_in *s_in = (struct sockaddr_in *)&req->ifr_addr; - s_in->sin_family = AF_INET; - err = ioctl(s, SIOCGIFADDR, req); - if (err < 0) - continue; - if (haddr->s_addr == s_in->sin_addr.s_addr) - break; - } - close(s); - free(conf.ifc_buf); - return i < numreqs; -} #endif diff --git a/src/ucm/main.c b/src/ucm/main.c index 0494728..7e44603 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c @@ -34,14 +34,15 @@ #include #include #include +#include /* * misc */ -static int get_value1(const char **value, struct list_head *value_list, +static int get_value1(char **value, struct list_head *value_list, const char *identifier); -static int get_value3(const char **value, +static int get_value3(char **value, const char *identifier, struct list_head *value_list1, struct list_head *value_list2, @@ -160,11 +161,65 @@ static int open_ctl(snd_use_case_mgr_t *uc_mgr, return 0; } +static int binary_file_parse(snd_ctl_elem_value_t *dst, + snd_ctl_elem_info_t *info, + const char *filepath) +{ + int err = 0; + int fd; + struct stat st; + size_t sz; + ssize_t sz_read; + char *res; + snd_ctl_elem_type_t type; + unsigned int idx, count; + + type = snd_ctl_elem_info_get_type(info); + if (type != SND_CTL_ELEM_TYPE_BYTES) { + uc_error("only support byte type!"); + err = -EINVAL; + return err; + } + fd = open(filepath, O_RDONLY); + if (fd < 0) { + err = -errno; + return err; + } + if (stat(filepath, &st) == -1) { + err = -errno; + goto __fail; + } + sz = st.st_size; + count = snd_ctl_elem_info_get_count(info); + if (sz != count || sz > sizeof(dst->value.bytes)) { + uc_error("invalid parameter size %d!", sz); + err = -EINVAL; + goto __fail; + } + res = malloc(sz); + if (res == NULL) { + err = -ENOMEM; + goto __fail; + } + sz_read = read(fd, res, sz); + if (sz_read < 0 || (size_t)sz_read != sz) { + err = -errno; + goto __fail_read; + } + for (idx = 0; idx < sz; idx++) + snd_ctl_elem_value_set_byte(dst, idx, *(res + idx)); + __fail_read: + free(res); + __fail: + close(fd); + return err; +} + extern int __snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str, const char **ret_ptr); -static int execute_cset(snd_ctl_t *ctl, const char *cset) +static int execute_cset(snd_ctl_t *ctl, const char *cset, unsigned int type) { const char *pos; int err; @@ -194,7 +249,10 @@ static int execute_cset(snd_ctl_t *ctl, const char *cset) err = snd_ctl_elem_info(ctl, info); if (err < 0) goto __fail; - err = snd_ctl_ascii_value_parse(ctl, value, info, pos); + if (type == SEQUENCE_ELEMENT_TYPE_CSET_BIN_FILE) + err = binary_file_parse(value, info, pos); + else + err = snd_ctl_ascii_value_parse(ctl, value, info, pos); if (err < 0) goto __fail; err = snd_ctl_elem_write(ctl, value); @@ -239,33 +297,46 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr, goto __fail_nomem; break; case SEQUENCE_ELEMENT_TYPE_CSET: + case SEQUENCE_ELEMENT_TYPE_CSET_BIN_FILE: if (cdev == NULL) { - const char *cdev1 = NULL, *cdev2 = NULL; - err = get_value3(&cdev1, "PlaybackCTL", + char *playback_ctl = NULL; + char *capture_ctl = NULL; + + err = get_value3(&playback_ctl, "PlaybackCTL", value_list1, value_list2, value_list3); - if (err < 0 && err != ENOENT) { + if (err < 0 && err != -ENOENT) { uc_error("cdev is not defined!"); return err; } - err = get_value3(&cdev1, "CaptureCTL", + err = get_value3(&capture_ctl, "CaptureCTL", value_list1, value_list2, value_list3); - if (err < 0 && err != ENOENT) { - free((char *)cdev1); + if (err < 0 && err != -ENOENT) { + free(playback_ctl); uc_error("cdev is not defined!"); return err; } - if (cdev1 == NULL || cdev2 == NULL || - strcmp(cdev1, cdev2) == 0) { - cdev = (char *)cdev1; - free((char *)cdev2); - } else { - free((char *)cdev1); - free((char *)cdev2); + if (playback_ctl == NULL && + capture_ctl == NULL) { + uc_error("cdev is not defined!"); + return -EINVAL; + } + if (playback_ctl != NULL && + capture_ctl != NULL && + strcmp(playback_ctl, capture_ctl) != 0) { + free(playback_ctl); + free(capture_ctl); + uc_error("cdev is not defined!"); + return -EINVAL; } + if (playback_ctl != NULL) { + cdev = playback_ctl; + free(capture_ctl); + } else + cdev = capture_ctl; } if (ctl == NULL) { err = open_ctl(uc_mgr, &ctl, cdev); @@ -274,7 +345,7 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr, goto __fail; } } - err = execute_cset(ctl, s->data.cset); + err = execute_cset(ctl, s->data.cset, s->type); if (err < 0) { uc_error("unable to execute cset '%s'\n", s->data.cset); goto __fail; @@ -1166,7 +1237,7 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, return err; } -static int get_value1(const char **value, struct list_head *value_list, +static int get_value1(char **value, struct list_head *value_list, const char *identifier) { struct ucm_value *val; @@ -1187,7 +1258,7 @@ static int get_value1(const char **value, struct list_head *value_list, return -ENOENT; } -static int get_value3(const char **value, +static int get_value3(char **value, const char *identifier, struct list_head *value_list1, struct list_head *value_list2, @@ -1217,7 +1288,7 @@ static int get_value3(const char **value, */ static int get_value(snd_use_case_mgr_t *uc_mgr, const char *identifier, - const char **value, + char **value, const char *mod_dev_name, const char *verb_name, int exact) @@ -1348,7 +1419,8 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, verb = NULL; } - err = get_value(uc_mgr, ident, value, mod_dev, verb, exact); + err = get_value(uc_mgr, ident, (char **)value, mod_dev, verb, + exact); if (ident != identifier) free((void *)ident); if (mod_dev) @@ -1443,7 +1515,7 @@ static int set_verb_user(snd_use_case_mgr_t *uc_mgr, const char *verb_name) { struct use_case_verb *verb; - int err; + int err = 0; if (uc_mgr->active_verb && strcmp(uc_mgr->active_verb->name, verb_name) == 0) @@ -1625,7 +1697,7 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, const char *value) { char *str, *str1; - int err; + int err = 0; pthread_mutex_lock(&uc_mgr->mutex); if (strcmp(identifier, "_verb") == 0) diff --git a/src/ucm/parser.c b/src/ucm/parser.c index d7517f6..9e1cb41 100644 --- a/src/ucm/parser.c +++ b/src/ucm/parser.c @@ -306,6 +306,16 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, continue; } + if (strcmp(cmd, "cset-bin-file") == 0) { + curr->type = SEQUENCE_ELEMENT_TYPE_CSET_BIN_FILE; + err = parse_string(n, &curr->data.cset); + if (err < 0) { + uc_error("error: cset-bin-file requires a string!"); + return err; + } + continue; + } + if (strcmp(cmd, "usleep") == 0) { curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP; err = snd_config_get_integer(n, &curr->data.sleep); diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h index 87f14a2..c1655c7 100644 --- a/src/ucm/ucm_local.h +++ b/src/ucm/ucm_local.h @@ -47,6 +47,7 @@ #define SEQUENCE_ELEMENT_TYPE_CSET 2 #define SEQUENCE_ELEMENT_TYPE_SLEEP 3 #define SEQUENCE_ELEMENT_TYPE_EXEC 4 +#define SEQUENCE_ELEMENT_TYPE_CSET_BIN_FILE 5 struct ucm_value { struct list_head list; diff --git a/src/userfile.c b/src/userfile.c index 3a73836..72779da 100644 --- a/src/userfile.c +++ b/src/userfile.c @@ -44,19 +44,20 @@ int snd_user_file(const char *file, char **result) err = wordexp(file, &we, WRDE_NOCMD); switch (err) { case WRDE_NOSPACE: + wordfree(&we); return -ENOMEM; case 0: if (we.we_wordc == 1) break; + wordfree(&we); /* fall thru */ default: - wordfree(&we); return -EINVAL; } *result = strdup(we.we_wordv[0]); + wordfree(&we); if (*result == NULL) return -ENOMEM; - wordfree(&we); return 0; } diff --git a/test/audio_time.c b/test/audio_time.c index 03817c7..7435db6 100644 --- a/test/audio_time.c +++ b/test/audio_time.c @@ -57,6 +57,7 @@ void gettimestamp(snd_pcm_t *handle, snd_htimestamp_t *timestamp, #define TRACK_PLAYBACK /* dump playback timing info */ #define TRACK_SAMPLE_COUNTS /* show difference between sample counters and audiotimestamps returned by driver */ #define PLAYBACK_BUFFERS 4 +#define TSTAMP_TYPE SND_PCM_TSTAMP_TYPE_MONOTONIC int main(void) @@ -128,6 +129,12 @@ int main(void) goto _exit; } + err = snd_pcm_sw_params_set_tstamp_type(handle_p, swparams_p, TSTAMP_TYPE); + if (err < 0) { + printf("Unable to set tstamp type : %s\n", snd_strerror(err)); + goto _exit; + } + /* write the sw parameters */ err = snd_pcm_sw_params(handle_p, swparams_p); if (err < 0) { @@ -177,6 +184,12 @@ int main(void) goto _exit; } + err = snd_pcm_sw_params_set_tstamp_type(handle_c, swparams_c, TSTAMP_TYPE); + if (err < 0) { + printf("Unable to set tstamp type : %s\n", snd_strerror(err)); + goto _exit; + } + /* write the sw parameters */ err = snd_pcm_sw_params(handle_c, swparams_c); if (err < 0) { diff --git a/version b/version index 8b54409..4c24bf1 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.0.28 +1.0.29 -- 2.7.4