From: Jaroslav Kysela Date: Tue, 17 Sep 2002 12:33:05 +0000 (+0000) Subject: - unified snd_pcm_hw_params_* functions X-Git-Tag: v1.0.3~386 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=b9343e0834cf09ed2b5049d0d17bfc0609bd4a75;p=alsa-lib.git - unified snd_pcm_hw_params_* functions - added backward compatibility for older non-compatible functions - added --with-compat-rc3 to configure script to build library backwards compatible with 0.9.0rc3 - added symbol versioning like libc.so.6 - ALSA_0.9 - alsa base - ALSA_0.9.0rc4 - first set of new functions (snd_pcm_hw_params_*) --- diff --git a/acconfig.h b/acconfig.h index 8200eb50..5a36ae54 100644 --- a/acconfig.h +++ b/acconfig.h @@ -15,3 +15,9 @@ /* Do we have FPU on this machine? */ #undef HAVE_SOFT_FLOAT + +/* Use versioned symbols for shared library? */ +#undef VERSIONED_SYMBOLS + +/* 0.9.0rc3 compatibility build */ +#undef COMPATIBILITY_BUILD_RC3 diff --git a/acinclude.m4 b/acinclude.m4 index 3acfc3f0..8fc6cfc3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -41,7 +41,8 @@ case "$SND_LIB_EXTRASTR" in pre) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 00000` ;; alpha) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 10000` ;; beta) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 20000` ;; - *) SND_LIB_EXTRAVER=100000 ;; + rc) SND_LIB_EXTRAVER=`expr $SND_LIB_EXTRAVER + 100000` ;; + *) SND_LIB_EXTRAVER=1000000 ;; esac AC_MSG_RESULT(major $SND_LIB_MAJOR minor $SND_LIB_MINOR subminor $SND_LIB_SUBMINOR extrastr $SND_LIB_EXTRASTR extraver $SND_LIB_EXTRAVER) AC_SUBST(SND_LIB_EXTRAVER) diff --git a/configure.in b/configure.in index b269228f..50c00d1d 100644 --- a/configure.in +++ b/configure.in @@ -9,7 +9,7 @@ dnl remove API = c+1:0:0 dnl ************************************************* AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE(alsa-lib, 0.9.0rc3) -eval LIBTOOL_VERSION_INFO="2:0:0" +eval LIBTOOL_VERSION_INFO="3:0:0" dnl ************************************************* AM_CONDITIONAL(INSTALL_M4, test -n "${ACLOCAL}") @@ -109,6 +109,18 @@ case "$dir" in esac AC_DEFINE_UNQUOTED(DATADIR, "$dir", [directory containing ALSA configuration database]) +dnl Check for versioned symbols +AC_MSG_CHECKING(for versioned symbols) +AC_ARG_WITH(versioned, + [ --with-versioned=yes,no shared library will (not) be compiled with versioned symbols], + versioned="$withval", versioned="yes") +if test "$versioned" = "yes"; then + AC_DEFINE(VERSIONED_SYMBOLS) + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + dnl Check for debug... AC_MSG_CHECKING(for debug) AC_ARG_WITH(debug, @@ -121,9 +133,17 @@ else AC_MSG_RESULT(no) fi +dnl Check for softfloat... +AC_MSG_CHECKING(for softfloat) AC_ARG_WITH(softfloat, [ --with-softfloat do you have floating point unit on this machine? (optional)], - [ AC_DEFINE(HAVE_SOFT_FLOAT, "1", [Avoid calculation in float])],) + [ AC_DEFINE(HAVE_SOFT_FLOAT, "1", [Avoid calculation in float]) + softfloat=yes ],) +if test "$softloat" = "yes" ; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi dnl Check for architecture AC_MSG_CHECKING(for architecture) @@ -156,6 +176,19 @@ arm*) ;; esac +dnl Compatibility build, to be removed.... +AC_MSG_CHECKING(for 0.9.0rc3 compatibility build) +AC_ARG_WITH(compat-rc3, + [ --with-compat-rc3 build library compatible with 0.9.0rc3], + [ AC_DEFINE(COMPATIBILITY_BUILD_RC3, "1", [0.9.0rc3 compatibility build]) + comp_rc3="yes" ],) +if test "$comp_rc3" = "yes" ; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AM_CONDITIONAL(COMPATIBILITY_BUILD_RC3, [test "x$comp_rc3" = xyes]) + AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile include/Makefile src/Makefile \ src/control/Makefile src/mixer/Makefile src/pcm/Makefile \ src/rawmidi/Makefile src/timer/Makefile \ diff --git a/include/Makefile.am b/include/Makefile.am index 9d847f56..c7644361 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,6 +1,14 @@ sysincludedir = ${includedir}/sys alsaincludedir = ${includedir}/alsa +if COMPATIBILITY_BUILD_RC3 + SND_LIB_MAJOR = 0 + SND_LIB_MINOR = 9 + SND_LIB_SUBMINOR = 0 + SND_LIB_EXTRAVER = 100000 # there was a bug.... + SND_LIB_VERSION = 0.9.0rc3 +endif + alsainclude_HEADERS = asoundlib.h asoundef.h \ version.h global.h input.h output.h error.h \ conf.h pcm.h pcm_plugin.h rawmidi.h timer.h \ @@ -8,9 +16,9 @@ alsainclude_HEADERS = asoundlib.h asoundef.h \ seq_event.h seq.h seqmid.h seq_midi_event.h \ conv.h instr.h iatomic.h -noinst_HEADERS = sys.h search.h list.h aserver.h local.h config.h +noinst_HEADERS = sys.h search.h list.h aserver.h local.h config.h alsa-symbols.h -EXTRA_CLEAN = stamp-vh +CLEANFILES = stamp-vh version.h version.h: stamp-vh @: @@ -31,6 +39,9 @@ stamp-vh: $(top_builddir)/configure.in @echo "/** library version (string) */" >> ver.tmp @echo "#define SND_LIB_VERSION_STR \"$(SND_LIB_VERSION)\"" >> ver.tmp @echo >> ver.tmp +if COMPATIBILITY_BUILD_RC3 + @echo "#define SND_COMPATIBILITY_BUILD_RC3 1" >> ver.tmp +endif @cmp -s version.h ver.tmp \ || (echo "Updating version.h"; \ cp ver.tmp version.h; \ diff --git a/include/alsa-symbols.h b/include/alsa-symbols.h new file mode 100644 index 00000000..9dab335f --- /dev/null +++ b/include/alsa-symbols.h @@ -0,0 +1,41 @@ +/* + * ALSA lib - dynamic symbol versions + * Copyright (c) 2002 by Jaroslav Kysela + * + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __ALSA_SYMBOLS_H +#define __ALSA_SYMBOLS_H + +#if defined(PIC) && defined(VERSIONED_SYMBOLS) /* might be also configurable */ +#define USE_VERSIONED_SYMBOLS +#endif + +#ifdef USE_VERSIONED_SYMBOLS +#define INTERNAL_CONCAT2_2(Pre, Post) Pre##Post +#define INTERNAL(Name) INTERNAL_CONCAT2_2(__, Name) +#else +#define INTERNAL(Name) Name +#endif + +#define symbol_version(real, name, version) \ + __asm__ (".symver " #real "," #name "@" #version) +#define default_symbol_version(real, name, version) \ + __asm__ (".symver " #real "," #name "@@" #version) + +#endif /* __ALSA_SYMBOLS_H */ diff --git a/include/local.h b/include/local.h index 3f35a8fb..59dde5fa 100644 --- a/include/local.h +++ b/include/local.h @@ -83,9 +83,12 @@ typedef struct sndrv_seq_event snd_seq_event_t; #define _snd_timer_params sndrv_timer_params #define _snd_timer_status sndrv_timer_status +#define ALSA_LIBRARY_BUILD + #include #include #include +#include "alsa-symbols.h" #include "version.h" #include "global.h" #include "input.h" diff --git a/include/pcm.h b/include/pcm.h index a1d0a1f4..a35bec63 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -512,27 +512,158 @@ size_t snd_pcm_hw_params_sizeof(void); int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr); void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj); void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src); -int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *val); + +#ifndef ALSA_LIBRARY_BUILD +#ifndef SND_COMPATIBILITY_BUILD_RC3 + +int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access); +int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access); +int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access); +int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access); +int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access); +int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); +int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); + +int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val); +int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); +int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); +int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format); +int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format); +int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); +void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); + +int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); +int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat); +int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat); +int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); +int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); +int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); +void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); + +int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); +int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); +int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max); +int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); + +int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); + +int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); + +int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); +int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); +int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); +int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir); +int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir); +int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir); +int snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + +int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + +int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); + +int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); +int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); +int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max); +int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); + +int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); + +#else + +int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params); int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val); int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val); snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); -int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val); + +int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params); int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); + int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val); -int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *val); +int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params); int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val); snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); + int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params); unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params); unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params); @@ -544,6 +675,7 @@ int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *p unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir); @@ -555,6 +687,7 @@ int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *param unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir); @@ -566,6 +699,7 @@ int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir); @@ -578,6 +712,7 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir); @@ -590,6 +725,7 @@ unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_param unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir); @@ -601,6 +737,7 @@ int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); + snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params); snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params); snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params); @@ -612,6 +749,7 @@ int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir); @@ -623,7 +761,11 @@ int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t * unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir); unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir); -snd_pcm_sframes_t snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params); + +#endif /* SND_COMPATIBILITY_BUILD_RC3 */ +#endif /* ALSA_LIBRARY_BUILD */ + +int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); /** \} */ diff --git a/src/Makefile.am b/src/Makefile.am index 7aefd18c..d4a426a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,9 +6,10 @@ libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc libasound_la_LIBADD = control/libcontrol.la mixer/libmixer.la pcm/libpcm.la \ rawmidi/librawmidi.la timer/libtimer.la \ hwdep/libhwdep.la seq/libseq.la instr/libinstr.la \ - compat/libcompat.la -lm -ldl -lpthread + compat/libcompat.la -lm -ldl -lpthread libasound_la_LDFLAGS = -version-info $(COMPATNUM) +LDFLAGS = -Wl,--version-script=Versions control/libcontrol.la: $(MAKE) -C control libcontrol.la diff --git a/src/pcm/Makefile.am b/src/pcm/Makefile.am index 551c80d1..9d111daf 100644 --- a/src/pcm/Makefile.am +++ b/src/pcm/Makefile.am @@ -7,7 +7,8 @@ libpcm_la_SOURCES = atomic.c mask.c interval.c \ pcm_route.c pcm_mulaw.c pcm_alaw.c pcm_adpcm.c \ pcm_rate.c pcm_plug.c pcm_misc.c pcm_mmap.c pcm_multi.c \ pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \ - pcm_meter.c pcm_hooks.c pcm_lfloat.c pcm_ladspa.c pcm_symbols.c + pcm_meter.c pcm_hooks.c pcm_lfloat.c pcm_ladspa.c \ + pcm_symbols.c noinst_HEADERS = pcm_local.h pcm_plugin.h mask.h mask_inline.h \ interval.h interval_inline.h plugin_ops.h ladspa.h diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index ddef2836..79f52aed 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -2716,76 +2716,80 @@ void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *dst = *src; } + /** * \brief Extract access type from a configuration space * \param params Configuration space - * \param val Returned value + * \param access Returned value * \return access type otherwise a negative error code if not exactly one is present */ -int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *val) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_access)(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access) +#else +int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access) +#endif { - int err; - - assert(val); - err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_ACCESS, NULL); - if (err < 0) - return err; - *val = err; - return 0; + unsigned int _val; + int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_ACCESS, &_val, NULL); + if (err >= 0) + *access = _val; + return err; } /** * \brief Verify if an access type is available inside a configuration space for a PCM * \param pcm PCM handle * \param params Configuration space - * \param val access type + * \param access access type * \return 1 if available 0 otherwise */ -int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val) +int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access) { - return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_ACCESS, val, 0); + return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_ACCESS, access, 0); } /** * \brief Restrict a configuration space to contain only one access type * \param pcm PCM handle * \param params Configuration space - * \param val access type + * \param access access type * \return 0 otherwise a negative error code if configuration space would become empty */ -int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val) +int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access) { - return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, val, 0); + return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, access, 0); } /** * \brief Restrict a configuration space to contain only its first access type * \param pcm PCM handle * \param params Configuration space - * \return access type + * \param access Returned first access type + * \return 0 otherwise a negative error code */ -snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_access_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access) +#else +int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, access, NULL); } /** * \brief Restrict a configuration space to contain only its last access type * \param pcm PCM handle * \param params Configuration space - * \return access type + * \param val Returned last access type + * \return 0 otherwise a negative error code */ -snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_access_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access) +#else +int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_ACCESS, access, NULL); } /** @@ -2793,7 +2797,7 @@ snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_pa * \param pcm PCM handle * \param params Configuration space * \param mask Access mask - * \return access type + * \return 0 otherwise a negative error code */ int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask) { @@ -2805,82 +2809,84 @@ int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *param * \param params Configuration space * \param mask Returned Access mask */ -void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask) +int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask) { + if (params == NULL || mask == NULL) + return -EINVAL; snd_pcm_access_mask_copy(mask, snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS)); + return 0; } /** * \brief Extract format from a configuration space * \param params Configuration space - * \param val returned format + * \param format returned format * \return format otherwise a negative error code if not exactly one is present */ -int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_format)(const snd_pcm_hw_params_t *params, snd_pcm_format_t *format) +#else +int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *format) +#endif { - int err; - - assert(val); - err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, NULL); - if (err < 0) - return err; - *val = err; - return 0; + return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, format, NULL); } /** * \brief Verify if a format is available inside a configuration space for a PCM * \param pcm PCM handle * \param params Configuration space - * \param val format + * \param format format * \return 1 if available 0 otherwise */ -int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val) +int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t format) { - return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_FORMAT, val, 0); + return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_FORMAT, format, 0); } /** * \brief Restrict a configuration space to contain only one format * \param pcm PCM handle * \param params Configuration space - * \param val format - * \return 0 otherwise a negative error code if configuration space would become empty + * \param format format + * \return 0 otherwise a negative error code */ -int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val) +int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t format) { - return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, val, 0); + return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, format, 0); } /** * \brief Restrict a configuration space to contain only its first format * \param pcm PCM handle * \param params Configuration space - * \return format + * \param format Returned first format + * \return 0 otherwise a negative error code */ -snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_format_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format) +#else +int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, format, NULL); } /** * \brief Restrict a configuration space to contain only its last format * \param pcm PCM handle * \param params Configuration space - * \return format + * \param format Returned last format + * \return 0 otherwise a negative error code */ -snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_format_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format) +#else +int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_FORMAT, format, NULL); } /** @@ -2888,7 +2894,7 @@ snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_pa * \param pcm PCM handle * \param params Configuration space * \param mask Format mask - * \return access type + * \return 0 otherwise a negative error code */ int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask) { @@ -2907,75 +2913,74 @@ void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_form /** - * \brief Verify if a subformat is available inside a configuration space for a PCM - * \param pcm PCM handle + * \brief Extract subformat from a configuration space * \param params Configuration space - * \param val subformat - * \return 1 if available 0 otherwise + * \param subformat Returned subformat value + * \return subformat otherwise a negative error code if not exactly one is present */ -int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_subformat)(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) +#else +int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) +#endif { - return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_SUBFORMAT, val, 0); + return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL); } /** - * \brief Extract subformat from a configuration space + * \brief Verify if a subformat is available inside a configuration space for a PCM + * \param pcm PCM handle * \param params Configuration space - * \param val Returned subformat - * \return subformat otherwise a negative error code if not exactly one is present + * \param subformat subformat value + * \return 1 if available 0 otherwise */ -int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *val) +int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat) { - int err; - - assert(val); - err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, NULL); - if (err < 0) - return err; - *val = (snd_pcm_subformat_t)err; - return 0; + return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_SUBFORMAT, subformat, 0); } /** * \brief Restrict a configuration space to contain only one subformat * \param pcm PCM handle * \param params Configuration space - * \param val subformat + * \param subformat subformat value * \return 0 otherwise a negative error code if configuration space would become empty */ -int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val) +int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat) { - return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, val, 0); + return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, subformat, 0); } /** * \brief Restrict a configuration space to contain only its first subformat * \param pcm PCM handle * \param params Configuration space - * \return subformat + * \param subformat Returned subformat + * \return 0 otherwise a negative error code */ -snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_subformat_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) +#else +int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL); } /** * \brief Restrict a configuration space to contain only its last subformat * \param pcm PCM handle * \param params Configuration space - * \return subformat + * \param subformat Returned subformat + * \return 0 otherwise a negative error code */ -snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_subformat_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) +#else +int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, subformat, NULL); } /** @@ -2983,7 +2988,7 @@ snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm * \param pcm PCM handle * \param params Configuration space * \param mask Subformat mask - * \return access type + * \return 0 otherwise a negative error code */ int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask) { @@ -3004,31 +3009,46 @@ void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_s /** * \brief Extract channels from a configuration space * \param params Configuration space - * \return channels count otherwise a negative error code if not exactly one is present + * \param val Returned channels count + * \return 0 otherwise a negative error code if not exactly one is present */ -int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *params, unsigned int *val) +#else +int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val) +#endif { - return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_CHANNELS, NULL); + return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_CHANNELS, val, NULL); } /** * \brief Extract minimum channels count from a configuration space * \param params Configuration space - * \return minimum channels count + * \param val minimum channels count + * \return 0 otherwise a negative error code */ -unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_channels_min)(const snd_pcm_hw_params_t *params, unsigned int *val) +#else +int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val) +#endif { - return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_CHANNELS, NULL); + return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_CHANNELS, val, NULL); } /** * \brief Extract maximum channels count from a configuration space * \param params Configuration space - * \return maximum channels count + * \param val maximum channels count + * \return 0 otherwise a negative error code */ -unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_channels_max)(const snd_pcm_hw_params_t *params, unsigned int *val) +#else +int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val) +#endif { - return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, NULL); + return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, val, NULL); } /** @@ -3096,86 +3116,103 @@ int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *p * \brief Restrict a configuration space to have channels count nearest to a target * \param pcm PCM handle * \param params Configuration space - * \param val target channels count + * \param val target channels count, returned chosen channels count * \return chosen channels count */ -unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_channels_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) +#else +int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_CHANNELS, val, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_CHANNELS, val, NULL); } /** * \brief Restrict a configuration space to contain only its minimum channels count * \param pcm PCM handle * \param params Configuration space - * \return channels count + * \param val minimum channels count + * \return 0 otherwise a negative error code */ -unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_channels_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) +#else +int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_CHANNELS, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_CHANNELS, val, NULL); } /** * \brief Restrict a configuration space to contain only its maximum channels count * \param pcm PCM handle * \param params Configuration space - * \return channels count + * \param val maximum channels count + * \return 0 otherwise a negative error code */ -unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_channels_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) +#else +int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_CHANNELS, NULL, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_CHANNELS, val, NULL); } /** * \brief Extract rate from a configuration space * \param params Configuration space + * \param val Returned approximate rate * \param dir Sub unit direction - * \return approximate rate otherwise a negative error code if not exactly one is present + * \return 0 otherwise a negative error code if not exactly one is present * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_rate)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_RATE, dir); + return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_RATE, val, dir); } /** * \brief Extract minimum rate from a configuration space * \param params Configuration space + * \param val Returned approximate minimum rate * \param dir Sub unit direction - * \return approximate minimum rate + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_rate_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, dir); + return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, val, dir); } /** * \brief Extract maximum rate from a configuration space * \param params Configuration space + * \param val Returned approximate maximum rate * \param dir Sub unit direction - * \return approximate maximum rate + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_rate_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_RATE, dir); + return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_RATE, val, dir); } /** @@ -3259,94 +3296,111 @@ int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *param * \brief Restrict a configuration space to have rate nearest to a target * \param pcm PCM handle * \param params Configuration space - * \param val approximate target rate + * \param val approximate target rate / returned approximate set rate * \return approximate chosen rate * * target/chosen exact value is <,=,> val following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_rate_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_RATE, val, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_RATE, val, dir); } /** * \brief Restrict a configuration space to contain only its minimum rate * \param pcm PCM handle * \param params Configuration space + * \param val Returned minimum approximate rate * \param dir Sub unit direction - * \return approximate rate + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_rate_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, val, dir); } /** * \brief Restrict a configuration space to contain only its maximum rate * \param pcm PCM handle * \param params Configuration space + * \param val Returned maximum approximate rate * \param dir Sub unit direction - * \return approximate rate + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_rate_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_RATE, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_RATE, val, dir); } /** * \brief Extract period time from a configuration space * \param params Configuration space + * \param val Returned approximate period duration in us * \param dir Sub unit direction - * \return approximate period duration in us otherwise a negative error code if not exactly one is present + * \return 0 otherwise a negative error code if not exactly one is present * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_period_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_TIME, dir); + return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); } /** * \brief Extract minimum period time from a configuration space * \param params Configuration space + * \param val approximate minimum period duration in us * \param dir Sub unit direction - * \return approximate minimum period duration in us + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_period_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIOD_TIME, dir); + return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); } /** * \brief Extract maximum period time from a configuration space * \param params Configuration space + * \param val approximate maximum period duration in us * \param dir Sub unit direction - * \return approximate maximum period duration in us + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_period_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, dir); + return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); } /** @@ -3431,36 +3485,37 @@ int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t * \brief Restrict a configuration space to have period time nearest to a target * \param pcm PCM handle * \param params Configuration space - * \param val approximate target period duration in us + * \param val approximate target period duration in us / returned chosen approximate target period duration * \return approximate chosen period duration in us * * target/chosen exact value is <,=,> val following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_period_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); } /** * \brief Restrict a configuration space to contain only its minimum period time * \param pcm PCM handle * \param params Configuration space + * \param val Returned approximate period duration in us * \param dir Sub unit direction - * \return approximate period duration in us + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_period_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); } /** @@ -3472,53 +3527,80 @@ unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_ * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_period_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir); } /** * \brief Extract period size from a configuration space * \param params Configuration space + * \param val Returned approximate period size in frames * \param dir Sub unit direction - * \return approximate period size in frames otherwise a negative error code if not exactly one is present + * \return 0 otherwise a negative error code if not exactly one is present * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_period_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#else +int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#endif { - return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir); + unsigned int _val; + int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); + if (err >= 0) + *val = _val; + return err; } /** * \brief Extract minimum period size from a configuration space * \param params Configuration space + * \param val approximate minimum period size in frames * \param dir Sub unit direction - * \return approximate minimum period size in frames + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_period_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#else +int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#endif { - return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir); + unsigned int _val = *val; + int err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); + if (err >= 0) + *val = _val; + return err; } /** * \brief Extract maximum period size from a configuration space * \param params Configuration space + * \param val approximate minimum period size in frames * \param dir Sub unit direction - * \return approximate maximum period size in frames + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_period_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#else +int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#endif { - return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir); + unsigned int _val = *val; + int err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); + if (err >= 0) + *val = _val; + return err; } /** @@ -3565,7 +3647,8 @@ int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *p { unsigned int _val = *val; int err = snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); - *val = _val; + if (err >= 0) + *val = _val; return err; } @@ -3583,7 +3666,8 @@ int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *p { unsigned int _val = *val; int err = snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); - *val = _val; + if (err >= 0) + *val = _val; return err; } @@ -3613,54 +3697,68 @@ int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t * \brief Restrict a configuration space to have period size nearest to a target * \param pcm PCM handle * \param params Configuration space - * \param val approximate target period size in frames - * \return approximate chosen period size in frames + * \param val approximate target period size in frames / returned chosen approximate target period size + * \return 0 otherwise a negative error code * * target/chosen exact value is <,=,> val following dir (-1,0,1) */ -snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_period_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#else +int snd_pcm_hw_params_set_period_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir, &res) < 0) - return 0; - return res; + unsigned int _val = *val; + int err = snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); + if (err >= 0) + *val = _val; + return err; } /** * \brief Restrict a configuration space to contain only its minimum period size * \param pcm PCM handle * \param params Configuration space + * \param val Returned maximum approximate period size in frames * \param dir Sub unit direction - * \return approximate period size in frames + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_period_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#else +int snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir, &res) < 0) - return 0; - return res; + unsigned int _val; + int err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); + if (err >= 0) + *val = _val; + return err; } /** * \brief Restrict a configuration space to contain only its maximum period size * \param pcm PCM handle * \param params Configuration space + * \param val Returned maximum approximate period size in frames * \param dir Sub unit direction - * \return approximate period size in frames + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_period_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#else +int snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir, &res) < 0) - return 0; - return res; + unsigned int _val; + int err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir); + if (err >= 0) + *val = _val; + return err; } /** @@ -3678,40 +3776,55 @@ int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_ /** * \brief Extract periods from a configuration space * \param params Configuration space + * \param val approximate periods per buffer * \param dir Sub unit direction - * \return approximate periods per buffer otherwise a negative error code if not exactly one is present + * \return 0 otherwise a negative error code if not exactly one is present * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_periods)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIODS, dir); + return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIODS, val, dir); } /** * \brief Extract minimum periods count from a configuration space * \param params Configuration space + * \param val approximate minimum periods per buffer * \param dir Sub unit direction - * \return approximate minimum periods per buffer + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_periods_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIODS, dir); + return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_PERIODS, val, dir); } /** * \brief Extract maximum periods count from a configuration space * \param params Configuration space + * \param val approximate maximum periods per buffer * \param dir Sub unit direction - * \return approximate maximum periods per buffer + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_periods_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIODS, dir); + return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIODS, val, dir); } /** @@ -3795,54 +3908,56 @@ int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *pa * \brief Restrict a configuration space to have periods count nearest to a target * \param pcm PCM handle * \param params Configuration space - * \param val approximate target periods per buffer + * \param val approximate target periods per buffer / returned chosen approximate target periods per buffer * \return approximate chosen periods per buffer * * target/chosen exact value is <,=,> val following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_periods_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIODS, val, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_PERIODS, val, dir); } /** * \brief Restrict a configuration space to contain only its minimum periods count * \param pcm PCM handle * \param params Configuration space + * \param val Returned approximate minimum periods per buffer * \param dir Sub unit direction - * \return approximate periods per buffer + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_periods_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIODS, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIODS, val, dir); } /** * \brief Restrict a configuration space to contain only its maximum periods count * \param pcm PCM handle * \param params Configuration space + * \param val Returned approximate maximum periods per buffer * \param dir Sub unit direction - * \return approximate periods per buffer + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_periods_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIODS, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIODS, val, dir); } /** @@ -3860,40 +3975,56 @@ int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *p /** * \brief Extract buffer time from a configuration space * \param params Configuration space + * \param approximate buffer duration in us + * \param val Returned buffer time in us * \param dir Sub unit direction - * \return approximate buffer duration in us otherwise a negative error code if not exactly one is present + * \return 0 otherwise a negative error code if not exactly one is present * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_buffer_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_BUFFER_TIME, dir); + return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); } /** * \brief Extract minimum buffer time from a configuration space * \param params Configuration space + * \param val approximate minimum buffer duration in us * \param dir Sub unit direction - * \return approximate minimum buffer duration in us + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_buffer_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_BUFFER_TIME, dir); + return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); } /** * \brief Extract maximum buffer time from a configuration space * \param params Configuration space + * \param val approximate maximum buffer duration in us * \param dir Sub unit direction - * \return approximate maximum buffer duration in us + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_buffer_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_TIME, dir); + return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); } /** @@ -3977,91 +4108,120 @@ int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t * \brief Restrict a configuration space to have buffer time nearest to a target * \param pcm PCM handle * \param params Configuration space - * \param val approximate target buffer duration in us + * \param val approximate target buffer duration in us / returned chosen approximate target buffer duration * \return approximate chosen buffer duration in us * * target/chosen exact value is <,=,> val following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); } /** * \brief Restrict a configuration space to contain only its minimum buffer time * \param pcm PCM handle * \param params Configuration space + * \param val Returned approximate minimum buffer duration in us * \param dir Sub unit direction - * \return approximate buffer duration in us + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_buffer_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); } /** * \brief Restrict a configuration space to contain only its maximum buffered time * \param pcm PCM handle * \param params Configuration space + * \param val Returned approximate maximum buffer duration in us * \param dir Sub unit direction - * \return approximate buffer duration in us + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_buffer_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir); } /** * \brief Extract buffer size from a configuration space * \param params Configuration space - * \return buffer size in frames otherwise a negative error code if not exactly one is present + * \param val Returned buffer size in frames + * \return 0 otherwise a negative error code if not exactly one is present */ -snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_buffer_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#else +int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#endif { - return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL); + unsigned int _val; + int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); + if (err >= 0) + *val = _val; + return err; } /** * \brief Extract minimum buffer size from a configuration space * \param params Configuration space + * \param val Returned approximate minimum buffer size in frames * \param dir Sub unit direction - * \return approximate minimum buffer size in frames + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_buffer_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#else +int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#endif { - return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL); + unsigned int _val; + int err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); + if (err >= 0) + *val = _val; + return err; } /** * \brief Extract maximum buffer size from a configuration space * \param params Configuration space + * \param val Returned approximate maximum buffer size in frames * \param dir Sub unit direction - * \return approximate maximum buffer size in frames + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_buffer_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#else +int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#endif { - return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL); + unsigned int _val; + int err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); + if (err >= 0) + *val = _val; + return err; } /** @@ -4107,7 +4267,8 @@ int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *p { unsigned int _val = *val; int err = snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); - *val = _val; + if (err >= 0) + *val = _val; return err; } @@ -4125,7 +4286,8 @@ int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *p { unsigned int _val = *val; int err = snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); - *val = _val; + if (err >= 0) + *val = _val; return err; } @@ -4155,88 +4317,117 @@ int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t * \brief Restrict a configuration space to have buffer size nearest to a target * \param pcm PCM handle * \param params Configuration space - * \param val approximate target buffer size in frames + * \param val approximate target buffer size in frames / returned chosen approximate target buffer size in frames * \return approximate chosen buffer size in frames * * target/chosen exact value is <,=,> val following dir (-1,0,1) */ -snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#else +int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, val, NULL, &res) < 0) - return 0; - return res; + unsigned int _val = *val; + int err = snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); + if (err >= 0) + *val = _val; + return err; } /** * \brief Restrict a configuration space to contain only its minimum buffer size * \param pcm PCM handle * \param params Configuration space + * \param val Returned minimum buffer size in frames * \return buffer size in frames */ -snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_buffer_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#else +int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL, &res) < 0) - return 0; - return res; + unsigned int _val; + int err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); + if (err >= 0) + *val = _val; + return err; } /** * \brief Restrict a configuration space to contain only its maximum buffer size * \param pcm PCM handle * \param params Configuration space - * \return buffer size in frames + * \param val Returned maximum buffer size in frames + * \return 0 otherwise a negative error code */ -snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_buffer_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#else +int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL, &res) < 0) - return 0; - return res; + unsigned int _val; + int err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL); + if (err >= 0) + *val = _val; + return err; } /** * \brief Extract tick time from a configuration space * \param params Configuration space + * \param val Returned approximate tick duration in us * \param dir Sub unit direction - * \return approximate tick duration in us otherwise a negative error code if not exactly one is present + * \return 0 otherwise a negative error code if not exactly one is present * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_tick_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_TICK_TIME, dir); + return snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_TICK_TIME, val, dir); } /** * \brief Extract minimum tick time from a configuration space * \param params Configuration space + * \param val Returned approximate minimum tick duration in us * \param dir Sub unit direction - * \return approximate minimum tick duration in us + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_tick_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_TICK_TIME, dir); + return snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_TICK_TIME, val, dir); } /** * \brief Extract maximum tick time from a configuration space * \param params Configuration space + * \param val Returned approximate maximum tick duration in us * \param dir Sub unit direction - * \return approximate maximum tick duration in us + * \return 0 otherwise a negative error code * * Exact value is <,=,> the returned one following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_get_tick_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_TICK_TIME, dir); + return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_TICK_TIME, val, dir); } /** @@ -4320,79 +4511,85 @@ int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t * * \brief Restrict a configuration space to have tick time nearest to a target * \param pcm PCM handle * \param params Configuration space - * \param val approximate target tick duration in us + * \param val approximate target tick duration in us / returned chosen approximate target tick duration in us * \return approximate chosen tick duration in us * * target/chosen exact value is <,=,> val following dir (-1,0,1) */ -unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_tick_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, val, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_near(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, val, dir); } /** * \brief Restrict a configuration space to contain only its minimum tick time * \param pcm PCM handle * \param params Configuration space + * \param val Returned approximate minimum tick duration in us * \param dir Sub unit direction - * \return approximate tick duration in us + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_tick_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, val, dir); } /** * \brief Restrict a configuration space to contain only its maximum tick time * \param pcm PCM handle * \param params Configuration space + * \param val Returned approximate maximum tick duration in us * \param dir Sub unit direction - * \return approximate tick duration in us + * \return 0 otherwise a negative error code * * Actual exact value is <,=,> the approximate one following dir (-1, 0, 1) */ -unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) +#ifndef DOXYGEN +int INTERNAL(snd_pcm_hw_params_set_tick_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#else +int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +#endif { - unsigned int res; - - if (snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, dir, &res) < 0) - return 0; - return res; + return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, val, dir); } /** * \brief Get the minimum transfer align value in samples * \param params Configuration space - * \return minimum align value otherwise a negative error code if not exactly one is present + * \param val Returned minimum align value + * \return 0 otherwise a negative error code if not exactly one is present */ -snd_pcm_sframes_t snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params) +int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) { - int format, channels, fb, min_align; + unsigned int format, channels, fb, min_align; + int err; - format = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, NULL); - if (format < 0) - return format; - channels = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_CHANNELS, NULL); - if (channels < 0) - return channels; + err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, &format, NULL); + if (err < 0) + return err; + err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_CHANNELS, &channels, NULL); + if (err < 0) + return err; // compute frame bits - fb = snd_pcm_format_physical_width(format) * channels; + fb = snd_pcm_format_physical_width((snd_pcm_format_t)format) * channels; min_align = 1; while (fb % 8) { fb *= 2; min_align *= 2; } - return min_align; + if (val) + *val = min_align; + return 0; } /** @@ -5778,4 +5975,212 @@ void snd_pcm_unlink_appl_ptr(snd_pcm_t *pcm, snd_pcm_t *slave) snd_pcm_unlink_ptr(pcm, &pcm->appl, slave, &slave->appl); } +#endif /* DOC_HIDDEN */ + +/* + * + */ + +#ifndef DOC_HIDDEN + +#ifdef USE_VERSIONED_SYMBOLS + +#ifndef SND_COMPATIBILITY_BUILD_RC3 + +#define OBSOLETE1(name, what, new) \ + symbol_version(__old_##name, name, what); \ + default_symbol_version(__##name, name, new); + +#else + +#define OBSOLETE1(name, what, new) \ + default_symbol_version(__old_##name, name, what); + #endif + +#define __OLD_GET(name, val_type, ret_type) \ +ret_type __old_##name(const snd_pcm_hw_params_t *params) \ +{ \ + val_type val; \ + if (INTERNAL(name)(params, &val) < 0) \ + return 0; \ + return (ret_type)val; \ +} + +#define __OLD_GET1(name, val_type, ret_type) \ +ret_type __old_##name(const snd_pcm_hw_params_t *params, int *dir) \ +{ \ + val_type val; \ + if (INTERNAL(name)(params, &val, dir) < 0) \ + return 0; \ + return (ret_type)val; \ +} + +__OLD_GET(snd_pcm_hw_params_get_access, snd_pcm_access_t, int); +__OLD_GET(snd_pcm_hw_params_get_format, snd_pcm_format_t, int); +__OLD_GET(snd_pcm_hw_params_get_subformat, snd_pcm_subformat_t, int); +__OLD_GET(snd_pcm_hw_params_get_channels, unsigned int, int); +__OLD_GET1(snd_pcm_hw_params_get_rate, unsigned int, int); +__OLD_GET1(snd_pcm_hw_params_get_period_time, unsigned int, int); +__OLD_GET1(snd_pcm_hw_params_get_period_size, snd_pcm_uframes_t, snd_pcm_sframes_t); +__OLD_GET1(snd_pcm_hw_params_get_periods, unsigned int, int); +__OLD_GET1(snd_pcm_hw_params_get_buffer_time, unsigned int, int); +__OLD_GET(snd_pcm_hw_params_get_buffer_size, snd_pcm_uframes_t, snd_pcm_sframes_t); +__OLD_GET1(snd_pcm_hw_params_get_tick_time, unsigned int, int); + +__OLD_GET(snd_pcm_hw_params_get_channels_min, unsigned int, unsigned int); +__OLD_GET1(snd_pcm_hw_params_get_rate_min, unsigned int, unsigned int); +__OLD_GET1(snd_pcm_hw_params_get_period_time_min, unsigned int, unsigned int); +__OLD_GET1(snd_pcm_hw_params_get_period_size_min, snd_pcm_uframes_t, snd_pcm_uframes_t); +__OLD_GET1(snd_pcm_hw_params_get_periods_min, unsigned int, unsigned int); +__OLD_GET1(snd_pcm_hw_params_get_buffer_time_min, unsigned int, unsigned int); +__OLD_GET(snd_pcm_hw_params_get_buffer_size_min, snd_pcm_uframes_t, snd_pcm_uframes_t); +__OLD_GET1(snd_pcm_hw_params_get_tick_time_min, unsigned int, unsigned int); + +__OLD_GET(snd_pcm_hw_params_get_channels_max, unsigned int, unsigned int); +__OLD_GET1(snd_pcm_hw_params_get_rate_max, unsigned int, unsigned int); +__OLD_GET1(snd_pcm_hw_params_get_period_time_max, unsigned int, unsigned int); +__OLD_GET1(snd_pcm_hw_params_get_period_size_max, snd_pcm_uframes_t, snd_pcm_uframes_t); +__OLD_GET1(snd_pcm_hw_params_get_periods_max, unsigned int, unsigned int); +__OLD_GET1(snd_pcm_hw_params_get_buffer_time_max, unsigned int, unsigned int); +__OLD_GET(snd_pcm_hw_params_get_buffer_size_max, snd_pcm_uframes_t, snd_pcm_uframes_t); +__OLD_GET1(snd_pcm_hw_params_get_tick_time_max, unsigned int, unsigned int); + +#define __OLD_NEAR(name, ret_type) \ +ret_type __old_##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ret_type val) \ +{ \ + if (INTERNAL(name)(pcm, params, &val) < 0) \ + return 0; \ + return (ret_type)val; \ +} + +#define __OLD_NEAR1(name, ret_type) \ +ret_type __old_##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, ret_type val, int *dir) \ +{ \ + if (INTERNAL(name)(pcm, params, &val, dir) < 0) \ + return 0; \ + return (ret_type)val; \ +} + +__OLD_NEAR(snd_pcm_hw_params_set_channels_near, unsigned int); +__OLD_NEAR1(snd_pcm_hw_params_set_rate_near, unsigned int); +__OLD_NEAR1(snd_pcm_hw_params_set_period_time_near, unsigned int); +__OLD_NEAR1(snd_pcm_hw_params_set_period_size_near, snd_pcm_uframes_t); +__OLD_NEAR1(snd_pcm_hw_params_set_periods_near, unsigned int); +__OLD_NEAR1(snd_pcm_hw_params_set_buffer_time_near, unsigned int); +__OLD_NEAR(snd_pcm_hw_params_set_buffer_size_near, snd_pcm_uframes_t); +__OLD_NEAR1(snd_pcm_hw_params_set_tick_time_near, unsigned int); + +#define __OLD_SET_FL(name, ret_type) \ +ret_type __old_##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) \ +{ \ + ret_type val; \ + if (INTERNAL(name)(pcm, params, &val) < 0) \ + return 0; \ + return (ret_type)val; \ +} + +#define __OLD_SET_FL1(name, ret_type) \ +ret_type __old_##name(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir) \ +{ \ + ret_type val; \ + if (INTERNAL(name)(pcm, params, &val, dir) < 0) \ + return 0; \ + return (ret_type)val; \ +} + +__OLD_SET_FL(snd_pcm_hw_params_set_access_first, snd_pcm_access_t); +__OLD_SET_FL(snd_pcm_hw_params_set_format_first, snd_pcm_format_t); +__OLD_SET_FL(snd_pcm_hw_params_set_subformat_first, snd_pcm_subformat_t); +__OLD_SET_FL(snd_pcm_hw_params_set_channels_first, unsigned int); +__OLD_SET_FL1(snd_pcm_hw_params_set_rate_first, unsigned int); +__OLD_SET_FL1(snd_pcm_hw_params_set_period_time_first, unsigned int); +__OLD_SET_FL1(snd_pcm_hw_params_set_period_size_first, snd_pcm_uframes_t); +__OLD_SET_FL1(snd_pcm_hw_params_set_periods_first, unsigned int); +__OLD_SET_FL1(snd_pcm_hw_params_set_buffer_time_first, unsigned int); +__OLD_SET_FL(snd_pcm_hw_params_set_buffer_size_first, snd_pcm_uframes_t); +__OLD_SET_FL1(snd_pcm_hw_params_set_tick_time_first, unsigned int); + +__OLD_SET_FL(snd_pcm_hw_params_set_access_last, snd_pcm_access_t); +__OLD_SET_FL(snd_pcm_hw_params_set_format_last, snd_pcm_format_t); +__OLD_SET_FL(snd_pcm_hw_params_set_subformat_last, snd_pcm_subformat_t); +__OLD_SET_FL(snd_pcm_hw_params_set_channels_last, unsigned int); +__OLD_SET_FL1(snd_pcm_hw_params_set_rate_last, unsigned int); +__OLD_SET_FL1(snd_pcm_hw_params_set_period_time_last, unsigned int); +__OLD_SET_FL1(snd_pcm_hw_params_set_period_size_last, snd_pcm_uframes_t); +__OLD_SET_FL1(snd_pcm_hw_params_set_periods_last, unsigned int); +__OLD_SET_FL1(snd_pcm_hw_params_set_buffer_time_last, unsigned int); +__OLD_SET_FL(snd_pcm_hw_params_set_buffer_size_last, snd_pcm_uframes_t); +__OLD_SET_FL1(snd_pcm_hw_params_set_tick_time_last, unsigned int); + +OBSOLETE1(snd_pcm_hw_params_get_access, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_access_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_access_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_format, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_format_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_format_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_subformat, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_subformat_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_subformat_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_channels, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_channels_min, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_channels_max, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_channels_near, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_channels_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_channels_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_rate, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_rate_min, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_rate_max, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_rate_near, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_rate_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_rate_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_period_time, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_period_time_min, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_period_time_max, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_period_time_near, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_period_time_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_period_time_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_period_size, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_period_size_min, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_period_size_max, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_period_size_near, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_period_size_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_period_size_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_periods, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_periods_min, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_periods_max, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_periods_near, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_periods_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_periods_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_buffer_time, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_buffer_time_min, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_buffer_time_max, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_buffer_time_near, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_buffer_time_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_buffer_time_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_buffer_size, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_buffer_size_min, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_buffer_size_max, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_buffer_size_near, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_buffer_size_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_buffer_size_last, ALSA_0.9, ALSA_0.9.0rc4); + +OBSOLETE1(snd_pcm_hw_params_get_tick_time, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_tick_time_min, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_get_tick_time_max, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_tick_time_near, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_tick_time_first, ALSA_0.9, ALSA_0.9.0rc4); +OBSOLETE1(snd_pcm_hw_params_set_tick_time_last, ALSA_0.9, ALSA_0.9.0rc4); + +#endif /* USE_VERSIONED_SYMBOLS */ + +#endif /* DOC_HIDDEN */ diff --git a/src/pcm/pcm_adpcm.c b/src/pcm/pcm_adpcm.c index 83729f40..85fbfe5d 100644 --- a/src/pcm/pcm_adpcm.c +++ b/src/pcm/pcm_adpcm.c @@ -416,7 +416,7 @@ static int snd_pcm_adpcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) if (err < 0) return err; - err = snd_pcm_hw_params_get_format(params, &format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format); if (err < 0) return err; diff --git a/src/pcm/pcm_alaw.c b/src/pcm/pcm_alaw.c index 6f46d147..4ade3424 100644 --- a/src/pcm/pcm_alaw.c +++ b/src/pcm/pcm_alaw.c @@ -312,7 +312,7 @@ static int snd_pcm_alaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) if (err < 0) return err; - err = snd_pcm_hw_params_get_format(params, &format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format); if (err < 0) return err; diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 3a873493..852f6448 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -270,7 +270,7 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) *params = old; pmask = snd_pcm_hw_param_get_mask(params, SND_PCM_HW_PARAM_ACCESS); oldmask = *(snd_pcm_access_mask_t *)pmask; - if (snd_pcm_hw_params_get_access(params, &access) < 0) + if (INTERNAL(snd_pcm_hw_params_get_access)(params, &access) < 0) goto _err; switch (access) { case SND_PCM_ACCESS_MMAP_INTERLEAVED: diff --git a/src/pcm/pcm_lfloat.c b/src/pcm/pcm_lfloat.c index 2bce2cdf..1280db42 100644 --- a/src/pcm/pcm_lfloat.c +++ b/src/pcm/pcm_lfloat.c @@ -278,11 +278,11 @@ static int snd_pcm_lfloat_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) if (err < 0) return err; if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { - err = snd_pcm_hw_params_get_format(params, &src_format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &src_format); dst_format = slave->format; } else { src_format = slave->format; - err = snd_pcm_hw_params_get_format(params, &dst_format); + 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); diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c index 98afd51e..4a4e4291 100644 --- a/src/pcm/pcm_linear.c +++ b/src/pcm/pcm_linear.c @@ -318,7 +318,7 @@ static int snd_pcm_linear_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) snd_pcm_plugin_hw_params_slave); if (err < 0) return err; - err = snd_pcm_hw_params_get_format(params, &format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format); if (err < 0) return err; linear->use_getput = (snd_pcm_format_physical_width(format) == 24 || diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index aa2341cd..ce3e6a74 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -496,12 +496,11 @@ int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_hw_param_t var); int snd_pcm_hw_param_set_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, int *dir, unsigned int *rval); + snd_pcm_hw_param_t var, unsigned int *rval, int *dir); int snd_pcm_hw_param_set_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, int *dir, unsigned int *rval); + snd_pcm_hw_param_t var, unsigned int *rval, int *dir); int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, unsigned int val, - int *dir, unsigned int *rval); + snd_pcm_hw_param_t var, unsigned int *val, int *dir); int snd_pcm_hw_param_set_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_hw_param_t var, @@ -520,12 +519,139 @@ int snd_pcm_hw_param_set(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int snd_pcm_hw_param_set_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_hw_param_t var, const snd_mask_t *mask); -int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, int *dir); -unsigned int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, int *dir); -unsigned int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, int *dir); +int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, + unsigned int *val, int *dir); +int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params, + snd_pcm_hw_param_t var, + unsigned int *val, int *dir); +int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params, + snd_pcm_hw_param_t var, + unsigned int *val, int *dir); + +#ifdef INTERNAL +int INTERNAL(snd_pcm_hw_params_get_access)(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access); +int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access); +int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access); +int INTERNAL(snd_pcm_hw_params_set_access_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access); +int INTERNAL(snd_pcm_hw_params_set_access_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access); +int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); +int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); + +int INTERNAL(snd_pcm_hw_params_get_format)(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val); +int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); +int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); +int INTERNAL(snd_pcm_hw_params_set_format_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format); +int INTERNAL(snd_pcm_hw_params_set_format_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format); +int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); +void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); + +int INTERNAL(snd_pcm_hw_params_get_subformat)(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); +int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat); +int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat); +int INTERNAL(snd_pcm_hw_params_set_subformat_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); +int INTERNAL(snd_pcm_hw_params_set_subformat_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); +int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); +void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); + +int INTERNAL(snd_pcm_hw_params_get_channels)(const snd_pcm_hw_params_t *params, unsigned int *val); +int INTERNAL(snd_pcm_hw_params_get_channels_min)(const snd_pcm_hw_params_t *params, unsigned int *val); +int INTERNAL(snd_pcm_hw_params_get_channels_max)(const snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); +int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); +int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); +int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max); +int INTERNAL(snd_pcm_hw_params_set_channels_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); +int INTERNAL(snd_pcm_hw_params_set_channels_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); +int INTERNAL(snd_pcm_hw_params_set_channels_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); + +int INTERNAL(snd_pcm_hw_params_get_rate)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_rate_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_rate_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int INTERNAL(snd_pcm_hw_params_set_rate_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_rate_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_rate_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); + +int INTERNAL(snd_pcm_hw_params_get_period_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_period_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_period_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int INTERNAL(snd_pcm_hw_params_set_period_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_period_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_period_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); + +int INTERNAL(snd_pcm_hw_params_get_period_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); +int INTERNAL(snd_pcm_hw_params_get_period_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); +int INTERNAL(snd_pcm_hw_params_get_period_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); +int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir); +int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir); +int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir); +int INTERNAL(snd_pcm_hw_params_set_period_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_period_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_period_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir); +int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + +int INTERNAL(snd_pcm_hw_params_get_periods)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_periods_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_periods_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); + +int INTERNAL(snd_pcm_hw_params_get_buffer_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_buffer_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_buffer_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_buffer_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_buffer_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); + +int INTERNAL(snd_pcm_hw_params_get_buffer_size)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int INTERNAL(snd_pcm_hw_params_get_buffer_size_min)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int INTERNAL(snd_pcm_hw_params_get_buffer_size_max)(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); +int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); +int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max); +int INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int INTERNAL(snd_pcm_hw_params_set_buffer_size_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); +int INTERNAL(snd_pcm_hw_params_set_buffer_size_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); + +int INTERNAL(snd_pcm_hw_params_get_tick_time)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_tick_time_min)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_get_tick_time_max)(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); +int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir); +int INTERNAL(snd_pcm_hw_params_set_tick_time_near)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_tick_time_first)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +int INTERNAL(snd_pcm_hw_params_set_tick_time_last)(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); +#endif /* INTERNAL */ + const char *snd_pcm_hw_param_name(snd_pcm_hw_param_t param); void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, snd_output_t *out); diff --git a/src/pcm/pcm_mulaw.c b/src/pcm/pcm_mulaw.c index f1d39447..6534f84e 100644 --- a/src/pcm/pcm_mulaw.c +++ b/src/pcm/pcm_mulaw.c @@ -327,7 +327,7 @@ static int snd_pcm_mulaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) if (err < 0) return err; - err = snd_pcm_hw_params_get_format(params, &format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format); if (err < 0) return err; diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c index 4e63ad87..3881e32a 100644 --- a/src/pcm/pcm_params.c +++ b/src/pcm/pcm_params.c @@ -101,8 +101,8 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params) /* Return the value for field PAR if it's fixed in configuration space defined by PARAMS. Return -EINVAL otherwise */ -int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, int *dir) +int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, + unsigned int *val, int *dir) { if (hw_is_mask(var)) { const snd_mask_t *mask = hw_param_mask_c(params, var); @@ -110,53 +110,62 @@ int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, return -EINVAL; if (dir) *dir = 0; - return snd_mask_value(mask); - } - if (hw_is_interval(var)) { + if (val) + *val = snd_mask_value(mask); + return 0; + } else if (hw_is_interval(var)) { const snd_interval_t *i = hw_param_interval_c(params, var); if (snd_interval_empty(i) || !snd_interval_single(i)) return -EINVAL; if (dir) *dir = i->openmin; - return snd_interval_value(i); + if (val) + *val = snd_interval_value(i); + return 0; } assert(0); return -EINVAL; } /* Return the minimum value for field PAR. */ -unsigned int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, int *dir) +int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, + unsigned int *val, int *dir) { if (hw_is_mask(var)) { if (dir) *dir = 0; - return snd_mask_min(hw_param_mask_c(params, var)); - } - if (hw_is_interval(var)) { + if (val) + *val = snd_mask_min(hw_param_mask_c(params, var)); + return 0; + } else if (hw_is_interval(var)) { const snd_interval_t *i = hw_param_interval_c(params, var); if (dir) *dir = i->openmin; - return snd_interval_min(i); + if (val) + *val = snd_interval_min(i); + return 0; } assert(0); return 0; } /* Return the maximum value for field PAR. */ -unsigned int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, int *dir) +int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, + unsigned int *val, int *dir) { if (hw_is_mask(var)) { if (dir) *dir = 0; - return snd_mask_max(hw_param_mask_c(params, var)); - } - if (hw_is_interval(var)) { + if (val) + *val = snd_mask_max(hw_param_mask_c(params, var)); + return 0; + } else if (hw_is_interval(var)) { const snd_interval_t *i = hw_param_interval_c(params, var); if (dir) *dir = - (int) i->openmax; - return snd_interval_max(i); + if (val) + *val = snd_interval_max(i); + return 0; } assert(0); return 0; @@ -294,10 +303,9 @@ static int _snd_pcm_hw_param_set_first(snd_pcm_hw_params_t *params, int snd_pcm_hw_param_set_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, - int *dir, unsigned int *rval) + unsigned int *rval, int *dir) { int err; - unsigned int val; err = _snd_pcm_hw_param_set_first(params, var); if (err < 0) @@ -307,10 +315,7 @@ int snd_pcm_hw_param_set_first(snd_pcm_t *pcm, if (err < 0) return err; } - val = snd_pcm_hw_param_get(params, var, dir); - if (rval) - *rval = val; - return 0; + return snd_pcm_hw_param_get(params, var, rval, dir); } static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params, @@ -340,10 +345,9 @@ static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params, int snd_pcm_hw_param_set_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, - int *dir, unsigned int *rval) + unsigned int *rval, int *dir) { int err; - unsigned int val; err = _snd_pcm_hw_param_set_last(params, var); if (err < 0) @@ -353,10 +357,7 @@ int snd_pcm_hw_param_set_last(snd_pcm_t *pcm, if (err < 0) return err; } - val = snd_pcm_hw_param_get(params, var, dir); - if (rval) - *rval = val; - return 0; + return snd_pcm_hw_param_get(params, var, rval, dir); } int _snd_pcm_hw_param_set_min(snd_pcm_hw_params_t *params, @@ -421,8 +422,7 @@ int snd_pcm_hw_param_set_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, if (err < 0) goto _fail; } - *val = snd_pcm_hw_param_get_min(params, var, dir); - return 0; + return snd_pcm_hw_param_get_min(params, var, val, dir); _fail: if (mode == SND_TRY) *params = save; @@ -493,8 +493,7 @@ int snd_pcm_hw_param_set_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, if (err < 0) goto _fail; } - *val = snd_pcm_hw_param_get_max(params, var, dir); - return 0; + return snd_pcm_hw_param_get_max(params, var, val, dir); _fail: if (mode == SND_TRY) *params = save; @@ -603,9 +602,10 @@ int snd_pcm_hw_param_set_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, if (err < 0) goto _fail; } - *min = snd_pcm_hw_param_get_min(params, var, mindir); - *max = snd_pcm_hw_param_get_max(params, var, maxdir); - return 0; + err = snd_pcm_hw_param_get_min(params, var, min, mindir); + if (err < 0) + return err; + return snd_pcm_hw_param_get_max(params, var, max, maxdir); _fail: if (mode == SND_TRY) *params = save; @@ -762,12 +762,12 @@ int snd_pcm_hw_param_set_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, Return the value found. */ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, unsigned int best, - int *dir, unsigned int *val) + snd_pcm_hw_param_t var, + unsigned int *val, int *dir) { snd_pcm_hw_params_t save; int err; - unsigned int saved_min; + unsigned int best = *val, saved_min; int last = 0; int min, max; int mindir, maxdir; @@ -811,9 +811,9 @@ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, } _end: if (last) - err = snd_pcm_hw_param_set_last(pcm, params, var, dir, val); + err = snd_pcm_hw_param_set_last(pcm, params, var, val, dir); else - err = snd_pcm_hw_param_set_first(pcm, params, var, dir, val); + err = snd_pcm_hw_param_set_first(pcm, params, var, val, dir); return err; } @@ -899,14 +899,14 @@ static int snd_pcm_hw_param_set_near_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t tmp; int err; if (!boundary_lt(min, *mindir, max, *maxdir)) - return snd_pcm_hw_param_set_near(pcm, params, var, min, mindir, NULL); + return snd_pcm_hw_param_set_near(pcm, params, var, &min, mindir); tmp = *params; - err = snd_pcm_hw_param_set_near(pcm, &tmp, var, min, mindir, &min); + err = snd_pcm_hw_param_set_near(pcm, &tmp, var, &min, mindir); if (err < 0) return err; if (boundary_lt(min, *mindir, max, *maxdir)) { tmp = *params; - err = snd_pcm_hw_param_set_near(pcm, &tmp, var, max, maxdir, &max); + err = snd_pcm_hw_param_set_near(pcm, &tmp, var, &max, maxdir); } else { max = min; *maxdir = *mindir; @@ -924,8 +924,9 @@ void snd_pcm_hw_param_refine_near(snd_pcm_t *pcm, { unsigned int min, max; int mindir, maxdir; - min = snd_pcm_hw_param_get_min(src, var, &mindir); - max = snd_pcm_hw_param_get_max(src, var, &maxdir); + + snd_pcm_hw_param_get_min(src, var, &min, &mindir); + snd_pcm_hw_param_get_max(src, var, &max, &maxdir); snd_pcm_hw_param_set_near_minmax(pcm, params, var, min, &mindir, max, &maxdir); } @@ -987,31 +988,31 @@ static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) { int err; - err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, 0, NULL); + err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL, 0); if (err < 0) return err; - err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, 0, NULL); + err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL, 0); if (err < 0) return err; - err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, 0, NULL); + err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL, 0); if (err < 0) return err; - err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_CHANNELS, 0, NULL); + err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_CHANNELS, NULL, 0); if (err < 0) return err; - err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, 0, NULL); + err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_RATE, NULL, 0); if (err < 0) return err; - err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, 0, NULL); + err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_TIME, NULL, 0); if (err < 0) return err; - err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, 0, NULL); + err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, NULL, 0); if (err < 0) return err; - err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, 0, NULL); + err = snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL, 0); if (err < 0) return err; - err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, 0, NULL); + err = snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, NULL, 0); if (err < 0) return err; return 0; @@ -2179,15 +2180,15 @@ int _snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) return err; pcm->setup = 1; - snd_pcm_hw_params_get_access(params, &pcm->access); - snd_pcm_hw_params_get_format(params, &pcm->format); - snd_pcm_hw_params_get_subformat(params, &pcm->subformat); - pcm->channels = snd_pcm_hw_params_get_channels(params); - pcm->rate = snd_pcm_hw_params_get_rate(params, 0); - pcm->period_time = snd_pcm_hw_params_get_period_time(params, 0); - pcm->period_size = snd_pcm_hw_params_get_period_size(params, 0); - pcm->buffer_size = snd_pcm_hw_params_get_buffer_size(params); - pcm->tick_time = snd_pcm_hw_params_get_tick_time(params, 0); + INTERNAL(snd_pcm_hw_params_get_access)(params, &pcm->access); + INTERNAL(snd_pcm_hw_params_get_format)(params, &pcm->format); + INTERNAL(snd_pcm_hw_params_get_subformat)(params, &pcm->subformat); + INTERNAL(snd_pcm_hw_params_get_channels)(params, &pcm->channels); + INTERNAL(snd_pcm_hw_params_get_rate)(params, &pcm->rate, 0); + INTERNAL(snd_pcm_hw_params_get_period_time)(params, &pcm->period_time, 0); + INTERNAL(snd_pcm_hw_params_get_period_size)(params, &pcm->period_size, 0); + INTERNAL(snd_pcm_hw_params_get_buffer_size)(params, &pcm->buffer_size); + INTERNAL(snd_pcm_hw_params_get_tick_time)(params, &pcm->tick_time, 0); pcm->sample_bits = snd_pcm_format_physical_width(pcm->format); pcm->frame_bits = pcm->sample_bits * pcm->channels; fb = pcm->frame_bits; diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 0142b8a9..e8a5f4ae 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -593,14 +593,14 @@ static int snd_pcm_plug_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_ unsigned int rate_min, channels_max; /* HACK: to avoid overflow in PARTBIT_RATE code */ - rate_min = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, NULL); + snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, NULL); if (rate_min < 4000) { _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_RATE, 4000, 0); if (snd_pcm_hw_param_empty(params, SND_PCM_HW_PARAM_RATE)) return -EINVAL; } /* HACK: to avoid overflow in PERIOD_SIZE code */ - channels_max = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, NULL); + snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, &channels_max, NULL); if (channels_max > 10000) { _snd_pcm_hw_param_set_max(params, SND_PCM_HW_PARAM_CHANNELS, 10000, 0); if (snd_pcm_hw_param_empty(params, SND_PCM_HW_PARAM_CHANNELS)) @@ -798,8 +798,8 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, links |= SND_PCM_HW_PARBIT_RATE; else { /* This is a temporary hack, waiting for a better solution */ - rate_min = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_mindir); - srate_min = snd_pcm_hw_param_get_min(sparams, SND_PCM_HW_PARAM_RATE, &srate_mindir); + snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, &rate_mindir); + snd_pcm_hw_param_get_min(sparams, SND_PCM_HW_PARAM_RATE, &srate_min, &srate_mindir); if (rate_min == srate_min && srate_mindir > rate_mindir) { err = _snd_pcm_hw_param_set_min(params, SND_PCM_HW_PARAM_RATE, srate_min, srate_mindir); if (err < 0) @@ -859,14 +859,14 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) err = snd_pcm_hw_refine_soft(slave, &sparams); assert(err >= 0); - snd_pcm_hw_params_get_access(params, &clt_params.access); - snd_pcm_hw_params_get_format(params, &clt_params.format); - clt_params.channels = snd_pcm_hw_params_get_channels(params); - clt_params.rate = snd_pcm_hw_params_get_rate(params, 0); + INTERNAL(snd_pcm_hw_params_get_access)(params, &clt_params.access); + INTERNAL(snd_pcm_hw_params_get_format)(params, &clt_params.format); + INTERNAL(snd_pcm_hw_params_get_channels)(params, &clt_params.channels); + INTERNAL(snd_pcm_hw_params_get_rate)(params, &clt_params.rate, 0); - snd_pcm_hw_params_get_format(&sparams, &slv_params.format); - slv_params.channels = snd_pcm_hw_params_get_channels(&sparams); - slv_params.rate = snd_pcm_hw_params_get_rate(&sparams, 0); + INTERNAL(snd_pcm_hw_params_get_format)(&sparams, &slv_params.format); + INTERNAL(snd_pcm_hw_params_get_channels)(&sparams, &slv_params.channels); + INTERNAL(snd_pcm_hw_params_get_rate)(&sparams, &slv_params.rate, 0); snd_pcm_plug_clear(pcm); if (!(clt_params.format == slv_params.format && clt_params.channels == slv_params.channels && @@ -874,7 +874,7 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) !plug->ttable && snd_pcm_hw_params_test_access(slave, &sparams, clt_params.access) >= 0)) { - slv_params.access = snd_pcm_hw_params_set_access_first(slave, &sparams); + INTERNAL(snd_pcm_hw_params_set_access_first)(slave, &sparams, &slv_params.access); err = snd_pcm_plug_insert_plugins(pcm, &clt_params, &slv_params); if (err < 0) return err; diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index f9972f31..f2270c8c 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -375,15 +375,19 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) return err; if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { - err = snd_pcm_hw_params_get_format(params, &src_format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &src_format); + if (err < 0) + return err; dst_format = slave->format; - src_rate = snd_pcm_hw_params_get_rate(params, 0); + err = INTERNAL(snd_pcm_hw_params_get_rate)(params, &src_rate, 0); dst_rate = slave->rate; } else { src_format = slave->format; - err = snd_pcm_hw_params_get_format(params, &dst_format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format); + if (err < 0) + return err; src_rate = slave->rate; - dst_rate = snd_pcm_hw_params_get_rate(params, 0); + err = INTERNAL(snd_pcm_hw_params_get_rate)(params, &dst_rate, 0); } if (err < 0) return err; diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index 9455901e..73530bc5 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -612,11 +612,11 @@ static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) return err; if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { - err = snd_pcm_hw_params_get_format(params, &src_format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &src_format); dst_format = slave->format; } else { src_format = slave->format; - err = snd_pcm_hw_params_get_format(params, &dst_format); + err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format); } if (err < 0) return err; diff --git a/test/latency.c b/test/latency.c index 7648157e..bb699a3a 100644 --- a/test/latency.c +++ b/test/latency.c @@ -58,6 +58,7 @@ int setparams_stream(snd_pcm_t *handle, const char *id) { int err; + unsigned int rrate; err = snd_pcm_hw_params_any(handle, params); if (err < 0) { @@ -79,12 +80,13 @@ int setparams_stream(snd_pcm_t *handle, printf("Channels count (%i) not available for %s: %s\n", channels, id, snd_strerror(err)); return err; } - err = snd_pcm_hw_params_set_rate_near(handle, params, rate, 0); + rrate = rate; + err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0); if (err < 0) { printf("Rate %iHz not available for %s: %s\n", rate, id, snd_strerror(err)); return err; } - if (err != rate) { + if (rrate != rate) { printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err); return -EINVAL; } @@ -98,16 +100,17 @@ int setparams_bufsize(snd_pcm_t *handle, const char *id) { int err; - snd_pcm_uframes_t periodsize; + snd_pcm_uframes_t rbufsize, periodsize; snd_pcm_hw_params_copy(params, tparams); - err = snd_pcm_hw_params_set_buffer_size_near(handle, params, bufsize * 2); + rbufsize = bufsize * 2; + err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &rbufsize); if (err < 0) { printf("Unable to set buffer size %li for %s: %s\n", bufsize * 2, id, snd_strerror(err)); return err; } periodsize = snd_pcm_hw_params_get_buffer_size(params) / 2; - err = snd_pcm_hw_params_set_period_size_near(handle, params, periodsize, 0); + err = snd_pcm_hw_params_set_period_size_near(handle, params, &periodsize, 0); if (err < 0) { printf("Unable to set period size %li for %s: %s\n", periodsize, id, snd_strerror(err)); return err; diff --git a/test/pcm.c b/test/pcm.c index 3221f821..e12a86bc 100644 --- a/test/pcm.c +++ b/test/pcm.c @@ -12,13 +12,13 @@ #include #include -char *device = "plughw:0,0"; /* playback device */ -snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ -int rate = 44100; /* stream rate */ -int channels = 1; /* count of channels */ -int buffer_time = 500000; /* ring buffer length in us */ -int period_time = 100000; /* period time in us */ -double freq = 440; /* sinusoidal wave frequency in Hz */ +char *device = "plughw:0,0"; /* playback device */ +snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ +unsigned int rate = 44100; /* stream rate */ +unsigned int channels = 1; /* count of channels */ +unsigned int buffer_time = 500000; /* ring buffer length in us */ +unsigned int period_time = 100000; /* period time in us */ +double freq = 440; /* sinusoidal wave frequency in Hz */ snd_pcm_sframes_t buffer_size; snd_pcm_sframes_t period_size; @@ -69,6 +69,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_access_t access) { + unsigned int rrate; int err, dir; /* choose all parameters */ @@ -96,29 +97,38 @@ static int set_hwparams(snd_pcm_t *handle, return err; } /* set the stream rate */ - err = snd_pcm_hw_params_set_rate_near(handle, params, rate, 0); + rrate = rate; + err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0); if (err < 0) { printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err)); return err; } - if (err != rate) { + if (rrate != rate) { printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err); return -EINVAL; } /* set the buffer time */ - err = snd_pcm_hw_params_set_buffer_time_near(handle, params, buffer_time, &dir); + err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir); if (err < 0) { printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err)); return err; } - buffer_size = snd_pcm_hw_params_get_buffer_size(params); + err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size); + if (err < 0) { + printf("Unable to get buffer size for playback: %s\n", snd_strerror(err)); + return err; + } /* set the period time */ - err = snd_pcm_hw_params_set_period_time_near(handle, params, period_time, &dir); + err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); if (err < 0) { printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err)); return err; } - period_size = snd_pcm_hw_params_get_period_size(params, &dir); + err = snd_pcm_hw_params_get_period_size(params, &period_size, &dir); + if (err > 0) { + printf("Unable to get period size for playback: %s\n", snd_strerror(err)); + return err; + } /* write the parameters to device */ err = snd_pcm_hw_params(handle, params); if (err < 0) {