mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-28 05:40:23 -04:00
- 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_*)
This commit is contained in:
parent
cabf841f4e
commit
b9343e0834
23 changed files with 1271 additions and 483 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
37
configure.in
37
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 \
|
||||
|
|
|
|||
|
|
@ -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; \
|
||||
|
|
|
|||
41
include/alsa-symbols.h
Normal file
41
include/alsa-symbols.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* ALSA lib - dynamic symbol versions
|
||||
* Copyright (c) 2002 by Jaroslav Kysela <perex@suse.cz>
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 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 */
|
||||
|
|
@ -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 <sound/asound.h>
|
||||
#include <sound/asoundef.h>
|
||||
#include <sound/asequencer.h>
|
||||
#include "alsa-symbols.h"
|
||||
#include "version.h"
|
||||
#include "global.h"
|
||||
#include "input.h"
|
||||
|
|
|
|||
150
include/pcm.h
150
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);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
1113
src/pcm/pcm.c
1113
src/pcm/pcm.c
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 ||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
36
test/pcm.c
36
test/pcm.c
|
|
@ -12,13 +12,13 @@
|
|||
#include <sys/time.h>
|
||||
#include <math.h>
|
||||
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue