mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Drop ALSA 0.5 support
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
* MMX Pentinum 以降 (for IA32 platform)
|
||||
|
||||
1.3 対応機能
|
||||
* ALSA (for Linux) 0.5.x 以上
|
||||
* ALSA (for Linux) 0.9.x 以上
|
||||
(http://www.alsa-project.org/)
|
||||
* ESD (Esound) 0.2.8 以上
|
||||
(http://www.tux.org/~ricdude/EsounD.html)
|
||||
|
||||
@@ -212,7 +212,6 @@ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
/* Define this if you have Alsa (libasound) installed */
|
||||
#undef ENABLE_ALSA
|
||||
|
||||
/* Define this if you have 0.5.x <= alsa < 0.9.0 installed */
|
||||
#undef ENABLE_ALSA05
|
||||
|
||||
/* Define this if you have alsa 0.9.x and more installed */
|
||||
#undef ENABLE_ALSA09
|
||||
|
||||
|
||||
@@ -669,7 +669,6 @@ SDL_LIBS
|
||||
SDL_CFLAGS
|
||||
SDL_CONFIG
|
||||
SRC_MIDI
|
||||
ALSAMIX_H
|
||||
SRC_CDROM
|
||||
SRC_AUDIO
|
||||
ESD_LIBS
|
||||
@@ -16474,217 +16473,6 @@ fi
|
||||
|
||||
|
||||
if test "x$have_alsa09" = xno; then
|
||||
alsa_save_CFLAGS="$CFLAGS"
|
||||
alsa_save_LDFLAGS="$LDFLAGS"
|
||||
alsa_save_LIBS="$LIBS"
|
||||
alsa_found=yes
|
||||
|
||||
|
||||
# Check whether --with-alsa-prefix was given.
|
||||
if test "${with_alsa_prefix+set}" = set; then :
|
||||
withval=$with_alsa_prefix; alsa_prefix="$withval"
|
||||
else
|
||||
alsa_prefix=""
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check whether --with-alsa-inc-prefix was given.
|
||||
if test "${with_alsa_inc_prefix+set}" = set; then :
|
||||
withval=$with_alsa_inc_prefix; alsa_inc_prefix="$withval"
|
||||
else
|
||||
alsa_inc_prefix=""
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-alsatest was given.
|
||||
if test "${enable_alsatest+set}" = set; then :
|
||||
enableval=$enable_alsatest; enable_alsatest="$enableval"
|
||||
else
|
||||
enable_alsatest=yes
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA CFLAGS" >&5
|
||||
$as_echo_n "checking for ALSA CFLAGS... " >&6; }
|
||||
if test "$alsa_inc_prefix" != "" ; then
|
||||
ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix"
|
||||
CFLAGS="$CFLAGS -I$alsa_inc_prefix"
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_CFLAGS" >&5
|
||||
$as_echo "$ALSA_CFLAGS" >&6; }
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA LDFLAGS" >&5
|
||||
$as_echo_n "checking for ALSA LDFLAGS... " >&6; }
|
||||
if test "$alsa_prefix" != "" ; then
|
||||
ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix"
|
||||
LDFLAGS="$LDFLAGS $ALSA_LIBS"
|
||||
fi
|
||||
|
||||
ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
|
||||
LIBS="$ALSA_LIBS $LIBS"
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5
|
||||
$as_echo "$ALSA_LIBS" >&6; }
|
||||
|
||||
if test "x$enable_alsatest" = "xyes"; then
|
||||
min_alsa_version=0.5.0
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5
|
||||
$as_echo_n "checking for libasound headers version >= $min_alsa_version... " >&6; }
|
||||
no_alsa=""
|
||||
alsa_min_major_version=`echo $min_alsa_version | \
|
||||
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
|
||||
alsa_min_minor_version=`echo $min_alsa_version | \
|
||||
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
|
||||
alsa_min_micro_version=`echo $min_alsa_version | \
|
||||
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
|
||||
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
/* ensure backward compatibility */
|
||||
#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR)
|
||||
#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR
|
||||
#endif
|
||||
#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR)
|
||||
#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR
|
||||
#endif
|
||||
#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR)
|
||||
#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR
|
||||
#endif
|
||||
|
||||
# if(SND_LIB_MAJOR > $alsa_min_major_version)
|
||||
exit(0);
|
||||
# else
|
||||
# if(SND_LIB_MAJOR < $alsa_min_major_version)
|
||||
# error not present
|
||||
# endif
|
||||
|
||||
# if(SND_LIB_MINOR > $alsa_min_minor_version)
|
||||
exit(0);
|
||||
# else
|
||||
# if(SND_LIB_MINOR < $alsa_min_minor_version)
|
||||
# error not present
|
||||
# endif
|
||||
|
||||
# if(SND_LIB_SUBMINOR < $alsa_min_micro_version)
|
||||
# error not present
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
exit(0);
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found." >&5
|
||||
$as_echo "found." >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not present." >&5
|
||||
$as_echo "not present." >&6; }
|
||||
|
||||
alsa_found=no
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
fi
|
||||
|
||||
if test "x$enable_alsatest" = "xyes"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_ctl_open in -lasound" >&5
|
||||
$as_echo_n "checking for snd_ctl_open in -lasound... " >&6; }
|
||||
if ${ac_cv_lib_asound_snd_ctl_open+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lasound $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char snd_ctl_open ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return snd_ctl_open ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_asound_snd_ctl_open=yes
|
||||
else
|
||||
ac_cv_lib_asound_snd_ctl_open=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_ctl_open" >&5
|
||||
$as_echo "$ac_cv_lib_asound_snd_ctl_open" >&6; }
|
||||
if test "x$ac_cv_lib_asound_snd_ctl_open" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBASOUND 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lasound $LIBS"
|
||||
|
||||
else
|
||||
|
||||
alsa_found=no
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if test "x$alsa_found" = "xyes" ; then
|
||||
|
||||
$as_echo "#define ENABLE_ALSA05 1" >>confdefs.h
|
||||
|
||||
have_alsa05=yes
|
||||
|
||||
LIBS=`echo $LIBS | sed 's/-lasound//g'`
|
||||
LIBS=`echo $LIBS | sed 's/ //'`
|
||||
LIBS="-lasound $LIBS"
|
||||
fi
|
||||
if test "x$alsa_found" = "xno" ; then
|
||||
have_alsa05=no
|
||||
CFLAGS="$alsa_save_CFLAGS"
|
||||
LDFLAGS="$alsa_save_LDFLAGS"
|
||||
LIBS="$alsa_save_LIBS"
|
||||
ALSA_CFLAGS=""
|
||||
ALSA_LIBS=""
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
fi
|
||||
if test "x$have_alsa09" = xno -a "x$have_alsa05" = xno; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: *** All of ALSA dependent parts will be disabled ***" >&5
|
||||
$as_echo "*** All of ALSA dependent parts will be disabled ***" >&6; }
|
||||
else
|
||||
@@ -17017,9 +16805,6 @@ fi
|
||||
if test "x$have_sunaudio" = xyes; then
|
||||
SRC_AUDIO="$SRC_AUDIO audio_sun.c"
|
||||
fi
|
||||
if test "x$have_alsa05" = xyes; then
|
||||
SRC_AUDIO="$SRC_AUDIO audio_alsa.c"
|
||||
fi
|
||||
if test "x$have_alsa09" = xyes; then
|
||||
SRC_AUDIO="$SRC_AUDIO audio_alsa09.c"
|
||||
fi
|
||||
@@ -17216,47 +17001,6 @@ cat >>confdefs.h <<_ACEOF
|
||||
#define MIXERDEV_ALSA "$MIXERDEV_ALSA"
|
||||
_ACEOF
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_mixer_element_read in -lasound" >&5
|
||||
$as_echo_n "checking for snd_mixer_element_read in -lasound... " >&6; }
|
||||
if ${ac_cv_lib_asound_snd_mixer_element_read+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lasound $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char snd_mixer_element_read ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return snd_mixer_element_read ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_asound_snd_mixer_element_read=yes
|
||||
else
|
||||
ac_cv_lib_asound_snd_mixer_element_read=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_mixer_element_read" >&5
|
||||
$as_echo "$ac_cv_lib_asound_snd_mixer_element_read" >&6; }
|
||||
if test "x$ac_cv_lib_asound_snd_mixer_element_read" = xyes; then :
|
||||
ALSAMIX_H=mixer_alsa.h
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if test "x$have_ossaudio" = xyes ; then
|
||||
@@ -18849,9 +18593,6 @@ if test "x$have_sunaudio" = xyes; then
|
||||
echo " - sun ()"
|
||||
fi
|
||||
if test "x$no_alsa" != xyes; then
|
||||
if test "x$have_alsa05" = xyes; then
|
||||
echo " - alsa05 (Alsa 0.5.x)"
|
||||
fi
|
||||
if test "x$have_alsa09" = xyes; then
|
||||
echo " - alsa09 (Alsa 0.9.x)"
|
||||
fi
|
||||
|
||||
@@ -325,13 +325,6 @@ if test "x$enable_alsa" = xyes; then
|
||||
],
|
||||
have_alsa09=no)
|
||||
if test "x$have_alsa09" = xno; then
|
||||
AM_PATH_ALSA(0.5.0,
|
||||
[ AC_DEFINE(ENABLE_ALSA05,1,[Define this if you have 0.5.x <= alsa < 0.9.0 installed])
|
||||
have_alsa05=yes
|
||||
],
|
||||
have_alsa05=no)
|
||||
fi
|
||||
if test "x$have_alsa09" = xno -a "x$have_alsa05" = xno; then
|
||||
AC_MSG_RESULT(*** All of ALSA dependent parts will be disabled ***)
|
||||
else
|
||||
AC_DEFINE(ENABLE_ALSA,1,[Define this if you have Alsa (libasound) installed])
|
||||
@@ -398,9 +391,6 @@ fi
|
||||
if test "x$have_sunaudio" = xyes; then
|
||||
SRC_AUDIO="$SRC_AUDIO audio_sun.c"
|
||||
fi
|
||||
if test "x$have_alsa05" = xyes; then
|
||||
SRC_AUDIO="$SRC_AUDIO audio_alsa.c"
|
||||
fi
|
||||
if test "x$have_alsa09" = xyes; then
|
||||
SRC_AUDIO="$SRC_AUDIO audio_alsa09.c"
|
||||
fi
|
||||
@@ -538,8 +528,6 @@ if test "x$have_alsa" = xyes ; then
|
||||
AUDIODEV_ALSA=$alsapcmdev
|
||||
AC_DEFINE_UNQUOTED(AUDIODEV_ALSA,"$AUDIODEV_ALSA",[aduio device])
|
||||
AC_DEFINE_UNQUOTED(MIXERDEV_ALSA,"$MIXERDEV_ALSA",[mixer device])
|
||||
AC_CHECK_LIB(asound,snd_mixer_element_read,ALSAMIX_H=mixer_alsa.h)
|
||||
AC_SUBST(ALSAMIX_H)
|
||||
fi
|
||||
|
||||
dnl
|
||||
@@ -884,9 +872,6 @@ if test "x$have_sunaudio" = xyes; then
|
||||
echo " - sun ()"
|
||||
fi
|
||||
if test "x$no_alsa" != xyes; then
|
||||
if test "x$have_alsa05" = xyes; then
|
||||
echo " - alsa05 (Alsa 0.5.x)"
|
||||
fi
|
||||
if test "x$have_alsa09" = xyes; then
|
||||
echo " - alsa09 (Alsa 0.9.x)"
|
||||
fi
|
||||
|
||||
@@ -127,7 +127,6 @@ am__can_run_installinfo = \
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -187,7 +187,6 @@ am__relativize = \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -213,7 +213,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -210,7 +210,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -209,7 +209,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -214,7 +214,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -192,7 +192,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -207,7 +207,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
@@ -219,7 +219,6 @@ ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSAMIX_H = @ALSAMIX_H@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMTAR = @AMTAR@
|
||||
|
||||
-15
@@ -59,10 +59,6 @@ extern int oss_init(audiodevice_t *dev, char *devdsp, char *devmix);
|
||||
#endif /* ENABLE_OSS */
|
||||
|
||||
#ifdef ENABLE_ALSA
|
||||
#ifdef ENABLE_ALSA05
|
||||
extern int alsa_init(audiodevice_t *dev, int cardno, int pcmdev, int mixdev, boolean automix);
|
||||
#endif /* ENABLE_ALSA05 */
|
||||
|
||||
#ifdef ENABLE_ALSA09
|
||||
extern int alsa_init(audiodevice_t *dev, char *hw, boolean automix);
|
||||
#endif /* ENABLE_ALSA09 */
|
||||
@@ -96,17 +92,6 @@ int audio_init(audiodevice_t *a) {
|
||||
if (mode_onlyone) break;
|
||||
#endif
|
||||
#ifdef ENABLE_ALSA
|
||||
#ifdef ENABLE_ALSA05
|
||||
case AUDIO_PCM_ALSA:
|
||||
{
|
||||
int card = -1, pcm = -1;
|
||||
if (audio_dev_dsp) {
|
||||
sscanf(audio_dev_dsp, "%d:%d\n", &card, &pcm);
|
||||
}
|
||||
if (alsa_init(a, card, pcm, -1, FALSE) == 0) break;
|
||||
if (mode_onlyone) break;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_ALSA09
|
||||
case AUDIO_PCM_ALSA:
|
||||
if (audio_dev_dsp == NULL) {
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
/*
|
||||
* audio_alsa.c alsa lowlevel acess (for 0.5.x)
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
* rewrited 2000- Fumihiko Murata <fmurata@p1.tcnet.ne.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: audio_alsa.c,v 1.19 2003/04/22 16:34:28 chikama Exp $ */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/asoundlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "audio.h"
|
||||
#include "audio_alsa.h"
|
||||
#include "mixer_alsa.c"
|
||||
|
||||
static int audio_open(audiodevice_t *audio, chanfmt_t fmt);
|
||||
static int audio_close(audiodevice_t *audio);
|
||||
static int audio_write(audiodevice_t *audio, unsigned char *buf,int cnt);
|
||||
|
||||
static int audio_open(audiodevice_t *dev, chanfmt_t fmt) {
|
||||
audio_alsa05_t *alsa = (audio_alsa05_t *)dev->data_pcm;
|
||||
|
||||
snd_pcm_channel_params_t p;
|
||||
snd_pcm_channel_setup_t s;
|
||||
|
||||
if (0 > snd_pcm_open(&alsa->pcm_handle, alsa->card, alsa->pcm_dev, SND_PCM_OPEN_PLAYBACK)) {
|
||||
WARNING("Opening audio device %d failed\n", alsa->pcm_dev);
|
||||
goto _err_exit;
|
||||
}
|
||||
|
||||
memset(&alsa->info, 0, sizeof(snd_pcm_channel_info_t));
|
||||
|
||||
if (0 > snd_pcm_channel_info(alsa->pcm_handle, &alsa->info)) {
|
||||
WARNING("param get failed\n");
|
||||
goto _err_exit;
|
||||
}
|
||||
|
||||
memset(&p, 0, sizeof(p));
|
||||
p.mode = SND_PCM_MODE_BLOCK;
|
||||
p.start_mode = SND_PCM_START_DATA;
|
||||
p.channel = SND_PCM_CHANNEL_PLAYBACK;
|
||||
p.stop_mode = SND_PCM_STOP_STOP;
|
||||
p.buf.block.frag_size = 1536;
|
||||
p.buf.block.frags_max = 6;
|
||||
p.buf.block.frags_min = 1;
|
||||
p.format.rate = fmt.rate;
|
||||
p.format.format = fmt.bit == 8 ? SND_PCM_SFMT_U8 : SND_PCM_SFMT_S16;
|
||||
p.format.voices = fmt.ch;
|
||||
p.format.interleave = 1;
|
||||
alsa->silence = fmt.bit == 8 ? 0x80 : 0;
|
||||
|
||||
if (0 > snd_pcm_channel_params(alsa->pcm_handle, &p)) {
|
||||
WARNING("Unable to set channel params\n");
|
||||
goto _err_exit;
|
||||
}
|
||||
|
||||
if (0 > snd_pcm_channel_prepare(alsa->pcm_handle, SND_PCM_CHANNEL_PLAYBACK)) {
|
||||
WARNING("Unable to prepare channel\n");
|
||||
goto _err_exit;
|
||||
}
|
||||
|
||||
memset(&s, 0, sizeof(s));
|
||||
s.mode = SND_PCM_MODE_BLOCK;
|
||||
s.channel = SND_PCM_CHANNEL_PLAYBACK;
|
||||
|
||||
if (0 > snd_pcm_channel_setup(alsa->pcm_handle, &s)) {
|
||||
WARNING("Unable to obtain setup\n");
|
||||
goto _err_exit;
|
||||
}
|
||||
|
||||
dev->buf.len = s.buf.block.frag_size;
|
||||
dev->fd = snd_pcm_file_descriptor(alsa->pcm_handle, SND_PCM_CHANNEL_PLAYBACK);
|
||||
return OK;
|
||||
|
||||
_err_exit:
|
||||
dev->fd = -1;
|
||||
return NG;
|
||||
}
|
||||
|
||||
static int audio_close(audiodevice_t *dev) {
|
||||
audio_alsa05_t *alsa = (audio_alsa05_t *)dev->data_pcm;
|
||||
snd_pcm_channel_status_t st;
|
||||
int err, bc;
|
||||
|
||||
dev->fd = -1;
|
||||
if (alsa->pcm_handle) {
|
||||
memset(&st, 0, sizeof(st));
|
||||
if (0 > (err = snd_pcm_channel_status(alsa->pcm_handle, &st))) {
|
||||
WARNING("playback status err(%s)\n", snd_strerror(err));
|
||||
return snd_pcm_close(alsa->pcm_handle);
|
||||
}
|
||||
while (st.status == SND_PCM_STATUS_RUNNING) {
|
||||
memset(&st, 0, sizeof(st));
|
||||
bc = st.count;
|
||||
snd_pcm_channel_status(alsa->pcm_handle, &st);
|
||||
if (bc == st.count) {
|
||||
snd_pcm_channel_flush(alsa->pcm_handle, SND_PCM_CHANNEL_PLAYBACK);
|
||||
}
|
||||
usleep(1000);
|
||||
}
|
||||
err = snd_pcm_close(alsa->pcm_handle);
|
||||
alsa->pcm_handle = NULL;
|
||||
return err;
|
||||
} else {
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
static int audio_write(audiodevice_t *dev, unsigned char *buf, int cnt) {
|
||||
audio_alsa05_t *alsa = (audio_alsa05_t *)dev->data_pcm;
|
||||
snd_pcm_channel_status_t st;
|
||||
int ret;
|
||||
|
||||
if (alsa->pcm_handle == NULL) return NG;
|
||||
|
||||
if (cnt == 0) return 0;
|
||||
|
||||
if (cnt < dev->buf.len) {
|
||||
memset(buf + cnt, alsa->silence, dev->buf.len - cnt);
|
||||
}
|
||||
|
||||
memset(&st, 0, sizeof(st));
|
||||
if (0 > (ret = snd_pcm_channel_status(alsa->pcm_handle, &st))) {
|
||||
WARNING("cannot get status %s\n", snd_strerror(ret));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (st.status != SND_PCM_STATUS_RUNNING &&
|
||||
st.status != SND_PCM_STATUS_PREPARED) {
|
||||
snd_pcm_channel_prepare(alsa->pcm_handle, SND_PCM_CHANNEL_PLAYBACK);
|
||||
}
|
||||
|
||||
ret = snd_pcm_write(alsa->pcm_handle, buf, dev->buf.len);
|
||||
if (ret < 0) {
|
||||
WARNING("write %s\n", snd_strerror(ret));
|
||||
}
|
||||
|
||||
return dev->buf.len;
|
||||
}
|
||||
|
||||
static int alsa_exit(audiodevice_t *dev) {
|
||||
if (dev == NULL) return OK;
|
||||
|
||||
mixer_exit(dev);
|
||||
g_free(dev->data_pcm);
|
||||
g_free(dev->data_mix);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int alsa_init(audiodevice_t *dev, int cardno, int pcmdev, int mixdev, boolean automix) {
|
||||
snd_ctl_t *ctl_handle;
|
||||
snd_ctl_hw_info_t *hwinfo;
|
||||
audio_alsa05_t *alsa;
|
||||
int i, j, ncards;
|
||||
snd_pcm_t *pcm_handle;
|
||||
|
||||
/* サウンドカードが存在するかチェック */
|
||||
ncards = snd_cards();
|
||||
if (ncards < 1) {
|
||||
WARNING("No ALSA device found\n");
|
||||
return NG;
|
||||
}
|
||||
|
||||
if (cardno == -1 && pcmdev == -1) {
|
||||
/* 最初に見つかった使用可能なカード */
|
||||
if (NULL == (hwinfo = (snd_ctl_hw_info_t *)malloc(sizeof(*hwinfo) * ncards))) {
|
||||
NOMEMERR();
|
||||
return NG;
|
||||
}
|
||||
for (i = 0; i < ncards; i++) {
|
||||
if (0 > snd_ctl_open(&ctl_handle, i)) {
|
||||
WARNING("Can't Open Card %d\n", i);
|
||||
free(hwinfo);
|
||||
return NG;
|
||||
}
|
||||
if (0 > snd_ctl_hw_info(ctl_handle, hwinfo + i)) {
|
||||
WARNING("Can't Get Card(%d) info\n", i);
|
||||
free(hwinfo);
|
||||
return NG;
|
||||
}
|
||||
snd_ctl_close(ctl_handle);
|
||||
for (j = 0; j < hwinfo[i].pcmdevs; j++) {
|
||||
//open してチェック OK なら outへ
|
||||
if (0 > snd_pcm_open(&pcm_handle, i, j, SND_PCM_OPEN_PLAYBACK)) continue;
|
||||
cardno = i; pcmdev = j;
|
||||
snd_pcm_close(pcm_handle);
|
||||
NOTICE("ALSA Use(%d:%d) device\n", i, j);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
// 使用可能なデバイスが1つもない場合
|
||||
WARNING("Can't Get Card(%d) info\n", i);
|
||||
return NG;
|
||||
out:
|
||||
free(hwinfo);
|
||||
} else {
|
||||
/* 指定のカード */
|
||||
if (0 > snd_ctl_open(&ctl_handle, cardno)) {
|
||||
WARNING("Can't Open Card %d\n", cardno);
|
||||
return NG;
|
||||
}
|
||||
snd_ctl_close(ctl_handle);
|
||||
|
||||
/* 指定の pcmdevice がカードの中にあるかどうか */
|
||||
if (pcmdev >= 0 && pcmdev < hwinfo[cardno].pcmdevs) {
|
||||
//opne してチェック
|
||||
if (0 > snd_pcm_open(&pcm_handle, cardno, pcmdev, SND_PCM_OPEN_PLAYBACK)) {
|
||||
WARNING("Can't Open (%d:%d)\n", cardno, pcmdev);
|
||||
return NG;
|
||||
}
|
||||
snd_pcm_close(pcm_handle);
|
||||
NOTICE("ALSA Use(%d:%d) device\n", cardno, pcmdev);
|
||||
} else {
|
||||
WARNING("Can't Open (%d:%d)\n", cardno, pcmdev);
|
||||
return NG;
|
||||
}
|
||||
}
|
||||
|
||||
if (mixer_init(dev, cardno, mixdev, &hwinfo) < 0) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
alsa = g_new0(audio_alsa05_t, 1);
|
||||
|
||||
alsa->card = cardno;
|
||||
alsa->pcm_dev = pcmdev;
|
||||
alsa->automixer = automix;
|
||||
|
||||
dev->data_pcm = alsa;
|
||||
|
||||
dev->id = AUDIO_PCM_ALSA;
|
||||
dev->fd = -1;
|
||||
dev->open = audio_open;
|
||||
dev->close = audio_close;
|
||||
dev->write = audio_write;
|
||||
dev->mix_set = mixer_set_level;
|
||||
dev->mix_get = mixer_get_level;
|
||||
dev->exit = alsa_exit;
|
||||
|
||||
NOTICE("ALSA Initilize OK\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* audio_alsa.h alsa lowlevel acess
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
* rewrited 1999- Fumihiko Murata <fmurata@p1.tcnet.ne.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: audio_alsa.h,v 1.6 2002/08/23 14:56:41 chikama Exp $ */
|
||||
|
||||
#ifndef __AUDIO_ALSA__
|
||||
#define __AUDIO_ALSA__
|
||||
|
||||
#include <sys/asoundlib.h>
|
||||
|
||||
typedef struct {
|
||||
snd_pcm_t *pcm_handle;
|
||||
boolean automixer; // 自動的に pcmdevice に接続されている mixer を探すか?
|
||||
|
||||
int card;
|
||||
int pcm_dev;
|
||||
|
||||
snd_pcm_channel_info_t info;
|
||||
|
||||
int silence;
|
||||
|
||||
|
||||
int frag,frags;
|
||||
struct {
|
||||
int mix_dev;
|
||||
snd_mixer_eid_t eid;
|
||||
} mixer;
|
||||
|
||||
int mm_flag;
|
||||
snd_pcm_mmap_control_t *mm_ctl;
|
||||
char *mm_data;
|
||||
} audio_alsa05_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int card;
|
||||
int mix_dev;
|
||||
int connect[MIX_NRDEVICES];
|
||||
|
||||
snd_mixer_element_t e[MIX_NRDEVICES];
|
||||
snd_mixer_element_info_t ei[MIX_NRDEVICES];
|
||||
} mixer_alsa05_t;
|
||||
|
||||
#endif /* __AUDIO_ALSA__ */
|
||||
@@ -1,244 +0,0 @@
|
||||
/*
|
||||
* mixer_alsa.c ALSA mixer lowlevel access (for 0.5.x)
|
||||
*
|
||||
* Copyright (C) 1997-1998 Masaki Chikama (Wren) <chikama@kasumi.ipl.mech.nagoya-u.ac.jp>
|
||||
* 1998- <masaki-c@is.aist-nara.ac.jp>
|
||||
* rewrited 2000- Fumihiko Murata <fmurata@p1.tcnet.ne.jp>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
/* $Id: mixer_alsa.c,v 1.11 2006/04/21 16:40:48 chikama Exp $ */
|
||||
|
||||
#include "config.h"
|
||||
#include "audio.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/asoundlib.h>
|
||||
|
||||
#include "audio_alsa.h"
|
||||
|
||||
#define MIXER_ELEMENT_MAX 100
|
||||
static snd_mixer_eid_t eid[MIXER_ELEMENT_MAX];
|
||||
static snd_mixer_element_t einit[MIXER_ELEMENT_MAX];
|
||||
static int emax;
|
||||
|
||||
/*
|
||||
level: 0-100
|
||||
*/
|
||||
static void mixer_set_level(audiodevice_t *dev, int ch, int level) {
|
||||
snd_mixer_t *mixer_handle;
|
||||
mixer_alsa05_t *amix = (mixer_alsa05_t *)dev->data_mix;
|
||||
int i, err;
|
||||
int lv;
|
||||
|
||||
#if 0
|
||||
printf("mixer set '%s',%d,%d = %3d (%3d %3d %3d)\n" ,
|
||||
amix->elem.eid.name,amix->elem.eid.index,amix->elem.eid.type,
|
||||
level,mix->vol,mix->vol_full,mix->range.scale);
|
||||
#endif
|
||||
|
||||
if (0 > snd_mixer_open(&mixer_handle, amix->card, amix->mix_dev)) {
|
||||
WARNING("mixer_set_level(): Opening mixer device %d failed\n",
|
||||
amix->mix_dev);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < amix->e[ch].data.volume1.voices; i++) {
|
||||
//lv = (amix->ei[ch].data.volume1.prange[i].max * level / 100);
|
||||
lv = (einit[amix->connect[ch]].data.volume1.pvoices[i] * level / 100);
|
||||
amix->e[ch].data.volume1.pvoices[i] = lv;
|
||||
}
|
||||
|
||||
if (0 > (err = snd_mixer_element_write(mixer_handle, &amix->e[ch]))) {
|
||||
WARNING("mixer_set_level(lv%d): mixer write failed %s\n",
|
||||
level, snd_strerror(err));
|
||||
}
|
||||
snd_mixer_close(mixer_handle);
|
||||
}
|
||||
|
||||
static int mixer_get_level(audiodevice_t *dev, int ch) {
|
||||
// mixer_alsa05_t *amix = (mixer_alsa05_t *)dev->data_mix;
|
||||
|
||||
#if 0
|
||||
if (snd_mixer_open(&mixer_handle, amix->card, amix->mix_dev) < 0) {
|
||||
WARNING("mixer_get_level(): Opening mixer device (%d,%d) failed\n",
|
||||
amix->card, amix->mix_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (snd_mixer_element_read(mixer_handle, &amix->elem) < 0) {
|
||||
WARNING("mixer_get_level(): mixser read failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
snd_mixer_close(mixer_handle);
|
||||
return amix->Epvol1(elem.)[0];
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mixer_exit(audiodevice_t *dev) {
|
||||
snd_mixer_t *mixer_handle;
|
||||
mixer_alsa05_t *amix = (mixer_alsa05_t *)dev->data_mix;
|
||||
int i;
|
||||
|
||||
if (0 > snd_mixer_open(&mixer_handle, amix->card, amix->mix_dev)) {
|
||||
WARNING("mixer_exit(): Opening mixer device %d failed\n",
|
||||
amix->mix_dev);
|
||||
g_free(dev->data_mix);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < emax; i++) {
|
||||
if (0 > snd_mixer_element_write(mixer_handle, &einit[i])) {
|
||||
WARNING("mixer_exit(): write device failed\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
g_free(dev->data_mix);
|
||||
}
|
||||
|
||||
int mixer_init(audiodevice_t *dev, int card, int mixdev, snd_ctl_hw_info_t *hwinfo[]) {
|
||||
snd_mixer_t *handle;
|
||||
mixer_alsa05_t *mix;
|
||||
snd_mixer_elements_t es;
|
||||
int i, j, k;
|
||||
|
||||
if (mixdev == -1) {
|
||||
// 自動の場合、指定の card から使用可能な mixer device を
|
||||
// 選択し SND_MIXER_ETYPE_VOLUME1 があれば、そのデバイスを使う
|
||||
for (i = 0; i < hwinfo[card]->mixerdevs; i++) {
|
||||
if (0 > snd_mixer_open(&handle, card, i)) {
|
||||
return NG;
|
||||
}
|
||||
memset(&es, 0, sizeof(snd_mixer_elements_t));
|
||||
|
||||
// 全 element 数を取得
|
||||
if (0 > snd_mixer_elements(handle, &es)) {
|
||||
snd_mixer_close(handle);
|
||||
return NG;
|
||||
}
|
||||
|
||||
// elemnt が 1つもない場合はerror
|
||||
if (es.elements_over < 1) {
|
||||
snd_mixer_close(handle);
|
||||
return NG;
|
||||
}
|
||||
|
||||
// element の情報を格納する場所の確保
|
||||
es.pelements = g_new(snd_mixer_eid_t, es.elements_over);
|
||||
// 実際に elements を取得
|
||||
es.elements_size = es.elements_over;
|
||||
es.elements = 0;
|
||||
if (0 > snd_mixer_elements(handle, &es)) {
|
||||
g_free(es.pelements);
|
||||
snd_mixer_close(handle);
|
||||
return NG;
|
||||
}
|
||||
snd_mixer_close(handle);
|
||||
|
||||
for (k = 0; k < es.elements; k++) {
|
||||
if (es.pelements[k].type == SND_MIXER_ETYPE_VOLUME1) {
|
||||
// found
|
||||
g_free(es.pelements);
|
||||
mixdev = i;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
g_free(es.pelements);
|
||||
}
|
||||
}
|
||||
out:
|
||||
if (0 > snd_mixer_open(&handle, card, mixdev)) {
|
||||
return NG;
|
||||
}
|
||||
memset(&es, 0, sizeof(snd_mixer_elements_t));
|
||||
|
||||
// 全 element 数を取得
|
||||
if (0 > snd_mixer_elements(handle, &es)) {
|
||||
snd_mixer_close(handle);
|
||||
return NG;
|
||||
}
|
||||
|
||||
// elemnt が 1つもない場合はerror
|
||||
if (es.elements_over < 1) {
|
||||
snd_mixer_close(handle);
|
||||
return NG;
|
||||
}
|
||||
|
||||
// element の情報を格納する場所の確保
|
||||
es.pelements = g_new(snd_mixer_eid_t, es.elements_over);
|
||||
// 実際に elements を取得
|
||||
es.elements_size = es.elements_over;
|
||||
es.elements = 0;
|
||||
if (0 > snd_mixer_elements(handle, &es)) {
|
||||
g_free(es.pelements);
|
||||
snd_mixer_close(handle);
|
||||
return NG;
|
||||
}
|
||||
|
||||
mix = g_new0(mixer_alsa05_t, 1);
|
||||
mix->card = card;
|
||||
mix->mix_dev = mixdev;
|
||||
|
||||
for (i = 0, j = 0; i < es.elements && j < MIXER_ELEMENT_MAX; i++) {
|
||||
if (es.pelements[i].type != SND_MIXER_ETYPE_VOLUME1) continue;
|
||||
|
||||
eid[j] = es.pelements[i];
|
||||
|
||||
// 初期接続設定
|
||||
if (0 == strncmp(SND_MIXER_OUT_MASTER, eid[j].name, strlen(SND_MIXER_OUT_MASTER)) && eid[j].index == 0) {
|
||||
mix->connect[MIX_MASTER] = j;
|
||||
}
|
||||
if (0 == strncmp(SND_MIXER_IN_CD, eid[j].name, strlen(SND_MIXER_IN_CD)) && eid[j].index == 0) {
|
||||
mix->connect[MIX_CD] = j;
|
||||
}
|
||||
if (0 == strncmp(SND_MIXER_IN_SYNTHESIZER, eid[j].name, strlen(SND_MIXER_IN_SYNTHESIZER)) && eid[j].index == 0) {
|
||||
mix->connect[MIX_MIDI] = j;
|
||||
}
|
||||
if (0 == strncmp(SND_MIXER_IN_PCM, eid[j].name, strlen(SND_MIXER_IN_PCM)) && eid[j].index == 0) {
|
||||
mix->connect[MIX_PCM] = j;
|
||||
}
|
||||
|
||||
// 初期 volume の保存
|
||||
einit[j].eid = eid[j];
|
||||
if (0 > snd_mixer_element_build(handle, &einit[j])) {
|
||||
WARNING("snd_mixer_element fail\n");
|
||||
}
|
||||
NOTICE("%s (%d)\n", eid[j].name, einit[j].data.volume1.pvoices[0]);
|
||||
j++;
|
||||
}
|
||||
emax = j;
|
||||
|
||||
// element と element info の取得
|
||||
for (i = 0; i < MIX_NRDEVICES; i++) {
|
||||
mix->e[i].eid = eid[mix->connect[i]];
|
||||
mix->ei[i].eid = eid[mix->connect[i]];
|
||||
snd_mixer_element_build(handle, &mix->e[i]);
|
||||
snd_mixer_element_info_build(handle, &mix->ei[i]);
|
||||
}
|
||||
dev->data_mix = mix;
|
||||
|
||||
snd_mixer_close(handle);
|
||||
|
||||
g_free(es.pelements);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -130,9 +130,6 @@ static void sys35_usage(boolean verbose) {
|
||||
puts(" : /dev/dsp : oss type (device name)");
|
||||
#endif
|
||||
#ifdef ENABLE_ALSA
|
||||
#ifdef ENABLE_ALSA05
|
||||
puts(" : 0:0 : alsa type (card and device)");
|
||||
#endif
|
||||
#ifdef ENABLE_ALSA09
|
||||
puts(" : hw:0,0 : alsa hardware");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user