6119 lines
209 KiB
Diff
6119 lines
209 KiB
Diff
diff -r 9e2f117f24b9 NOTES
|
|
--- a/NOTES Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/NOTES Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -27,11 +27,14 @@ When LIBASOUND_DEBUG=1 is set, the error
|
|
When LIBASOUND_DEBUG=1 is set, the errors in hw_params configuration
|
|
will be dumped to stderr. Note that this will show even the non-fatal
|
|
errors of plug layer (trial-and-error of parameters).
|
|
-When LIBASOUND_DEBUG=2 is set, the default error message handler calls
|
|
-assert() to catch with a debugger, in addition to parameter debugging.
|
|
|
|
This feature is disabled when --with-debug=no is passed to configure,
|
|
i.e. no strict checking is done in alsa-lib.
|
|
+
|
|
+In addition, when --enable-debug-assert configure option is given and
|
|
+when LIBASOUND_DEBUG_ASSERT=1 is set, the default error message
|
|
+handler can call assert() to catch with a debugger. This feature was
|
|
+formerly activated via LIBASOUND_DEBUG=2.
|
|
|
|
|
|
Blocking Open Mode
|
|
diff -r 9e2f117f24b9 configure.in
|
|
--- a/configure.in Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/configure.in Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -167,6 +167,20 @@ else
|
|
else
|
|
AC_DEFINE(NDEBUG,,[No assert debug])
|
|
AC_MSG_RESULT(no)
|
|
+fi
|
|
+
|
|
+if test "$debug" = "yes"; then
|
|
+ AC_MSG_CHECKING(for debug assert)
|
|
+ AC_ARG_ENABLE(debug-assert,
|
|
+ AS_HELP_STRING([--enable-debug],
|
|
+ [enable assert call at the default error message handler]),
|
|
+ debug_assert="$enableval", debug_assert="no")
|
|
+ if test "$debug_assert" = "yes"; then
|
|
+ AC_MSG_RESULT(yes)
|
|
+ AC_DEFINE(ALSA_DEBUG_ASSERT,,[Enable assert at error message handler])
|
|
+ else
|
|
+ AC_MSG_RESULT(no)
|
|
+ fi
|
|
fi
|
|
|
|
dnl Temporary directory
|
|
@@ -330,12 +344,14 @@ AC_ARG_ENABLE(seq,
|
|
AC_ARG_ENABLE(seq,
|
|
AS_HELP_STRING([--disable-seq], [disable the sequencer component]),
|
|
[build_seq="$enableval"], [build_seq="yes"])
|
|
-AC_ARG_ENABLE(instr,
|
|
- AS_HELP_STRING([--disable-instr], [disable the instrument component]),
|
|
- [build_instr="$enableval"], [build_instr="yes"])
|
|
AC_ARG_ENABLE(alisp,
|
|
AS_HELP_STRING([--disable-alisp], [disable the alisp component]),
|
|
[build_alisp="$enableval"], [build_alisp="yes"])
|
|
+AC_ARG_ENABLE(old-symbols,
|
|
+ AS_HELP_STRING([--disable-old-symbols], [disable old obsoleted symbols]),
|
|
+ [keep_old_symbols="$enableval"], [keep_old_symbols="yes"])
|
|
+AM_CONDITIONAL(KEEP_OLD_SYMBOLS, test x$keep_old_symbols = xyes)
|
|
+
|
|
AC_ARG_ENABLE(python,
|
|
AS_HELP_STRING([--disable-python], [disable the python components]),
|
|
[build_python="$enableval"], [build_python="yes"])
|
|
@@ -363,16 +379,11 @@ AC_SUBST(PYTHON_LIBS)
|
|
AC_SUBST(PYTHON_LIBS)
|
|
AC_SUBST(PYTHON_INCLUDES)
|
|
|
|
-if test "$build_seq" != "yes"; then
|
|
- build_instr="no"
|
|
-fi
|
|
-
|
|
AM_CONDITIONAL(BUILD_MIXER, test x$build_mixer = xyes)
|
|
AM_CONDITIONAL(BUILD_PCM, test x$build_pcm = xyes)
|
|
AM_CONDITIONAL(BUILD_RAWMIDI, test x$build_rawmidi = xyes)
|
|
AM_CONDITIONAL(BUILD_HWDEP, test x$build_hwdep = xyes)
|
|
AM_CONDITIONAL(BUILD_SEQ, test x$build_seq = xyes)
|
|
-AM_CONDITIONAL(BUILD_INSTR, test x$build_instr = xyes)
|
|
AM_CONDITIONAL(BUILD_ALISP, test x$build_alisp = xyes)
|
|
AM_CONDITIONAL(BUILD_PYTHON, test x$build_python = xyes)
|
|
|
|
@@ -390,9 +401,6 @@ fi
|
|
fi
|
|
if test "$build_seq" = "yes"; then
|
|
AC_DEFINE([BUILD_SEQ], "1", [Build sequencer component])
|
|
-fi
|
|
-if test "$build_instr" = "yes"; then
|
|
- AC_DEFINE([BUILD_INSTR], "1", [Build instrument component])
|
|
fi
|
|
|
|
dnl PCM Plugins
|
|
@@ -556,7 +564,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pict
|
|
src/control/Makefile src/mixer/Makefile \
|
|
src/pcm/Makefile src/pcm/scopes/Makefile \
|
|
src/rawmidi/Makefile src/timer/Makefile \
|
|
- src/hwdep/Makefile src/seq/Makefile src/instr/Makefile \
|
|
+ src/hwdep/Makefile src/seq/Makefile \
|
|
src/compat/Makefile src/alisp/Makefile src/conf/Makefile \
|
|
src/conf/cards/Makefile \
|
|
src/conf/pcm/Makefile \
|
|
diff -r 9e2f117f24b9 doc/doxygen.cfg
|
|
--- a/doc/doxygen.cfg Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/doc/doxygen.cfg Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -28,8 +28,6 @@ INPUT = index.doxygen \
|
|
../include/pcm_ioplug.h \
|
|
../include/control_external.h \
|
|
../include/mixer.h \
|
|
- ../include/conv.h \
|
|
- ../include/instr.h \
|
|
../src/error.c \
|
|
../src/dlmisc.c \
|
|
../src/async.c \
|
|
diff -r 9e2f117f24b9 include/Makefile.am
|
|
--- a/include/Makefile.am Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/Makefile.am Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -44,10 +44,6 @@ endif
|
|
|
|
if BUILD_SEQ
|
|
alsainclude_HEADERS += seq_event.h seq.h seqmid.h seq_midi_event.h
|
|
-endif
|
|
-
|
|
-if BUILD_INSTR
|
|
-alsainclude_HEADERS += conv.h instr.h
|
|
endif
|
|
|
|
if BUILD_ALISP
|
|
diff -r 9e2f117f24b9 include/control.h
|
|
--- a/include/control.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/control.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -279,7 +279,7 @@ size_t snd_ctl_elem_id_sizeof(void);
|
|
* \brief allocate an invalid #snd_ctl_elem_id_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_ctl_elem_id_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_elem_id_t *) alloca(snd_ctl_elem_id_sizeof()); memset(*ptr, 0, snd_ctl_elem_id_sizeof()); } while (0)
|
|
+#define snd_ctl_elem_id_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_id)
|
|
int snd_ctl_elem_id_malloc(snd_ctl_elem_id_t **ptr);
|
|
void snd_ctl_elem_id_free(snd_ctl_elem_id_t *obj);
|
|
void snd_ctl_elem_id_clear(snd_ctl_elem_id_t *obj);
|
|
@@ -302,7 +302,7 @@ size_t snd_ctl_card_info_sizeof(void);
|
|
* \brief allocate an invalid #snd_ctl_card_info_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_ctl_card_info_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_card_info_t *) alloca(snd_ctl_card_info_sizeof()); memset(*ptr, 0, snd_ctl_card_info_sizeof()); } while (0)
|
|
+#define snd_ctl_card_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_card_info)
|
|
int snd_ctl_card_info_malloc(snd_ctl_card_info_t **ptr);
|
|
void snd_ctl_card_info_free(snd_ctl_card_info_t *obj);
|
|
void snd_ctl_card_info_clear(snd_ctl_card_info_t *obj);
|
|
@@ -320,7 +320,7 @@ size_t snd_ctl_event_sizeof(void);
|
|
* \brief allocate an invalid #snd_ctl_event_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_ctl_event_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_event_t *) alloca(snd_ctl_event_sizeof()); memset(*ptr, 0, snd_ctl_event_sizeof()); } while (0)
|
|
+#define snd_ctl_event_alloca(ptr) __snd_alloca(ptr, snd_ctl_event)
|
|
int snd_ctl_event_malloc(snd_ctl_event_t **ptr);
|
|
void snd_ctl_event_free(snd_ctl_event_t *obj);
|
|
void snd_ctl_event_clear(snd_ctl_event_t *obj);
|
|
@@ -332,7 +332,7 @@ size_t snd_ctl_elem_list_sizeof(void);
|
|
* \brief allocate an invalid #snd_ctl_elem_list_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_ctl_elem_list_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_elem_list_t *) alloca(snd_ctl_elem_list_sizeof()); memset(*ptr, 0, snd_ctl_elem_list_sizeof()); } while (0)
|
|
+#define snd_ctl_elem_list_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_list)
|
|
int snd_ctl_elem_list_malloc(snd_ctl_elem_list_t **ptr);
|
|
void snd_ctl_elem_list_free(snd_ctl_elem_list_t *obj);
|
|
void snd_ctl_elem_list_clear(snd_ctl_elem_list_t *obj);
|
|
@@ -353,7 +353,7 @@ size_t snd_ctl_elem_info_sizeof(void);
|
|
* \brief allocate an invalid #snd_ctl_elem_info_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_ctl_elem_info_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_elem_info_t *) alloca(snd_ctl_elem_info_sizeof()); memset(*ptr, 0, snd_ctl_elem_info_sizeof()); } while (0)
|
|
+#define snd_ctl_elem_info_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_info)
|
|
int snd_ctl_elem_info_malloc(snd_ctl_elem_info_t **ptr);
|
|
void snd_ctl_elem_info_free(snd_ctl_elem_info_t *obj);
|
|
void snd_ctl_elem_info_clear(snd_ctl_elem_info_t *obj);
|
|
@@ -408,7 +408,7 @@ size_t snd_ctl_elem_value_sizeof(void);
|
|
* \brief allocate an invalid #snd_ctl_elem_value_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_ctl_elem_value_alloca(ptr) do { assert(ptr); *ptr = (snd_ctl_elem_value_t *) alloca(snd_ctl_elem_value_sizeof()); memset(*ptr, 0, snd_ctl_elem_value_sizeof()); } while (0)
|
|
+#define snd_ctl_elem_value_alloca(ptr) __snd_alloca(ptr, snd_ctl_elem_value)
|
|
int snd_ctl_elem_value_malloc(snd_ctl_elem_value_t **ptr);
|
|
void snd_ctl_elem_value_free(snd_ctl_elem_value_t *obj);
|
|
void snd_ctl_elem_value_clear(snd_ctl_elem_value_t *obj);
|
|
@@ -441,6 +441,21 @@ const void * snd_ctl_elem_value_get_byte
|
|
const void * snd_ctl_elem_value_get_bytes(const snd_ctl_elem_value_t *obj);
|
|
void snd_ctl_elem_value_get_iec958(const snd_ctl_elem_value_t *obj, snd_aes_iec958_t *ptr);
|
|
void snd_ctl_elem_value_set_iec958(snd_ctl_elem_value_t *obj, const snd_aes_iec958_t *ptr);
|
|
+
|
|
+int snd_tlv_parse_dB_info(unsigned int *tlv, unsigned int tlv_size,
|
|
+ unsigned int **db_tlvp);
|
|
+int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
|
|
+ long *min, long *max);
|
|
+int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
|
|
+ long volume, long *db_gain);
|
|
+int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
|
|
+ long db_gain, long *value, int xdir);
|
|
+int snd_ctl_get_dB_range(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
|
+ long *min, long *max);
|
|
+int snd_ctl_convert_to_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
|
+ long volume, long *db_gain);
|
|
+int snd_ctl_convert_from_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
|
+ long db_gain, long *value, int xdir);
|
|
|
|
/**
|
|
* \defgroup HControl High level Control Interface
|
|
diff -r 9e2f117f24b9 include/conv.h
|
|
--- a/include/conv.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
@@ -1,57 +0,0 @@
|
|
-/**
|
|
- * \file include/conv.h
|
|
- * \brief Application interface library for the ALSA driver
|
|
- * \author Jaroslav Kysela <perex@perex.cz>
|
|
- * \author Abramo Bagnara <abramo@alsa-project.org>
|
|
- * \author Takashi Iwai <tiwai@suse.de>
|
|
- * \date 1998-2001
|
|
- *
|
|
- * Application interface library for the ALSA driver
|
|
- */
|
|
-/*
|
|
- * This library is free software; you can redistribute it and/or modify
|
|
- * it under the terms of the GNU Lesser General Public License as
|
|
- * published by the Free Software Foundation; either version 2.1 of
|
|
- * 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_CONV_H
|
|
-#define __ALSA_CONV_H
|
|
-
|
|
-/**
|
|
- * \defgroup BConv Binary Value Conversion
|
|
- * Helper macros to convert binary values to/from a specific byte order.
|
|
- * \{
|
|
- */
|
|
-
|
|
-/** Converts a 16-bit value from host to little endian byte order. */
|
|
-#define snd_host_to_LE_16(val) __cpu_to_le16(val)
|
|
-/** Converts a 16-bit value from little endian to host byte order. */
|
|
-#define snd_LE_to_host_16(val) __le16_to_cpu(val)
|
|
-/** Converts a 32-bit value from host to little endian byte order. */
|
|
-#define snd_host_to_LE_32(val) __cpu_to_le32(val)
|
|
-/** Converts a 32-bit value from little endian to host byte order. */
|
|
-#define snd_LE_to_host_32(val) __le32_to_cpu(val)
|
|
-/** Converts a 16-bit value from host to big endian byte order. */
|
|
-#define snd_host_to_BE_16(val) __cpu_to_be16(val)
|
|
-/** Converts a 16-bit value from big endian to host byte order. */
|
|
-#define snd_BE_to_host_16(val) __be16_to_cpu(val)
|
|
-/** Converts a 32-bit value from host to big endian byte order. */
|
|
-#define snd_host_to_BE_32(val) __cpu_to_be32(val)
|
|
-/** Converts a 32-bit value from big endian to host byte order. */
|
|
-#define snd_BE_to_host_32(val) __be32_to_cpu(val)
|
|
-
|
|
-/** \} */
|
|
-
|
|
-#endif /* __ALSA_CONV_H */
|
|
-
|
|
diff -r 9e2f117f24b9 include/global.h
|
|
--- a/include/global.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/global.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -102,6 +102,9 @@ int snd_dlclose(void *handle);
|
|
int snd_dlclose(void *handle);
|
|
|
|
|
|
+/** \brief alloca helper macro. */
|
|
+#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
|
|
+
|
|
/**
|
|
* \brief Internal structure for an async notification client handler.
|
|
*
|
|
diff -r 9e2f117f24b9 include/hwdep.h
|
|
--- a/include/hwdep.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/hwdep.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -108,7 +108,7 @@ ssize_t snd_hwdep_read(snd_hwdep_t *hwde
|
|
|
|
size_t snd_hwdep_info_sizeof(void);
|
|
/** allocate #snd_hwdep_info_t container on stack */
|
|
-#define snd_hwdep_info_alloca(ptr) do { assert(ptr); *ptr = (snd_hwdep_info_t *) alloca(snd_hwdep_info_sizeof()); memset(*ptr, 0, snd_hwdep_info_sizeof()); } while (0)
|
|
+#define snd_hwdep_info_alloca(ptr) __snd_alloca(ptr, snd_hwdep_info)
|
|
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
|
|
void snd_hwdep_info_free(snd_hwdep_info_t *obj);
|
|
void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src);
|
|
@@ -122,7 +122,7 @@ void snd_hwdep_info_set_device(snd_hwdep
|
|
|
|
size_t snd_hwdep_dsp_status_sizeof(void);
|
|
/** allocate #snd_hwdep_dsp_status_t container on stack */
|
|
-#define snd_hwdep_dsp_status_alloca(ptr) do { assert(ptr); *ptr = (snd_hwdep_dsp_status_t *) alloca(snd_hwdep_dsp_status_sizeof()); memset(*ptr, 0, snd_hwdep_dsp_status_sizeof()); } while (0)
|
|
+#define snd_hwdep_dsp_status_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_status)
|
|
int snd_hwdep_dsp_status_malloc(snd_hwdep_dsp_status_t **ptr);
|
|
void snd_hwdep_dsp_status_free(snd_hwdep_dsp_status_t *obj);
|
|
void snd_hwdep_dsp_status_copy(snd_hwdep_dsp_status_t *dst, const snd_hwdep_dsp_status_t *src);
|
|
@@ -135,7 +135,7 @@ unsigned int snd_hwdep_dsp_status_get_ch
|
|
|
|
size_t snd_hwdep_dsp_image_sizeof(void);
|
|
/** allocate #snd_hwdep_dsp_image_t container on stack */
|
|
-#define snd_hwdep_dsp_image_alloca(ptr) do { assert(ptr); *ptr = (snd_hwdep_dsp_image_t *) alloca(snd_hwdep_dsp_image_sizeof()); memset(*ptr, 0, snd_hwdep_dsp_image_sizeof()); } while (0)
|
|
+#define snd_hwdep_dsp_image_alloca(ptr) __snd_alloca(ptr, snd_hwdep_dsp_image)
|
|
int snd_hwdep_dsp_image_malloc(snd_hwdep_dsp_image_t **ptr);
|
|
void snd_hwdep_dsp_image_free(snd_hwdep_dsp_image_t *obj);
|
|
void snd_hwdep_dsp_image_copy(snd_hwdep_dsp_image_t *dst, const snd_hwdep_dsp_image_t *src);
|
|
diff -r 9e2f117f24b9 include/instr.h
|
|
--- a/include/instr.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
@@ -1,177 +0,0 @@
|
|
-/**
|
|
- * \file include/instr.h
|
|
- * \brief Application interface library for the ALSA driver
|
|
- * \author Jaroslav Kysela <perex@perex.cz>
|
|
- * \author Abramo Bagnara <abramo@alsa-project.org>
|
|
- * \author Takashi Iwai <tiwai@suse.de>
|
|
- * \date 1998-2001
|
|
- *
|
|
- * Application interface library for the ALSA driver
|
|
- */
|
|
-/*
|
|
- * This library is free software; you can redistribute it and/or modify
|
|
- * it under the terms of the GNU Lesser General Public License as
|
|
- * published by the Free Software Foundation; either version 2.1 of
|
|
- * 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_INSTR_H
|
|
-#define __ALSA_INSTR_H
|
|
-
|
|
-#ifdef __cplusplus
|
|
-extern "C" {
|
|
-#endif
|
|
-
|
|
-/**
|
|
- * \defgroup Instrument Instrument Interface
|
|
- * The Instrument Interface.
|
|
- * \{
|
|
- */
|
|
-
|
|
-/* instrument get/put */
|
|
-
|
|
-/** container for sequencer instrument header */
|
|
-typedef struct _snd_instr_header snd_instr_header_t;
|
|
-
|
|
-size_t snd_instr_header_sizeof(void);
|
|
-#define snd_instr_header_alloca(ptr) \
|
|
-do {\
|
|
- assert(ptr);\
|
|
- *ptr = (snd_instr_header_t *)alloca(snd_instr_header_sizeof());\
|
|
- memset(*ptr, 0, snd_instr_header_sizeof());\
|
|
-} while (0) /**< allocate instrument header on stack */
|
|
-int snd_instr_header_malloc(snd_instr_header_t **ptr, size_t len);
|
|
-void snd_instr_header_free(snd_instr_header_t *ptr);
|
|
-void snd_instr_header_copy(snd_instr_header_t *dst, const snd_instr_header_t *src);
|
|
-
|
|
-const snd_seq_instr_t *snd_instr_header_get_id(const snd_instr_header_t *info);
|
|
-snd_seq_instr_cluster_t snd_instr_header_get_cluster(const snd_instr_header_t *info);
|
|
-unsigned int snd_instr_header_get_cmd(const snd_instr_header_t *info);
|
|
-size_t snd_instr_header_get_len(const snd_instr_header_t *info);
|
|
-const char *snd_instr_header_get_name(const snd_instr_header_t *info);
|
|
-int snd_instr_header_get_type(const snd_instr_header_t *info);
|
|
-const char *snd_instr_header_get_format(const snd_instr_header_t *info);
|
|
-const snd_seq_instr_t *snd_instr_header_get_alias(const snd_instr_header_t *info);
|
|
-void *snd_instr_header_get_data(const snd_instr_header_t *info);
|
|
-int snd_instr_header_get_follow_alias(const snd_instr_header_t *info);
|
|
-
|
|
-void snd_instr_header_set_id(snd_instr_header_t *info, const snd_seq_instr_t *id);
|
|
-void snd_instr_header_set_cluster(snd_instr_header_t *info, snd_seq_instr_cluster_t cluster);
|
|
-void snd_instr_header_set_cmd(snd_instr_header_t *info, unsigned int cmd);
|
|
-void snd_instr_header_set_len(snd_instr_header_t *info, size_t len);
|
|
-void snd_instr_header_set_name(snd_instr_header_t *info, const char *name);
|
|
-void snd_instr_header_set_type(snd_instr_header_t *info, int type);
|
|
-void snd_instr_header_set_format(snd_instr_header_t *info, const char *format);
|
|
-void snd_instr_header_set_alias(snd_instr_header_t *info, const snd_seq_instr_t *instr);
|
|
-void snd_instr_header_set_follow_alias(snd_instr_header_t *info, int val);
|
|
-
|
|
-/**
|
|
- * Instrument abstraction layer
|
|
- * - based on events
|
|
- */
|
|
-
|
|
-/** instrument types */
|
|
-#define SND_SEQ_INSTR_ATYPE_DATA 0 /**< instrument data */
|
|
-#define SND_SEQ_INSTR_ATYPE_ALIAS 1 /**< instrument alias */
|
|
-
|
|
-/** instrument ASCII identifiers */
|
|
-#define SND_SEQ_INSTR_ID_DLS1 "DLS1" /**< DLS1 */
|
|
-#define SND_SEQ_INSTR_ID_DLS2 "DLS2" /**< DLS2 */
|
|
-#define SND_SEQ_INSTR_ID_SIMPLE "Simple Wave" /**< Simple Wave */
|
|
-#define SND_SEQ_INSTR_ID_SOUNDFONT "SoundFont" /**< SoundFont */
|
|
-#define SND_SEQ_INSTR_ID_GUS_PATCH "GUS Patch" /**< Gravis Patch */
|
|
-#define SND_SEQ_INSTR_ID_INTERWAVE "Interwave FFFF" /**< InterWave FFFF */
|
|
-#define SND_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM" /**< OPL2/3 FM */
|
|
-#define SND_SEQ_INSTR_ID_OPL4 "OPL4" /**< OPL4 */
|
|
-
|
|
-/** instrument types */
|
|
-#define SND_SEQ_INSTR_TYPE0_DLS1 (1<<0) /**< MIDI DLS v1 */
|
|
-#define SND_SEQ_INSTR_TYPE0_DLS2 (1<<1) /**< MIDI DLS v2 */
|
|
-#define SND_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /**< Simple Wave */
|
|
-#define SND_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /**< EMU SoundFont */
|
|
-#define SND_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /**< Gravis UltraSound Patch */
|
|
-#define SND_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /**< InterWave FFFF */
|
|
-#define SND_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /**< Yamaha OPL2/3 FM */
|
|
-#define SND_SEQ_INSTR_TYPE2_OPL4 (1<<1) /**< Yamaha OPL4 */
|
|
-
|
|
-/** put commands */
|
|
-#define SND_SEQ_INSTR_PUT_CMD_CREATE 0 /**< create a new layer */
|
|
-#define SND_SEQ_INSTR_PUT_CMD_REPLACE 1 /**< replace the old layer with new one */
|
|
-#define SND_SEQ_INSTR_PUT_CMD_MODIFY 2 /**< modify the existing layer */
|
|
-#define SND_SEQ_INSTR_PUT_CMD_ADD 3 /**< add one to the existing layer */
|
|
-#define SND_SEQ_INSTR_PUT_CMD_REMOVE 4 /**< remove the layer */
|
|
-
|
|
-/** get commands */
|
|
-#define SND_SEQ_INSTR_GET_CMD_FULL 0 /**< get the full data stream */
|
|
-#define SND_SEQ_INSTR_GET_CMD_PARTIAL 1 /**< get the partial data stream */
|
|
-
|
|
-/* query flags */
|
|
-#define SND_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0) /**< follow alias to get the instrument data */
|
|
-
|
|
-/** free commands */
|
|
-#define SND_SEQ_INSTR_FREE_CMD_ALL 0 /**< remove all matching instruments */
|
|
-#define SND_SEQ_INSTR_FREE_CMD_PRIVATE 1 /**< remove only private instruments */
|
|
-#define SND_SEQ_INSTR_FREE_CMD_CLUSTER 2 /**< remove only cluster instruments */
|
|
-#define SND_SEQ_INSTR_FREE_CMD_SINGLE 3 /**< remove single instrument */
|
|
-
|
|
-
|
|
-/**
|
|
- * FM instrument support
|
|
- */
|
|
-
|
|
-/** FM instrument data structure */
|
|
-typedef void snd_instr_fm_t;
|
|
-
|
|
-int snd_instr_fm_convert_to_stream(snd_instr_fm_t *fm, const char *name, snd_instr_header_t **put, size_t *size);
|
|
-int snd_instr_fm_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_fm_t **fm);
|
|
-int snd_instr_fm_free(snd_instr_fm_t *fm);
|
|
-
|
|
-
|
|
-/**
|
|
- * Simple Wave support
|
|
- */
|
|
-
|
|
-/** simple instrument data structure */
|
|
-typedef void snd_instr_simple_t;
|
|
-
|
|
-int snd_instr_simple_convert_to_stream(snd_instr_simple_t *simple, const char *name, snd_instr_header_t **put, size_t *size);
|
|
-int snd_instr_simple_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_simple_t **simple);
|
|
-int snd_instr_simple_free(snd_instr_simple_t *simple);
|
|
-
|
|
-
|
|
-/**
|
|
- * InterWave FFFF support
|
|
- */
|
|
-
|
|
-/** IW FFFF instrument data structure */
|
|
-typedef void snd_instr_iwffff_t;
|
|
-/** IW FFFF handler */
|
|
-typedef struct _snd_iwffff_handle snd_iwffff_handle_t;
|
|
-
|
|
-int snd_instr_iwffff_open(snd_iwffff_handle_t **handle, const char *name_fff, const char *name_dta);
|
|
-int snd_instr_iwffff_open_rom(snd_iwffff_handle_t **handle, int card, int bank, int file);
|
|
-int snd_instr_iwffff_open_rom_file(snd_iwffff_handle_t **handle, const char *name, int bank, int file);
|
|
-int snd_instr_iwffff_close(snd_iwffff_handle_t *handle);
|
|
-int snd_instr_iwffff_load(snd_iwffff_handle_t *handle, int bank, int prg, snd_instr_iwffff_t **iwffff);
|
|
-int snd_instr_iwffff_convert_to_stream(snd_instr_iwffff_t *iwffff, const char *name, snd_instr_header_t **data, size_t *size);
|
|
-int snd_instr_iwffff_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_iwffff_t **iwffff);
|
|
-int snd_instr_iwffff_free(snd_instr_iwffff_t *iwffff);
|
|
-
|
|
-/** \} */
|
|
-
|
|
-#ifdef __cplusplus
|
|
-}
|
|
-#endif
|
|
-
|
|
-#endif /* __ALSA_INSTR_H */
|
|
-
|
|
diff -r 9e2f117f24b9 include/local.h
|
|
--- a/include/local.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/local.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -76,24 +76,19 @@
|
|
#define _snd_seq_query_subscribe sndrv_seq_query_subs
|
|
#define _snd_seq_client_pool sndrv_seq_client_pool
|
|
#define _snd_seq_remove_events sndrv_seq_remove_events
|
|
-#define _snd_instr_header sndrv_seq_instr_header
|
|
|
|
#define sndrv_seq_addr snd_seq_addr
|
|
#define sndrv_seq_tick_time_t snd_seq_tick_time_t
|
|
#define sndrv_seq_real_time snd_seq_real_time
|
|
#define sndrv_seq_timestamp snd_seq_timestamp
|
|
-#define sndrv_seq_instr snd_seq_instr
|
|
#define sndrv_seq_event snd_seq_event
|
|
-#define sndrv_seq_instr_cluster_t snd_seq_instr_cluster_t
|
|
|
|
#if 0
|
|
typedef struct sndrv_seq_addr snd_seq_addr_t;
|
|
#define snd_seq_tick_time_t sndrv_seq_tick_time_t
|
|
typedef struct sndrv_seq_real_time snd_seq_real_time_t;
|
|
typedef union sndrv_seq_timestamp snd_seq_timestamp_t;
|
|
-typedef struct sndrv_seq_instr snd_seq_instr_t;
|
|
typedef struct sndrv_seq_event snd_seq_event_t;
|
|
-#define snd_seq_instr_cluster_t sndrv_seq_instr_cluster_t
|
|
#endif
|
|
|
|
#define _snd_timer_id sndrv_timer_id
|
|
@@ -128,8 +123,6 @@ typedef struct sndrv_seq_event snd_seq_e
|
|
#include <sound/asequencer.h>
|
|
#include "seqmid.h"
|
|
#include "seq_midi_event.h"
|
|
-#include "conv.h"
|
|
-#include "instr.h"
|
|
#include "list.h"
|
|
|
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
|
@@ -254,6 +247,20 @@ static inline int snd_open_device(const
|
|
#define snd_open_device(filename, fmode) open(filename, fmode);
|
|
#endif
|
|
|
|
+/* make local functions really local */
|
|
+#define snd_dlobj_cache_lookup \
|
|
+ snd1_dlobj_cache_lookup
|
|
+#define snd_dlobj_cache_add \
|
|
+ snd1_dlobj_cache_add
|
|
+#define snd_dlobj_cache_cleanup \
|
|
+ snd1_dlobj_cache_cleanup
|
|
+#define snd_config_set_hop \
|
|
+ snd1_config_set_hop
|
|
+#define snd_config_check_hop \
|
|
+ snd1_config_check_hop
|
|
+#define snd_config_search_alias_hooks \
|
|
+ snd1_config_search_alias_hooks
|
|
+
|
|
/* dlobj cache */
|
|
void *snd_dlobj_cache_lookup(const char *name);
|
|
int snd_dlobj_cache_add(const char *name, void *dlobj, void *open_func);
|
|
diff -r 9e2f117f24b9 include/mixer.h
|
|
--- a/include/mixer.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/mixer.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -146,7 +146,7 @@ size_t snd_mixer_class_sizeof(void);
|
|
* \brief allocate an invalid #snd_mixer_class_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_mixer_class_alloca(ptr) do { assert(ptr); *ptr = (snd_mixer_class_t *) alloca(snd_mixer_class_sizeof()); memset(*ptr, 0, snd_mixer_class_sizeof()); } while (0)
|
|
+#define snd_mixer_class_alloca(ptr) __snd_alloca(ptr, snd_mixer_class)
|
|
int snd_mixer_class_malloc(snd_mixer_class_t **ptr);
|
|
void snd_mixer_class_free(snd_mixer_class_t *obj);
|
|
void snd_mixer_class_copy(snd_mixer_class_t *dst, const snd_mixer_class_t *src);
|
|
@@ -294,7 +294,7 @@ size_t snd_mixer_selem_id_sizeof(void);
|
|
* \brief allocate an invalid #snd_mixer_selem_id_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_mixer_selem_id_alloca(ptr) do { assert(ptr); *ptr = (snd_mixer_selem_id_t *) alloca(snd_mixer_selem_id_sizeof()); memset(*ptr, 0, snd_mixer_selem_id_sizeof()); } while (0)
|
|
+#define snd_mixer_selem_id_alloca(ptr) __snd_alloca(ptr, snd_mixer_selem_id)
|
|
int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr);
|
|
void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj);
|
|
void snd_mixer_selem_id_copy(snd_mixer_selem_id_t *dst, const snd_mixer_selem_id_t *src);
|
|
diff -r 9e2f117f24b9 include/pcm.h
|
|
--- a/include/pcm.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/pcm.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -470,7 +470,7 @@ size_t snd_pcm_info_sizeof(void);
|
|
* \brief allocate an invalid #snd_pcm_info_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_pcm_info_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_info_t *) alloca(snd_pcm_info_sizeof()); memset(*ptr, 0, snd_pcm_info_sizeof()); } while (0)
|
|
+#define snd_pcm_info_alloca(ptr) __snd_alloca(ptr, snd_pcm_info)
|
|
int snd_pcm_info_malloc(snd_pcm_info_t **ptr);
|
|
void snd_pcm_info_free(snd_pcm_info_t *obj);
|
|
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
|
|
@@ -548,7 +548,7 @@ size_t snd_pcm_hw_params_sizeof(void);
|
|
* \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_pcm_hw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_hw_params_t *) alloca(snd_pcm_hw_params_sizeof()); memset(*ptr, 0, snd_pcm_hw_params_sizeof()); } while (0)
|
|
+#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
|
|
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);
|
|
@@ -699,7 +699,7 @@ size_t snd_pcm_sw_params_sizeof(void);
|
|
* \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_pcm_sw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_sw_params_t *) alloca(snd_pcm_sw_params_sizeof()); memset(*ptr, 0, snd_pcm_sw_params_sizeof()); } while (0)
|
|
+#define snd_pcm_sw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_sw_params)
|
|
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr);
|
|
void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj);
|
|
void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src);
|
|
@@ -747,7 +747,7 @@ size_t snd_pcm_access_mask_sizeof(void);
|
|
* \brief allocate an empty #snd_pcm_access_mask_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_pcm_access_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_access_mask_t *) alloca(snd_pcm_access_mask_sizeof()); memset(*ptr, 0, snd_pcm_access_mask_sizeof()); } while (0)
|
|
+#define snd_pcm_access_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_access_mask)
|
|
int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr);
|
|
void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj);
|
|
void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src);
|
|
@@ -772,7 +772,7 @@ size_t snd_pcm_format_mask_sizeof(void);
|
|
* \brief allocate an empty #snd_pcm_format_mask_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_pcm_format_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_format_mask_t *) alloca(snd_pcm_format_mask_sizeof()); memset(*ptr, 0, snd_pcm_format_mask_sizeof()); } while (0)
|
|
+#define snd_pcm_format_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_format_mask)
|
|
int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr);
|
|
void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj);
|
|
void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src);
|
|
@@ -797,7 +797,7 @@ size_t snd_pcm_subformat_mask_sizeof(voi
|
|
* \brief allocate an empty #snd_pcm_subformat_mask_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_pcm_subformat_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_subformat_mask_t *) alloca(snd_pcm_subformat_mask_sizeof()); memset(*ptr, 0, snd_pcm_subformat_mask_sizeof()); } while (0)
|
|
+#define snd_pcm_subformat_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_subformat_mask)
|
|
int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr);
|
|
void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj);
|
|
void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src);
|
|
@@ -822,7 +822,7 @@ size_t snd_pcm_status_sizeof(void);
|
|
* \brief allocate an invalid #snd_pcm_status_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_pcm_status_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_status_t *) alloca(snd_pcm_status_sizeof()); memset(*ptr, 0, snd_pcm_status_sizeof()); } while (0)
|
|
+#define snd_pcm_status_alloca(ptr) __snd_alloca(ptr, snd_pcm_status)
|
|
int snd_pcm_status_malloc(snd_pcm_status_t **ptr);
|
|
void snd_pcm_status_free(snd_pcm_status_t *obj);
|
|
void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src);
|
|
diff -r 9e2f117f24b9 include/pcm_ioplug.h
|
|
--- a/include/pcm_ioplug.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/pcm_ioplug.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -208,6 +208,9 @@ int snd_pcm_ioplug_set_param_minmax(snd_
|
|
int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *io, int type, unsigned int min, unsigned int max);
|
|
int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *io, int type, unsigned int num_list, const unsigned int *list);
|
|
|
|
+/* change PCM status */
|
|
+int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state);
|
|
+
|
|
/** \} */
|
|
|
|
#endif /* __ALSA_PCM_IOPLUG_H */
|
|
diff -r 9e2f117f24b9 include/rawmidi.h
|
|
--- a/include/rawmidi.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/rawmidi.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -93,7 +93,7 @@ size_t snd_rawmidi_info_sizeof(void);
|
|
* \brief allocate an invalid #snd_rawmidi_info_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_rawmidi_info_alloca(ptr) do { assert(ptr); *ptr = (snd_rawmidi_info_t *) alloca(snd_rawmidi_info_sizeof()); memset(*ptr, 0, snd_rawmidi_info_sizeof()); } while (0)
|
|
+#define snd_rawmidi_info_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_info)
|
|
int snd_rawmidi_info_malloc(snd_rawmidi_info_t **ptr);
|
|
void snd_rawmidi_info_free(snd_rawmidi_info_t *obj);
|
|
void snd_rawmidi_info_copy(snd_rawmidi_info_t *dst, const snd_rawmidi_info_t *src);
|
|
@@ -116,7 +116,7 @@ size_t snd_rawmidi_params_sizeof(void);
|
|
* \brief allocate an invalid #snd_rawmidi_params_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_rawmidi_params_alloca(ptr) do { assert(ptr); *ptr = (snd_rawmidi_params_t *) alloca(snd_rawmidi_params_sizeof()); memset(*ptr, 0, snd_rawmidi_params_sizeof()); } while (0)
|
|
+#define snd_rawmidi_params_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_params)
|
|
int snd_rawmidi_params_malloc(snd_rawmidi_params_t **ptr);
|
|
void snd_rawmidi_params_free(snd_rawmidi_params_t *obj);
|
|
void snd_rawmidi_params_copy(snd_rawmidi_params_t *dst, const snd_rawmidi_params_t *src);
|
|
@@ -133,7 +133,7 @@ size_t snd_rawmidi_status_sizeof(void);
|
|
* \brief allocate an invalid #snd_rawmidi_status_t using standard alloca
|
|
* \param ptr returned pointer
|
|
*/
|
|
-#define snd_rawmidi_status_alloca(ptr) do { assert(ptr); *ptr = (snd_rawmidi_status_t *) alloca(snd_rawmidi_status_sizeof()); memset(*ptr, 0, snd_rawmidi_status_sizeof()); } while (0)
|
|
+#define snd_rawmidi_status_alloca(ptr) __snd_alloca(ptr, snd_rawmidi_status)
|
|
int snd_rawmidi_status_malloc(snd_rawmidi_status_t **ptr);
|
|
void snd_rawmidi_status_free(snd_rawmidi_status_t *obj);
|
|
void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status_t *src);
|
|
diff -r 9e2f117f24b9 include/seq.h
|
|
--- a/include/seq.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/seq.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -45,15 +45,6 @@ extern "C" {
|
|
|
|
/** Sequencer handle */
|
|
typedef struct _snd_seq snd_seq_t;
|
|
-
|
|
-#ifndef DOC_HIDDEN
|
|
-#define SND_ALLOCA(type,ptr) \
|
|
-do {\
|
|
- assert(ptr);\
|
|
- *ptr = (type##_t *)alloca(type##_sizeof());\
|
|
- memset(*ptr, 0, type##_sizeof());\
|
|
-} while (0)
|
|
-#endif
|
|
|
|
/**
|
|
* sequencer opening stream types
|
|
@@ -106,7 +97,7 @@ size_t snd_seq_system_info_sizeof(void);
|
|
size_t snd_seq_system_info_sizeof(void);
|
|
/** allocate a #snd_seq_system_info_t container on stack */
|
|
#define snd_seq_system_info_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_system_info, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_system_info)
|
|
int snd_seq_system_info_malloc(snd_seq_system_info_t **ptr);
|
|
void snd_seq_system_info_free(snd_seq_system_info_t *ptr);
|
|
void snd_seq_system_info_copy(snd_seq_system_info_t *dst, const snd_seq_system_info_t *src);
|
|
@@ -142,7 +133,7 @@ size_t snd_seq_client_info_sizeof(void);
|
|
size_t snd_seq_client_info_sizeof(void);
|
|
/** allocate a #snd_seq_client_info_t container on stack */
|
|
#define snd_seq_client_info_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_client_info, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_client_info)
|
|
int snd_seq_client_info_malloc(snd_seq_client_info_t **ptr);
|
|
void snd_seq_client_info_free(snd_seq_client_info_t *ptr);
|
|
void snd_seq_client_info_copy(snd_seq_client_info_t *dst, const snd_seq_client_info_t *src);
|
|
@@ -176,7 +167,7 @@ size_t snd_seq_client_pool_sizeof(void);
|
|
size_t snd_seq_client_pool_sizeof(void);
|
|
/** allocate a #snd_seq_client_pool_t container on stack */
|
|
#define snd_seq_client_pool_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_client_pool, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_client_pool)
|
|
int snd_seq_client_pool_malloc(snd_seq_client_pool_t **ptr);
|
|
void snd_seq_client_pool_free(snd_seq_client_pool_t *ptr);
|
|
void snd_seq_client_pool_copy(snd_seq_client_pool_t *dst, const snd_seq_client_pool_t *src);
|
|
@@ -265,7 +256,7 @@ size_t snd_seq_port_info_sizeof(void);
|
|
size_t snd_seq_port_info_sizeof(void);
|
|
/** allocate a #snd_seq_port_info_t container on stack */
|
|
#define snd_seq_port_info_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_port_info, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_port_info)
|
|
int snd_seq_port_info_malloc(snd_seq_port_info_t **ptr);
|
|
void snd_seq_port_info_free(snd_seq_port_info_t *ptr);
|
|
void snd_seq_port_info_copy(snd_seq_port_info_t *dst, const snd_seq_port_info_t *src);
|
|
@@ -323,7 +314,7 @@ size_t snd_seq_port_subscribe_sizeof(voi
|
|
size_t snd_seq_port_subscribe_sizeof(void);
|
|
/** allocate a #snd_seq_port_subscribe_t container on stack */
|
|
#define snd_seq_port_subscribe_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_port_subscribe, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_port_subscribe)
|
|
int snd_seq_port_subscribe_malloc(snd_seq_port_subscribe_t **ptr);
|
|
void snd_seq_port_subscribe_free(snd_seq_port_subscribe_t *ptr);
|
|
void snd_seq_port_subscribe_copy(snd_seq_port_subscribe_t *dst, const snd_seq_port_subscribe_t *src);
|
|
@@ -361,7 +352,7 @@ size_t snd_seq_query_subscribe_sizeof(vo
|
|
size_t snd_seq_query_subscribe_sizeof(void);
|
|
/** allocate a #snd_seq_query_subscribe_t container on stack */
|
|
#define snd_seq_query_subscribe_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_query_subscribe, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_query_subscribe)
|
|
int snd_seq_query_subscribe_malloc(snd_seq_query_subscribe_t **ptr);
|
|
void snd_seq_query_subscribe_free(snd_seq_query_subscribe_t *ptr);
|
|
void snd_seq_query_subscribe_copy(snd_seq_query_subscribe_t *dst, const snd_seq_query_subscribe_t *src);
|
|
@@ -411,7 +402,7 @@ size_t snd_seq_queue_info_sizeof(void);
|
|
size_t snd_seq_queue_info_sizeof(void);
|
|
/** allocate a #snd_seq_queue_info_t container on stack */
|
|
#define snd_seq_queue_info_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_queue_info, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_queue_info)
|
|
int snd_seq_queue_info_malloc(snd_seq_queue_info_t **ptr);
|
|
void snd_seq_queue_info_free(snd_seq_queue_info_t *ptr);
|
|
void snd_seq_queue_info_copy(snd_seq_queue_info_t *dst, const snd_seq_queue_info_t *src);
|
|
@@ -443,7 +434,7 @@ size_t snd_seq_queue_status_sizeof(void)
|
|
size_t snd_seq_queue_status_sizeof(void);
|
|
/** allocate a #snd_seq_queue_status_t container on stack */
|
|
#define snd_seq_queue_status_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_queue_status, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_queue_status)
|
|
int snd_seq_queue_status_malloc(snd_seq_queue_status_t **ptr);
|
|
void snd_seq_queue_status_free(snd_seq_queue_status_t *ptr);
|
|
void snd_seq_queue_status_copy(snd_seq_queue_status_t *dst, const snd_seq_queue_status_t *src);
|
|
@@ -461,7 +452,7 @@ size_t snd_seq_queue_tempo_sizeof(void);
|
|
size_t snd_seq_queue_tempo_sizeof(void);
|
|
/** allocate a #snd_seq_queue_tempo_t container on stack */
|
|
#define snd_seq_queue_tempo_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_queue_tempo, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_queue_tempo)
|
|
int snd_seq_queue_tempo_malloc(snd_seq_queue_tempo_t **ptr);
|
|
void snd_seq_queue_tempo_free(snd_seq_queue_tempo_t *ptr);
|
|
void snd_seq_queue_tempo_copy(snd_seq_queue_tempo_t *dst, const snd_seq_queue_tempo_t *src);
|
|
@@ -492,7 +483,7 @@ size_t snd_seq_queue_timer_sizeof(void);
|
|
size_t snd_seq_queue_timer_sizeof(void);
|
|
/** allocate a #snd_seq_queue_timer_t container on stack */
|
|
#define snd_seq_queue_timer_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_queue_timer, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_queue_timer)
|
|
int snd_seq_queue_timer_malloc(snd_seq_queue_timer_t **ptr);
|
|
void snd_seq_queue_timer_free(snd_seq_queue_timer_t *ptr);
|
|
void snd_seq_queue_timer_copy(snd_seq_queue_timer_t *dst, const snd_seq_queue_timer_t *src);
|
|
@@ -551,7 +542,7 @@ size_t snd_seq_remove_events_sizeof(void
|
|
size_t snd_seq_remove_events_sizeof(void);
|
|
/** allocate a #snd_seq_remove_events_t container on stack */
|
|
#define snd_seq_remove_events_alloca(ptr) \
|
|
- SND_ALLOCA(snd_seq_remove_events, ptr)
|
|
+ __snd_alloca(ptr, snd_seq_remove_events)
|
|
int snd_seq_remove_events_malloc(snd_seq_remove_events_t **ptr);
|
|
void snd_seq_remove_events_free(snd_seq_remove_events_t *ptr);
|
|
void snd_seq_remove_events_copy(snd_seq_remove_events_t *dst, const snd_seq_remove_events_t *src);
|
|
diff -r 9e2f117f24b9 include/seq_event.h
|
|
--- a/include/seq_event.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/seq_event.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -133,25 +133,6 @@ enum snd_seq_event_type {
|
|
/** Ports disconnected; event data type = #snd_seq_connect_t */
|
|
SND_SEQ_EVENT_PORT_UNSUBSCRIBED,
|
|
|
|
- /** Sample select; event data type = #snd_seq_ev_sample_control_t */
|
|
- SND_SEQ_EVENT_SAMPLE = 70,
|
|
- /** Sample cluster select; event data type = #snd_seq_ev_sample_control_t */
|
|
- SND_SEQ_EVENT_SAMPLE_CLUSTER,
|
|
- /** voice start */
|
|
- SND_SEQ_EVENT_SAMPLE_START,
|
|
- /** voice stop */
|
|
- SND_SEQ_EVENT_SAMPLE_STOP,
|
|
- /** playback frequency */
|
|
- SND_SEQ_EVENT_SAMPLE_FREQ,
|
|
- /** volume and balance */
|
|
- SND_SEQ_EVENT_SAMPLE_VOLUME,
|
|
- /** sample loop */
|
|
- SND_SEQ_EVENT_SAMPLE_LOOP,
|
|
- /** sample position */
|
|
- SND_SEQ_EVENT_SAMPLE_POSITION,
|
|
- /** private (hardware dependent) event */
|
|
- SND_SEQ_EVENT_SAMPLE_PRIVATE1,
|
|
-
|
|
/** user-defined event; event data type = any (fixed size) */
|
|
SND_SEQ_EVENT_USR0 = 90,
|
|
/** user-defined event; event data type = any (fixed size) */
|
|
@@ -172,45 +153,6 @@ enum snd_seq_event_type {
|
|
SND_SEQ_EVENT_USR8,
|
|
/** user-defined event; event data type = any (fixed size) */
|
|
SND_SEQ_EVENT_USR9,
|
|
-
|
|
- /** begin of instrument management */
|
|
- SND_SEQ_EVENT_INSTR_BEGIN = 100,
|
|
- /** end of instrument management */
|
|
- SND_SEQ_EVENT_INSTR_END,
|
|
- /** query instrument interface info */
|
|
- SND_SEQ_EVENT_INSTR_INFO,
|
|
- /** result of instrument interface info */
|
|
- SND_SEQ_EVENT_INSTR_INFO_RESULT,
|
|
- /** query instrument format info */
|
|
- SND_SEQ_EVENT_INSTR_FINFO,
|
|
- /** result of instrument format info */
|
|
- SND_SEQ_EVENT_INSTR_FINFO_RESULT,
|
|
- /** reset instrument instrument memory */
|
|
- SND_SEQ_EVENT_INSTR_RESET,
|
|
- /** get instrument interface status */
|
|
- SND_SEQ_EVENT_INSTR_STATUS,
|
|
- /** result of instrument interface status */
|
|
- SND_SEQ_EVENT_INSTR_STATUS_RESULT,
|
|
- /** put an instrument to port */
|
|
- SND_SEQ_EVENT_INSTR_PUT,
|
|
- /** get an instrument from port */
|
|
- SND_SEQ_EVENT_INSTR_GET,
|
|
- /** result of instrument query */
|
|
- SND_SEQ_EVENT_INSTR_GET_RESULT,
|
|
- /** free instrument(s) */
|
|
- SND_SEQ_EVENT_INSTR_FREE,
|
|
- /** get instrument list */
|
|
- SND_SEQ_EVENT_INSTR_LIST,
|
|
- /** result of instrument list */
|
|
- SND_SEQ_EVENT_INSTR_LIST_RESULT,
|
|
- /** set cluster parameters */
|
|
- SND_SEQ_EVENT_INSTR_CLUSTER,
|
|
- /** get cluster parameters */
|
|
- SND_SEQ_EVENT_INSTR_CLUSTER_GET,
|
|
- /** result of cluster parameters */
|
|
- SND_SEQ_EVENT_INSTR_CLUSTER_RESULT,
|
|
- /** instrument change */
|
|
- SND_SEQ_EVENT_INSTR_CHANGE,
|
|
|
|
/** system exclusive data (variable length); event data type = #snd_seq_ev_ext_t */
|
|
SND_SEQ_EVENT_SYSEX = 130,
|
|
@@ -317,79 +259,6 @@ typedef struct snd_seq_ev_ext {
|
|
void *ptr; /**< pointer to data (note: can be 64-bit) */
|
|
} __attribute__((packed)) snd_seq_ev_ext_t;
|
|
|
|
-/** Instrument cluster type */
|
|
-typedef unsigned int snd_seq_instr_cluster_t;
|
|
-
|
|
-/** Instrument type */
|
|
-typedef struct snd_seq_instr {
|
|
- snd_seq_instr_cluster_t cluster; /**< cluster id */
|
|
- unsigned int std; /**< instrument standard id; the upper byte means a private instrument (owner - client id) */
|
|
- unsigned short bank; /**< instrument bank id */
|
|
- unsigned short prg; /**< instrument program id */
|
|
-} snd_seq_instr_t;
|
|
-
|
|
-/** sample number */
|
|
-typedef struct snd_seq_ev_sample {
|
|
- unsigned int std; /**< sample standard id */
|
|
- unsigned short bank; /**< sample bank id */
|
|
- unsigned short prg; /**< sample program id */
|
|
-} snd_seq_ev_sample_t;
|
|
-
|
|
-/** sample cluster */
|
|
-typedef struct snd_seq_ev_cluster {
|
|
- snd_seq_instr_cluster_t cluster; /**< cluster id */
|
|
-} snd_seq_ev_cluster_t;
|
|
-
|
|
-/** sample position */
|
|
-typedef unsigned int snd_seq_position_t; /**< playback position (in samples) * 16 */
|
|
-
|
|
-/** sample stop mode */
|
|
-typedef enum snd_seq_stop_mode {
|
|
- SND_SEQ_SAMPLE_STOP_IMMEDIATELY = 0, /**< terminate playing immediately */
|
|
- SND_SEQ_SAMPLE_STOP_VENVELOPE = 1, /**< finish volume envelope */
|
|
- SND_SEQ_SAMPLE_STOP_LOOP = 2 /**< terminate loop and finish wave */
|
|
-} snd_seq_stop_mode_t;
|
|
-
|
|
-/** sample frequency */
|
|
-typedef int snd_seq_frequency_t; /**< playback frequency in HZ * 16 */
|
|
-
|
|
-/** sample volume control; if any value is set to -1 == do not change */
|
|
-typedef struct snd_seq_ev_volume {
|
|
- signed short volume; /**< range: 0-16383 */
|
|
- signed short lr; /**< left-right balance; range: 0-16383 */
|
|
- signed short fr; /**< front-rear balance; range: 0-16383 */
|
|
- signed short du; /**< down-up balance; range: 0-16383 */
|
|
-} snd_seq_ev_volume_t;
|
|
-
|
|
-/** simple loop redefinition */
|
|
-typedef struct snd_seq_ev_loop {
|
|
- unsigned int start; /**< loop start (in samples) * 16 */
|
|
- unsigned int end; /**< loop end (in samples) * 16 */
|
|
-} snd_seq_ev_loop_t;
|
|
-
|
|
-/** Sample control events */
|
|
-typedef struct snd_seq_ev_sample_control {
|
|
- unsigned char channel; /**< channel */
|
|
- unsigned char unused[3]; /**< reserved */
|
|
- union {
|
|
- snd_seq_ev_sample_t sample; /**< sample number */
|
|
- snd_seq_ev_cluster_t cluster; /**< cluster number */
|
|
- snd_seq_position_t position; /**< position */
|
|
- snd_seq_stop_mode_t stop_mode; /**< stop mode */
|
|
- snd_seq_frequency_t frequency; /**< frequency */
|
|
- snd_seq_ev_volume_t volume; /**< volume */
|
|
- snd_seq_ev_loop_t loop; /**< loop control */
|
|
- unsigned char raw8[8]; /**< raw 8-bit */
|
|
- } param; /**< control parameters */
|
|
-} snd_seq_ev_sample_control_t;
|
|
-
|
|
-
|
|
-
|
|
-/** INSTR_BEGIN event */
|
|
-typedef struct snd_seq_ev_instr_begin {
|
|
- int timeout; /**< zero = forever, otherwise timeout in ms */
|
|
-} snd_seq_ev_instr_begin_t;
|
|
-
|
|
/** Result events */
|
|
typedef struct snd_seq_result {
|
|
int event; /**< processed event type */
|
|
@@ -440,8 +309,6 @@ typedef struct snd_seq_event {
|
|
snd_seq_addr_t addr; /**< address */
|
|
snd_seq_connect_t connect; /**< connect information */
|
|
snd_seq_result_t result; /**< operation result code */
|
|
- snd_seq_ev_instr_begin_t instr_begin; /**< instrument */
|
|
- snd_seq_ev_sample_control_t sample; /**< sample control */
|
|
} data; /**< event data... */
|
|
} snd_seq_event_t;
|
|
|
|
diff -r 9e2f117f24b9 include/sound/Makefile.am
|
|
--- a/include/sound/Makefile.am Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/sound/Makefile.am Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -1,7 +1,6 @@ alsasoundincludedir = ${includedir}/alsa
|
|
alsasoundincludedir = ${includedir}/alsa/sound
|
|
|
|
-alsasoundinclude_HEADERS = ainstr_fm.h ainstr_gf1.h ainstr_simple.h ainstr_iw.h \
|
|
- asound_fm.h hdsp.h sb16_csp.h sscape_ioctl.h emu10k1.h \
|
|
+alsasoundinclude_HEADERS = asound_fm.h hdsp.h sb16_csp.h sscape_ioctl.h emu10k1.h \
|
|
type_compat.h
|
|
|
|
noinst_HEADERS = asound.h asoundef.h asequencer.h
|
|
diff -r 9e2f117f24b9 include/sound/ainstr_fm.h
|
|
--- a/include/sound/ainstr_fm.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
@@ -1,129 +0,0 @@
|
|
-/*
|
|
- * Advanced Linux Sound Architecture
|
|
- *
|
|
- * FM (OPL2/3) Instrument Format
|
|
- * Copyright (c) 2000 Uros Bizjak <uros@kss-loka.si>
|
|
- *
|
|
- *
|
|
- * 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
|
|
- *
|
|
- */
|
|
-
|
|
-#ifndef __SOUND_AINSTR_FM_H
|
|
-#define __SOUND_AINSTR_FM_H
|
|
-
|
|
-#include "type_compat.h"
|
|
-
|
|
-/*
|
|
- * share types (share ID 1)
|
|
- */
|
|
-
|
|
-#define FM_SHARE_FILE 0
|
|
-
|
|
-/*
|
|
- * FM operator
|
|
- */
|
|
-
|
|
-typedef struct fm_operator {
|
|
- unsigned char am_vib;
|
|
- unsigned char ksl_level;
|
|
- unsigned char attack_decay;
|
|
- unsigned char sustain_release;
|
|
- unsigned char wave_select;
|
|
-} fm_operator_t;
|
|
-
|
|
-/*
|
|
- * Instrument
|
|
- */
|
|
-
|
|
-#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
|
|
-#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
|
|
-
|
|
-typedef struct {
|
|
- unsigned int share_id[4]; /* share id - zero = no sharing */
|
|
- unsigned char type; /* instrument type */
|
|
-
|
|
- fm_operator_t op[4];
|
|
- unsigned char feedback_connection[2];
|
|
-
|
|
- unsigned char echo_delay;
|
|
- unsigned char echo_atten;
|
|
- unsigned char chorus_spread;
|
|
- unsigned char trnsps;
|
|
- unsigned char fix_dur;
|
|
- unsigned char modes;
|
|
- unsigned char fix_key;
|
|
-} fm_instrument_t;
|
|
-
|
|
-/*
|
|
- *
|
|
- * Kernel <-> user space
|
|
- * Hardware (CPU) independent section
|
|
- *
|
|
- * * = zero or more
|
|
- * + = one or more
|
|
- *
|
|
- * fm_xinstrument FM_STRU_INSTR
|
|
- *
|
|
- */
|
|
-
|
|
-#define FM_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
|
|
-
|
|
-/*
|
|
- * FM operator
|
|
- */
|
|
-
|
|
-typedef struct fm_xoperator {
|
|
- __u8 am_vib;
|
|
- __u8 ksl_level;
|
|
- __u8 attack_decay;
|
|
- __u8 sustain_release;
|
|
- __u8 wave_select;
|
|
-} fm_xoperator_t;
|
|
-
|
|
-/*
|
|
- * Instrument
|
|
- */
|
|
-
|
|
-typedef struct fm_xinstrument {
|
|
- __u32 stype; /* structure type */
|
|
-
|
|
- __u32 share_id[4]; /* share id - zero = no sharing */
|
|
- __u8 type; /* instrument type */
|
|
-
|
|
- fm_xoperator_t op[4]; /* fm operators */
|
|
- __u8 feedback_connection[2];
|
|
-
|
|
- __u8 echo_delay;
|
|
- __u8 echo_atten;
|
|
- __u8 chorus_spread;
|
|
- __u8 trnsps;
|
|
- __u8 fix_dur;
|
|
- __u8 modes;
|
|
- __u8 fix_key;
|
|
-} fm_xinstrument_t;
|
|
-
|
|
-#ifdef __KERNEL__
|
|
-
|
|
-#include "seq_instr.h"
|
|
-
|
|
-extern char *snd_seq_fm_id;
|
|
-
|
|
-int snd_seq_fm_init(snd_seq_kinstr_ops_t * ops,
|
|
- snd_seq_kinstr_ops_t * next);
|
|
-
|
|
-#endif
|
|
-
|
|
-#endif /* __SOUND_AINSTR_FM_H */
|
|
diff -r 9e2f117f24b9 include/sound/ainstr_gf1.h
|
|
--- a/include/sound/ainstr_gf1.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
@@ -1,224 +0,0 @@
|
|
-/*
|
|
- * Advanced Linux Sound Architecture
|
|
- *
|
|
- * GF1 (GUS) Patch Instrument Format
|
|
- * Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.cz>
|
|
- *
|
|
- *
|
|
- * 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
|
|
- *
|
|
- */
|
|
-
|
|
-#ifndef __SOUND_AINSTR_GF1_H
|
|
-#define __SOUND_AINSTR_GF1_H
|
|
-
|
|
-#include "type_compat.h"
|
|
-
|
|
-/*
|
|
- * share types (share ID 1)
|
|
- */
|
|
-
|
|
-#define GF1_SHARE_FILE 0
|
|
-
|
|
-/*
|
|
- * wave formats
|
|
- */
|
|
-
|
|
-#define GF1_WAVE_16BIT 0x0001 /* 16-bit wave */
|
|
-#define GF1_WAVE_UNSIGNED 0x0002 /* unsigned wave */
|
|
-#define GF1_WAVE_INVERT 0x0002 /* same as unsigned wave */
|
|
-#define GF1_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
|
|
-#define GF1_WAVE_LOOP 0x0008 /* loop mode */
|
|
-#define GF1_WAVE_BIDIR 0x0010 /* bidirectional mode */
|
|
-#define GF1_WAVE_STEREO 0x0100 /* stereo mode */
|
|
-#define GF1_WAVE_ULAW 0x0200 /* uLaw compression mode */
|
|
-
|
|
-/*
|
|
- * Wavetable definitions
|
|
- */
|
|
-
|
|
-typedef struct gf1_wave {
|
|
- unsigned int share_id[4]; /* share id - zero = no sharing */
|
|
- unsigned int format; /* wave format */
|
|
-
|
|
- struct {
|
|
- unsigned int number; /* some other ID for this instrument */
|
|
- unsigned int memory; /* begin of waveform in onboard memory */
|
|
- unsigned char *ptr; /* pointer to waveform in system memory */
|
|
- } address;
|
|
-
|
|
- unsigned int size; /* size of waveform in samples */
|
|
- unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned short loop_repeat; /* loop repeat - 0 = forever */
|
|
-
|
|
- unsigned char flags; /* GF1 patch flags */
|
|
- unsigned char pad;
|
|
- unsigned int sample_rate; /* sample rate in Hz */
|
|
- unsigned int low_frequency; /* low frequency range */
|
|
- unsigned int high_frequency; /* high frequency range */
|
|
- unsigned int root_frequency; /* root frequency range */
|
|
- signed short tune;
|
|
- unsigned char balance;
|
|
- unsigned char envelope_rate[6];
|
|
- unsigned char envelope_offset[6];
|
|
- unsigned char tremolo_sweep;
|
|
- unsigned char tremolo_rate;
|
|
- unsigned char tremolo_depth;
|
|
- unsigned char vibrato_sweep;
|
|
- unsigned char vibrato_rate;
|
|
- unsigned char vibrato_depth;
|
|
- unsigned short scale_frequency;
|
|
- unsigned short scale_factor; /* 0-2048 or 0-2 */
|
|
-
|
|
- struct gf1_wave *next;
|
|
-} gf1_wave_t;
|
|
-
|
|
-/*
|
|
- * Instrument
|
|
- */
|
|
-
|
|
-#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
|
|
-#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
|
|
-#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
|
|
-
|
|
-#define IWFFFF_EFFECT_NONE 0
|
|
-#define IWFFFF_EFFECT_REVERB 1
|
|
-#define IWFFFF_EFFECT_CHORUS 2
|
|
-#define IWFFFF_EFFECT_ECHO 3
|
|
-
|
|
-typedef struct {
|
|
- unsigned short exclusion;
|
|
- unsigned short exclusion_group; /* 0 - none, 1-65535 */
|
|
-
|
|
- unsigned char effect1; /* effect 1 */
|
|
- unsigned char effect1_depth; /* 0-127 */
|
|
- unsigned char effect2; /* effect 2 */
|
|
- unsigned char effect2_depth; /* 0-127 */
|
|
-
|
|
- gf1_wave_t *wave; /* first waveform */
|
|
-} gf1_instrument_t;
|
|
-
|
|
-/*
|
|
- *
|
|
- * Kernel <-> user space
|
|
- * Hardware (CPU) independent section
|
|
- *
|
|
- * * = zero or more
|
|
- * + = one or more
|
|
- *
|
|
- * gf1_xinstrument IWFFFF_STRU_INSTR
|
|
- * +gf1_xwave IWFFFF_STRU_WAVE
|
|
- *
|
|
- */
|
|
-
|
|
-#define GF1_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
|
|
-#define GF1_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
|
|
-
|
|
-/*
|
|
- * Wavetable definitions
|
|
- */
|
|
-
|
|
-typedef struct gf1_xwave {
|
|
- __u32 stype; /* structure type */
|
|
-
|
|
- __u32 share_id[4]; /* share id - zero = no sharing */
|
|
- __u32 format; /* wave format */
|
|
-
|
|
- __u32 size; /* size of waveform in samples */
|
|
- __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u16 loop_repeat; /* loop repeat - 0 = forever */
|
|
-
|
|
- __u8 flags; /* GF1 patch flags */
|
|
- __u8 pad;
|
|
- __u32 sample_rate; /* sample rate in Hz */
|
|
- __u32 low_frequency; /* low frequency range */
|
|
- __u32 high_frequency; /* high frequency range */
|
|
- __u32 root_frequency; /* root frequency range */
|
|
- __s16 tune;
|
|
- __u8 balance;
|
|
- __u8 envelope_rate[6];
|
|
- __u8 envelope_offset[6];
|
|
- __u8 tremolo_sweep;
|
|
- __u8 tremolo_rate;
|
|
- __u8 tremolo_depth;
|
|
- __u8 vibrato_sweep;
|
|
- __u8 vibrato_rate;
|
|
- __u8 vibrato_depth;
|
|
- __u16 scale_frequency;
|
|
- __u16 scale_factor; /* 0-2048 or 0-2 */
|
|
-} gf1_xwave_t;
|
|
-
|
|
-/*
|
|
- * Instrument
|
|
- */
|
|
-
|
|
-typedef struct gf1_xinstrument {
|
|
- __u32 stype;
|
|
-
|
|
- __u16 exclusion;
|
|
- __u16 exclusion_group; /* 0 - none, 1-65535 */
|
|
-
|
|
- __u8 effect1; /* effect 1 */
|
|
- __u8 effect1_depth; /* 0-127 */
|
|
- __u8 effect2; /* effect 2 */
|
|
- __u8 effect2_depth; /* 0-127 */
|
|
-} gf1_xinstrument_t;
|
|
-
|
|
-/*
|
|
- * Instrument info
|
|
- */
|
|
-
|
|
-#define GF1_INFO_ENVELOPE (1<<0)
|
|
-#define GF1_INFO_TREMOLO (1<<1)
|
|
-#define GF1_INFO_VIBRATO (1<<2)
|
|
-
|
|
-typedef struct gf1_info {
|
|
- unsigned char flags; /* supported wave flags */
|
|
- unsigned char pad[3];
|
|
- unsigned int features; /* supported features */
|
|
- unsigned int max8_len; /* maximum 8-bit wave length */
|
|
- unsigned int max16_len; /* maximum 16-bit wave length */
|
|
-} gf1_info_t;
|
|
-
|
|
-#ifdef __KERNEL__
|
|
-
|
|
-#include "seq_instr.h"
|
|
-
|
|
-extern char *snd_seq_gf1_id;
|
|
-
|
|
-typedef struct {
|
|
- void *private_data;
|
|
- int (*info)(void *private_data, gf1_info_t *info);
|
|
- int (*put_sample)(void *private_data, gf1_wave_t *wave,
|
|
- char *data, long len, int atomic);
|
|
- int (*get_sample)(void *private_data, gf1_wave_t *wave,
|
|
- char *data, long len, int atomic);
|
|
- int (*remove_sample)(void *private_data, gf1_wave_t *wave,
|
|
- int atomic);
|
|
- void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
|
|
- snd_seq_kinstr_ops_t kops;
|
|
-} snd_gf1_ops_t;
|
|
-
|
|
-int snd_seq_gf1_init(snd_gf1_ops_t *ops,
|
|
- void *private_data,
|
|
- snd_seq_kinstr_ops_t *next);
|
|
-
|
|
-#endif
|
|
-
|
|
-#endif /* __SOUND_AINSTR_GF1_H */
|
|
diff -r 9e2f117f24b9 include/sound/ainstr_iw.h
|
|
--- a/include/sound/ainstr_iw.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
@@ -1,372 +0,0 @@
|
|
-/*
|
|
- * Advanced Linux Sound Architecture
|
|
- *
|
|
- * InterWave FFFF Instrument Format
|
|
- * Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.cz>
|
|
- *
|
|
- *
|
|
- * 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
|
|
- *
|
|
- */
|
|
-
|
|
-#ifndef __SOUND_AINSTR_IW_H
|
|
-#define __SOUND_AINSTR_IW_H
|
|
-
|
|
-#include "type_compat.h"
|
|
-
|
|
-/*
|
|
- * share types (share ID 1)
|
|
- */
|
|
-
|
|
-#define IWFFFF_SHARE_FILE 0
|
|
-
|
|
-/*
|
|
- * wave formats
|
|
- */
|
|
-
|
|
-#define IWFFFF_WAVE_16BIT 0x0001 /* 16-bit wave */
|
|
-#define IWFFFF_WAVE_UNSIGNED 0x0002 /* unsigned wave */
|
|
-#define IWFFFF_WAVE_INVERT 0x0002 /* same as unsigned wave */
|
|
-#define IWFFFF_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
|
|
-#define IWFFFF_WAVE_LOOP 0x0008 /* loop mode */
|
|
-#define IWFFFF_WAVE_BIDIR 0x0010 /* bidirectional mode */
|
|
-#define IWFFFF_WAVE_ULAW 0x0020 /* uLaw compressed wave */
|
|
-#define IWFFFF_WAVE_RAM 0x0040 /* wave is _preloaded_ in RAM (it is used for ROM simulation) */
|
|
-#define IWFFFF_WAVE_ROM 0x0080 /* wave is in ROM */
|
|
-#define IWFFFF_WAVE_STEREO 0x0100 /* wave is stereo */
|
|
-
|
|
-/*
|
|
- * Wavetable definitions
|
|
- */
|
|
-
|
|
-typedef struct iwffff_wave {
|
|
- unsigned int share_id[4]; /* share id - zero = no sharing */
|
|
- unsigned int format; /* wave format */
|
|
-
|
|
- struct {
|
|
- unsigned int number; /* some other ID for this wave */
|
|
- unsigned int memory; /* begin of waveform in onboard memory */
|
|
- unsigned char *ptr; /* pointer to waveform in system memory */
|
|
- } address;
|
|
-
|
|
- unsigned int size; /* size of waveform in samples */
|
|
- unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned int loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned int loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned short loop_repeat; /* loop repeat - 0 = forever */
|
|
- unsigned int sample_ratio; /* sample ratio (44100 * 1024 / rate) */
|
|
- unsigned char attenuation; /* 0 - 127 (no corresponding midi controller) */
|
|
- unsigned char low_note; /* lower frequency range for this waveform */
|
|
- unsigned char high_note; /* higher frequency range for this waveform */
|
|
- unsigned char pad;
|
|
-
|
|
- struct iwffff_wave *next;
|
|
-} iwffff_wave_t;
|
|
-
|
|
-/*
|
|
- * Layer
|
|
- */
|
|
-
|
|
-#define IWFFFF_LFO_SHAPE_TRIANGLE 0
|
|
-#define IWFFFF_LFO_SHAPE_POSTRIANGLE 1
|
|
-
|
|
-typedef struct iwffff_lfo {
|
|
- unsigned short freq; /* (0-2047) 0.01Hz - 21.5Hz */
|
|
- signed short depth; /* volume +- (0-255) 0.48675dB/step */
|
|
- signed short sweep; /* 0 - 950 deciseconds */
|
|
- unsigned char shape; /* see to IWFFFF_LFO_SHAPE_XXXX */
|
|
- unsigned char delay; /* 0 - 255 deciseconds */
|
|
-} iwffff_lfo_t;
|
|
-
|
|
-#define IWFFFF_ENV_FLAG_RETRIGGER 0x0001 /* flag - retrigger */
|
|
-
|
|
-#define IWFFFF_ENV_MODE_ONE_SHOT 0x0001 /* mode - one shot */
|
|
-#define IWFFFF_ENV_MODE_SUSTAIN 0x0002 /* mode - sustain */
|
|
-#define IWFFFF_ENV_MODE_NO_SUSTAIN 0x0003 /* mode - no sustain */
|
|
-
|
|
-#define IWFFFF_ENV_INDEX_VELOCITY 0x0001 /* index - velocity */
|
|
-#define IWFFFF_ENV_INDEX_FREQUENCY 0x0002 /* index - frequency */
|
|
-
|
|
-typedef struct iwffff_env_point {
|
|
- unsigned short offset;
|
|
- unsigned short rate;
|
|
-} iwffff_env_point_t;
|
|
-
|
|
-typedef struct iwffff_env_record {
|
|
- unsigned short nattack;
|
|
- unsigned short nrelease;
|
|
- unsigned short sustain_offset;
|
|
- unsigned short sustain_rate;
|
|
- unsigned short release_rate;
|
|
- unsigned char hirange;
|
|
- unsigned char pad;
|
|
- struct iwffff_env_record *next;
|
|
- /* points are stored here */
|
|
- /* count of points = nattack + nrelease */
|
|
-} iwffff_env_record_t;
|
|
-
|
|
-typedef struct iwffff_env {
|
|
- unsigned char flags;
|
|
- unsigned char mode;
|
|
- unsigned char index;
|
|
- unsigned char pad;
|
|
- struct iwffff_env_record *record;
|
|
-} iwffff_env_t;
|
|
-
|
|
-#define IWFFFF_LAYER_FLAG_RETRIGGER 0x0001 /* retrigger */
|
|
-
|
|
-#define IWFFFF_LAYER_VELOCITY_TIME 0x0000 /* velocity mode = time */
|
|
-#define IWFFFF_LAYER_VELOCITY_RATE 0x0001 /* velocity mode = rate */
|
|
-
|
|
-#define IWFFFF_LAYER_EVENT_KUP 0x0000 /* layer event - key up */
|
|
-#define IWFFFF_LAYER_EVENT_KDOWN 0x0001 /* layer event - key down */
|
|
-#define IWFFFF_LAYER_EVENT_RETRIG 0x0002 /* layer event - retrigger */
|
|
-#define IWFFFF_LAYER_EVENT_LEGATO 0x0003 /* layer event - legato */
|
|
-
|
|
-typedef struct iwffff_layer {
|
|
- unsigned char flags;
|
|
- unsigned char velocity_mode;
|
|
- unsigned char layer_event;
|
|
- unsigned char low_range; /* range for layer based */
|
|
- unsigned char high_range; /* on either velocity or frequency */
|
|
- unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
|
|
- unsigned char pan_freq_scale; /* position based on frequency (0-127) */
|
|
- unsigned char attenuation; /* 0-127 (no corresponding midi controller) */
|
|
- iwffff_lfo_t tremolo; /* tremolo effect */
|
|
- iwffff_lfo_t vibrato; /* vibrato effect */
|
|
- unsigned short freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
|
|
- unsigned char freq_center; /* center for keyboard frequency scaling */
|
|
- unsigned char pad;
|
|
- iwffff_env_t penv; /* pitch envelope */
|
|
- iwffff_env_t venv; /* volume envelope */
|
|
-
|
|
- iwffff_wave_t *wave;
|
|
- struct iwffff_layer *next;
|
|
-} iwffff_layer_t;
|
|
-
|
|
-/*
|
|
- * Instrument
|
|
- */
|
|
-
|
|
-#define IWFFFF_EXCLUDE_NONE 0x0000 /* exclusion mode - none */
|
|
-#define IWFFFF_EXCLUDE_SINGLE 0x0001 /* exclude single - single note from the instrument group */
|
|
-#define IWFFFF_EXCLUDE_MULTIPLE 0x0002 /* exclude multiple - stop only same note from this instrument */
|
|
-
|
|
-#define IWFFFF_LAYER_NONE 0x0000 /* not layered */
|
|
-#define IWFFFF_LAYER_ON 0x0001 /* layered */
|
|
-#define IWFFFF_LAYER_VELOCITY 0x0002 /* layered by velocity */
|
|
-#define IWFFFF_LAYER_FREQUENCY 0x0003 /* layered by frequency */
|
|
-
|
|
-#define IWFFFF_EFFECT_NONE 0
|
|
-#define IWFFFF_EFFECT_REVERB 1
|
|
-#define IWFFFF_EFFECT_CHORUS 2
|
|
-#define IWFFFF_EFFECT_ECHO 3
|
|
-
|
|
-typedef struct {
|
|
- unsigned short exclusion;
|
|
- unsigned short layer_type;
|
|
- unsigned short exclusion_group; /* 0 - none, 1-65535 */
|
|
-
|
|
- unsigned char effect1; /* effect 1 */
|
|
- unsigned char effect1_depth; /* 0-127 */
|
|
- unsigned char effect2; /* effect 2 */
|
|
- unsigned char effect2_depth; /* 0-127 */
|
|
-
|
|
- iwffff_layer_t *layer; /* first layer */
|
|
-} iwffff_instrument_t;
|
|
-
|
|
-/*
|
|
- *
|
|
- * Kernel <-> user space
|
|
- * Hardware (CPU) independent section
|
|
- *
|
|
- * * = zero or more
|
|
- * + = one or more
|
|
- *
|
|
- * iwffff_xinstrument IWFFFF_STRU_INSTR
|
|
- * +iwffff_xlayer IWFFFF_STRU_LAYER
|
|
- * *iwffff_xenv_record IWFFFF_STRU_ENV_RECT (tremolo)
|
|
- * *iwffff_xenv_record IWFFFF_STRU_EVN_RECT (vibrato)
|
|
- * +iwffff_xwave IWFFFF_STRU_WAVE
|
|
- *
|
|
- */
|
|
-
|
|
-#define IWFFFF_STRU_WAVE __cpu_to_be32(('W'<<24)|('A'<<16)|('V'<<8)|'E')
|
|
-#define IWFFFF_STRU_ENV_RECP __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'P')
|
|
-#define IWFFFF_STRU_ENV_RECV __cpu_to_be32(('E'<<24)|('N'<<16)|('R'<<8)|'V')
|
|
-#define IWFFFF_STRU_LAYER __cpu_to_be32(('L'<<24)|('A'<<16)|('Y'<<8)|'R')
|
|
-#define IWFFFF_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
|
|
-
|
|
-/*
|
|
- * Wavetable definitions
|
|
- */
|
|
-
|
|
-typedef struct iwffff_xwave {
|
|
- __u32 stype; /* structure type */
|
|
-
|
|
- __u32 share_id[4]; /* share id - zero = no sharing */
|
|
-
|
|
- __u32 format; /* wave format */
|
|
- __u32 offset; /* offset to ROM (address) */
|
|
-
|
|
- __u32 size; /* size of waveform in samples */
|
|
- __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u16 loop_repeat; /* loop repeat - 0 = forever */
|
|
- __u32 sample_ratio; /* sample ratio (44100 * 1024 / rate) */
|
|
- __u8 attenuation; /* 0 - 127 (no corresponding midi controller) */
|
|
- __u8 low_note; /* lower frequency range for this waveform */
|
|
- __u8 high_note; /* higher frequency range for this waveform */
|
|
- __u8 pad;
|
|
-} iwffff_xwave_t;
|
|
-
|
|
-/*
|
|
- * Layer
|
|
- */
|
|
-
|
|
-typedef struct iwffff_xlfo {
|
|
- __u16 freq; /* (0-2047) 0.01Hz - 21.5Hz */
|
|
- __s16 depth; /* volume +- (0-255) 0.48675dB/step */
|
|
- __s16 sweep; /* 0 - 950 deciseconds */
|
|
- __u8 shape; /* see to ULTRA_IW_LFO_SHAPE_XXXX */
|
|
- __u8 delay; /* 0 - 255 deciseconds */
|
|
-} iwffff_xlfo_t;
|
|
-
|
|
-typedef struct iwffff_xenv_point {
|
|
- __u16 offset;
|
|
- __u16 rate;
|
|
-} iwffff_xenv_point_t;
|
|
-
|
|
-typedef struct iwffff_xenv_record {
|
|
- __u32 stype;
|
|
- __u16 nattack;
|
|
- __u16 nrelease;
|
|
- __u16 sustain_offset;
|
|
- __u16 sustain_rate;
|
|
- __u16 release_rate;
|
|
- __u8 hirange;
|
|
- __u8 pad;
|
|
- /* points are stored here.. */
|
|
- /* count of points = nattack + nrelease */
|
|
-} iwffff_xenv_record_t;
|
|
-
|
|
-typedef struct iwffff_xenv {
|
|
- __u8 flags;
|
|
- __u8 mode;
|
|
- __u8 index;
|
|
- __u8 pad;
|
|
-} iwffff_xenv_t;
|
|
-
|
|
-typedef struct iwffff_xlayer {
|
|
- __u32 stype;
|
|
- __u8 flags;
|
|
- __u8 velocity_mode;
|
|
- __u8 layer_event;
|
|
- __u8 low_range; /* range for layer based */
|
|
- __u8 high_range; /* on either velocity or frequency */
|
|
- __u8 pan; /* pan offset from CC1 (0 left - 127 right) */
|
|
- __u8 pan_freq_scale; /* position based on frequency (0-127) */
|
|
- __u8 attenuation; /* 0-127 (no corresponding midi controller) */
|
|
- iwffff_xlfo_t tremolo; /* tremolo effect */
|
|
- iwffff_xlfo_t vibrato; /* vibrato effect */
|
|
- __u16 freq_scale; /* 0-2048, 1024 is equal to semitone scaling */
|
|
- __u8 freq_center; /* center for keyboard frequency scaling */
|
|
- __u8 pad;
|
|
- iwffff_xenv_t penv; /* pitch envelope */
|
|
- iwffff_xenv_t venv; /* volume envelope */
|
|
-} iwffff_xlayer_t;
|
|
-
|
|
-/*
|
|
- * Instrument
|
|
- */
|
|
-
|
|
-typedef struct iwffff_xinstrument {
|
|
- __u32 stype;
|
|
-
|
|
- __u16 exclusion;
|
|
- __u16 layer_type;
|
|
- __u16 exclusion_group; /* 0 - none, 1-65535 */
|
|
-
|
|
- __u8 effect1; /* effect 1 */
|
|
- __u8 effect1_depth; /* 0-127 */
|
|
- __u8 effect2; /* effect 2 */
|
|
- __u8 effect2_depth; /* 0-127 */
|
|
-} iwffff_xinstrument_t;
|
|
-
|
|
-/*
|
|
- * ROM support
|
|
- * InterWave ROMs are Little-Endian (x86)
|
|
- */
|
|
-
|
|
-#define IWFFFF_ROM_HDR_SIZE 512
|
|
-
|
|
-typedef struct {
|
|
- __u8 iwave[8];
|
|
- __u8 revision;
|
|
- __u8 series_number;
|
|
- __u8 series_name[16];
|
|
- __u8 date[10];
|
|
- __u16 vendor_revision_major;
|
|
- __u16 vendor_revision_minor;
|
|
- __u32 rom_size;
|
|
- __u8 copyright[128];
|
|
- __u8 vendor_name[64];
|
|
- __u8 description[128];
|
|
-} iwffff_rom_header_t;
|
|
-
|
|
-/*
|
|
- * Instrument info
|
|
- */
|
|
-
|
|
-#define IWFFFF_INFO_LFO_VIBRATO (1<<0)
|
|
-#define IWFFFF_INFO_LFO_VIBRATO_SHAPE (1<<1)
|
|
-#define IWFFFF_INFO_LFO_TREMOLO (1<<2)
|
|
-#define IWFFFF_INFO_LFO_TREMOLO_SHAPE (1<<3)
|
|
-
|
|
-typedef struct iwffff_info {
|
|
- unsigned int format; /* supported format bits */
|
|
- unsigned int effects; /* supported effects (1 << IWFFFF_EFFECT*) */
|
|
- unsigned int lfos; /* LFO effects */
|
|
- unsigned int max8_len; /* maximum 8-bit wave length */
|
|
- unsigned int max16_len; /* maximum 16-bit wave length */
|
|
-} iwffff_info_t;
|
|
-
|
|
-#ifdef __KERNEL__
|
|
-
|
|
-#include "seq_instr.h"
|
|
-
|
|
-extern char *snd_seq_iwffff_id;
|
|
-
|
|
-typedef struct {
|
|
- void *private_data;
|
|
- int (*info)(void *private_data, iwffff_info_t *info);
|
|
- int (*put_sample)(void *private_data, iwffff_wave_t *wave,
|
|
- char *data, long len, int atomic);
|
|
- int (*get_sample)(void *private_data, iwffff_wave_t *wave,
|
|
- char *data, long len, int atomic);
|
|
- int (*remove_sample)(void *private_data, iwffff_wave_t *wave,
|
|
- int atomic);
|
|
- void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
|
|
- snd_seq_kinstr_ops_t kops;
|
|
-} snd_iwffff_ops_t;
|
|
-
|
|
-int snd_seq_iwffff_init(snd_iwffff_ops_t *ops,
|
|
- void *private_data,
|
|
- snd_seq_kinstr_ops_t *next);
|
|
-
|
|
-#endif
|
|
-
|
|
-#endif /* __SOUND_AINSTR_IW_H */
|
|
diff -r 9e2f117f24b9 include/sound/ainstr_simple.h
|
|
--- a/include/sound/ainstr_simple.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
@@ -1,155 +0,0 @@
|
|
-/*
|
|
- * Advanced Linux Sound Architecture
|
|
- *
|
|
- * Simple (MOD player) Instrument Format
|
|
- * Copyright (c) 1994-99 by Jaroslav Kysela <perex@perex.cz>
|
|
- *
|
|
- *
|
|
- * 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
|
|
- *
|
|
- */
|
|
-
|
|
-#ifndef __SOUND_AINSTR_SIMPLE_H
|
|
-#define __SOUND_AINSTR_SIMPLE_H
|
|
-
|
|
-#include "type_compat.h"
|
|
-
|
|
-/*
|
|
- * share types (share ID 1)
|
|
- */
|
|
-
|
|
-#define SIMPLE_SHARE_FILE 0
|
|
-
|
|
-/*
|
|
- * wave formats
|
|
- */
|
|
-
|
|
-#define SIMPLE_WAVE_16BIT 0x0001 /* 16-bit wave */
|
|
-#define SIMPLE_WAVE_UNSIGNED 0x0002 /* unsigned wave */
|
|
-#define SIMPLE_WAVE_INVERT 0x0002 /* same as unsigned wave */
|
|
-#define SIMPLE_WAVE_BACKWARD 0x0004 /* backward mode (maybe used for reverb or ping-ping loop) */
|
|
-#define SIMPLE_WAVE_LOOP 0x0008 /* loop mode */
|
|
-#define SIMPLE_WAVE_BIDIR 0x0010 /* bidirectional mode */
|
|
-#define SIMPLE_WAVE_STEREO 0x0100 /* stereo wave */
|
|
-#define SIMPLE_WAVE_ULAW 0x0200 /* uLaw compression mode */
|
|
-
|
|
-/*
|
|
- * instrument effects
|
|
- */
|
|
-
|
|
-#define SIMPLE_EFFECT_NONE 0
|
|
-#define SIMPLE_EFFECT_REVERB 1
|
|
-#define SIMPLE_EFFECT_CHORUS 2
|
|
-#define SIMPLE_EFFECT_ECHO 3
|
|
-
|
|
-/*
|
|
- * instrument info
|
|
- */
|
|
-
|
|
-typedef struct simple_instrument_info {
|
|
- unsigned int format; /* supported format bits */
|
|
- unsigned int effects; /* supported effects (1 << SIMPLE_EFFECT_*) */
|
|
- unsigned int max8_len; /* maximum 8-bit wave length */
|
|
- unsigned int max16_len; /* maximum 16-bit wave length */
|
|
-} simple_instrument_info_t;
|
|
-
|
|
-/*
|
|
- * Instrument
|
|
- */
|
|
-
|
|
-typedef struct {
|
|
- unsigned int share_id[4]; /* share id - zero = no sharing */
|
|
- unsigned int format; /* wave format */
|
|
-
|
|
- struct {
|
|
- unsigned int number; /* some other ID for this instrument */
|
|
- unsigned int memory; /* begin of waveform in onboard memory */
|
|
- unsigned char *ptr; /* pointer to waveform in system memory */
|
|
- } address;
|
|
-
|
|
- unsigned int size; /* size of waveform in samples */
|
|
- unsigned int start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned int loop_start; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned int loop_end; /* loop end offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- unsigned short loop_repeat; /* loop repeat - 0 = forever */
|
|
-
|
|
- unsigned char effect1; /* effect 1 */
|
|
- unsigned char effect1_depth; /* 0-127 */
|
|
- unsigned char effect2; /* effect 2 */
|
|
- unsigned char effect2_depth; /* 0-127 */
|
|
-} simple_instrument_t;
|
|
-
|
|
-/*
|
|
- *
|
|
- * Kernel <-> user space
|
|
- * Hardware (CPU) independent section
|
|
- *
|
|
- * * = zero or more
|
|
- * + = one or more
|
|
- *
|
|
- * simple_xinstrument SIMPLE_STRU_INSTR
|
|
- *
|
|
- */
|
|
-
|
|
-#define SIMPLE_STRU_INSTR __cpu_to_be32(('I'<<24)|('N'<<16)|('S'<<8)|'T')
|
|
-
|
|
-/*
|
|
- * Instrument
|
|
- */
|
|
-
|
|
-typedef struct simple_xinstrument {
|
|
- __u32 stype;
|
|
-
|
|
- __u32 share_id[4]; /* share id - zero = no sharing */
|
|
- __u32 format; /* wave format */
|
|
-
|
|
- __u32 size; /* size of waveform in samples */
|
|
- __u32 start; /* start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
|
|
- __u16 loop_repeat; /* loop repeat - 0 = forever */
|
|
-
|
|
- __u8 effect1; /* effect 1 */
|
|
- __u8 effect1_depth; /* 0-127 */
|
|
- __u8 effect2; /* effect 2 */
|
|
- __u8 effect2_depth; /* 0-127 */
|
|
-} simple_xinstrument_t;
|
|
-
|
|
-#ifdef __KERNEL__
|
|
-
|
|
-#include "seq_instr.h"
|
|
-
|
|
-extern char *snd_seq_simple_id;
|
|
-
|
|
-typedef struct {
|
|
- void *private_data;
|
|
- int (*info)(void *private_data, simple_instrument_info_t *info);
|
|
- int (*put_sample)(void *private_data, simple_instrument_t *instr,
|
|
- char *data, long len, int atomic);
|
|
- int (*get_sample)(void *private_data, simple_instrument_t *instr,
|
|
- char *data, long len, int atomic);
|
|
- int (*remove_sample)(void *private_data, simple_instrument_t *instr,
|
|
- int atomic);
|
|
- void (*notify)(void *private_data, snd_seq_kinstr_t *instr, int what);
|
|
- snd_seq_kinstr_ops_t kops;
|
|
-} snd_simple_ops_t;
|
|
-
|
|
-int snd_seq_simple_init(snd_simple_ops_t *ops,
|
|
- void *private_data,
|
|
- snd_seq_kinstr_ops_t *next);
|
|
-
|
|
-#endif
|
|
-
|
|
-#endif /* __SOUND_AINSTR_SIMPLE_H */
|
|
diff -r 9e2f117f24b9 include/sound/asequencer.h
|
|
--- a/include/sound/asequencer.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/sound/asequencer.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -22,7 +22,7 @@
|
|
#ifndef __SOUND_ASEQUENCER_H
|
|
#define __SOUND_ASEQUENCER_H
|
|
|
|
-#ifndef __KERNEL__
|
|
+#ifdef __KERNEL__
|
|
#include <linux/ioctl.h>
|
|
#endif
|
|
|
|
@@ -112,18 +112,7 @@
|
|
#define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */
|
|
#define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */
|
|
|
|
-/** synthesizer events
|
|
- * event data type = sndrv_seq_eve_sample_control_t
|
|
- */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE 70 /* sample select */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE_CLUSTER 71 /* sample cluster select */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE_START 72 /* voice start */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE_STOP 73 /* voice stop */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE_FREQ 74 /* playback frequency */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE_VOLUME 75 /* volume and balance */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE_LOOP 76 /* sample loop */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE_POSITION 77 /* sample position */
|
|
-#define SNDRV_SEQ_EVENT_SAMPLE_PRIVATE1 78 /* private (hardware dependent) event */
|
|
+/* 70-89: synthesizer events - obsoleted */
|
|
|
|
/** user-defined events with fixed length
|
|
* event data type = any
|
|
@@ -139,28 +128,7 @@
|
|
#define SNDRV_SEQ_EVENT_USR8 98
|
|
#define SNDRV_SEQ_EVENT_USR9 99
|
|
|
|
-/** instrument layer
|
|
- * variable length data can be passed directly to the driver
|
|
- */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_BEGIN 100 /* begin of instrument management */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_END 101 /* end of instrument management */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_INFO 102 /* instrument interface info */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_INFO_RESULT 103 /* result */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_FINFO 104 /* get format info */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_FINFO_RESULT 105 /* get format info */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_RESET 106 /* reset instrument memory */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_STATUS 107 /* instrument interface status */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_STATUS_RESULT 108 /* result */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_PUT 109 /* put instrument to port */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_GET 110 /* get instrument from port */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_GET_RESULT 111 /* result */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_FREE 112 /* free instrument(s) */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_LIST 113 /* instrument list */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_LIST_RESULT 114 /* result */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_CLUSTER 115 /* cluster parameters */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_GET 116 /* get cluster parameters */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_CLUSTER_RESULT 117 /* result */
|
|
-#define SNDRV_SEQ_EVENT_INSTR_CHANGE 118 /* instrument change */
|
|
+/* 100-118: instrument layer - obsoleted */
|
|
/* 119-129: reserved */
|
|
|
|
/* 130-139: variable length events
|
|
@@ -259,78 +227,6 @@ struct sndrv_seq_ev_ext {
|
|
unsigned int len; /* length of data */
|
|
void *ptr; /* pointer to data (note: maybe 64-bit) */
|
|
} __attribute__((packed));
|
|
-
|
|
-/* Instrument cluster type */
|
|
-typedef unsigned int sndrv_seq_instr_cluster_t;
|
|
-
|
|
-/* Instrument type */
|
|
-struct sndrv_seq_instr {
|
|
- sndrv_seq_instr_cluster_t cluster;
|
|
- unsigned int std; /* the upper byte means a private instrument (owner - client #) */
|
|
- unsigned short bank;
|
|
- unsigned short prg;
|
|
-};
|
|
-
|
|
- /* sample number */
|
|
-struct sndrv_seq_ev_sample {
|
|
- unsigned int std;
|
|
- unsigned short bank;
|
|
- unsigned short prg;
|
|
-};
|
|
-
|
|
- /* sample cluster */
|
|
-struct sndrv_seq_ev_cluster {
|
|
- sndrv_seq_instr_cluster_t cluster;
|
|
-};
|
|
-
|
|
- /* sample position */
|
|
-typedef unsigned int sndrv_seq_position_t; /* playback position (in samples) * 16 */
|
|
-
|
|
- /* sample stop mode */
|
|
-enum sndrv_seq_stop_mode {
|
|
- SAMPLE_STOP_IMMEDIATELY = 0, /* terminate playing immediately */
|
|
- SAMPLE_STOP_VENVELOPE = 1, /* finish volume envelope */
|
|
- SAMPLE_STOP_LOOP = 2 /* terminate loop and finish wave */
|
|
-};
|
|
-
|
|
- /* sample frequency */
|
|
-typedef int sndrv_seq_frequency_t; /* playback frequency in HZ * 16 */
|
|
-
|
|
- /* sample volume control; if any value is set to -1 == do not change */
|
|
-struct sndrv_seq_ev_volume {
|
|
- signed short volume; /* range: 0-16383 */
|
|
- signed short lr; /* left-right balance; range: 0-16383 */
|
|
- signed short fr; /* front-rear balance; range: 0-16383 */
|
|
- signed short du; /* down-up balance; range: 0-16383 */
|
|
-};
|
|
-
|
|
- /* simple loop redefinition */
|
|
-struct sndrv_seq_ev_loop {
|
|
- unsigned int start; /* loop start (in samples) * 16 */
|
|
- unsigned int end; /* loop end (in samples) * 16 */
|
|
-};
|
|
-
|
|
-struct sndrv_seq_ev_sample_control {
|
|
- unsigned char channel;
|
|
- unsigned char unused1, unused2, unused3; /* pad */
|
|
- union {
|
|
- struct sndrv_seq_ev_sample sample;
|
|
- struct sndrv_seq_ev_cluster cluster;
|
|
- sndrv_seq_position_t position;
|
|
- int stop_mode;
|
|
- sndrv_seq_frequency_t frequency;
|
|
- struct sndrv_seq_ev_volume volume;
|
|
- struct sndrv_seq_ev_loop loop;
|
|
- unsigned char raw8[8];
|
|
- } param;
|
|
-};
|
|
-
|
|
-
|
|
-
|
|
-/* INSTR_BEGIN event */
|
|
-struct sndrv_seq_ev_instr_begin {
|
|
- int timeout; /* zero = forever, otherwise timeout in ms */
|
|
-};
|
|
|
|
struct sndrv_seq_result {
|
|
int event; /* processed event type */
|
|
@@ -401,8 +297,6 @@ struct sndrv_seq_event {
|
|
struct sndrv_seq_addr addr;
|
|
struct sndrv_seq_connect connect;
|
|
struct sndrv_seq_result result;
|
|
- struct sndrv_seq_ev_instr_begin instr_begin;
|
|
- struct sndrv_seq_ev_sample_control sample;
|
|
struct sndrv_seq_ev_quote quote;
|
|
} data;
|
|
};
|
|
@@ -440,8 +334,6 @@ struct sndrv_seq_event_bounce {
|
|
#define sndrv_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
|
|
/* fixed length events: 0-99 */
|
|
#define sndrv_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
|
|
-/* instrument layer events: 100-129 */
|
|
-#define sndrv_seq_ev_is_instr_type(ev) ((ev)->type >= 100 && (ev)->type < 130)
|
|
/* variable length events: 130-139 */
|
|
#define sndrv_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
|
|
/* reserved for kernel */
|
|
@@ -738,136 +630,6 @@ struct sndrv_seq_query_subs {
|
|
|
|
|
|
/*
|
|
- * Instrument abstraction layer
|
|
- * - based on events
|
|
- */
|
|
-
|
|
-/* instrument types */
|
|
-#define SNDRV_SEQ_INSTR_ATYPE_DATA 0 /* instrument data */
|
|
-#define SNDRV_SEQ_INSTR_ATYPE_ALIAS 1 /* instrument alias */
|
|
-
|
|
-/* instrument ASCII identifiers */
|
|
-#define SNDRV_SEQ_INSTR_ID_DLS1 "DLS1"
|
|
-#define SNDRV_SEQ_INSTR_ID_DLS2 "DLS2"
|
|
-#define SNDRV_SEQ_INSTR_ID_SIMPLE "Simple Wave"
|
|
-#define SNDRV_SEQ_INSTR_ID_SOUNDFONT "SoundFont"
|
|
-#define SNDRV_SEQ_INSTR_ID_GUS_PATCH "GUS Patch"
|
|
-#define SNDRV_SEQ_INSTR_ID_INTERWAVE "InterWave FFFF"
|
|
-#define SNDRV_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM"
|
|
-#define SNDRV_SEQ_INSTR_ID_OPL4 "OPL4"
|
|
-
|
|
-/* instrument types */
|
|
-#define SNDRV_SEQ_INSTR_TYPE0_DLS1 (1<<0) /* MIDI DLS v1 */
|
|
-#define SNDRV_SEQ_INSTR_TYPE0_DLS2 (1<<1) /* MIDI DLS v2 */
|
|
-#define SNDRV_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /* Simple Wave */
|
|
-#define SNDRV_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /* EMU SoundFont */
|
|
-#define SNDRV_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /* Gravis UltraSound Patch */
|
|
-#define SNDRV_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /* InterWave FFFF */
|
|
-#define SNDRV_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /* Yamaha OPL2/3 FM */
|
|
-#define SNDRV_SEQ_INSTR_TYPE2_OPL4 (1<<1) /* Yamaha OPL4 */
|
|
-
|
|
-/* put commands */
|
|
-#define SNDRV_SEQ_INSTR_PUT_CMD_CREATE 0
|
|
-#define SNDRV_SEQ_INSTR_PUT_CMD_REPLACE 1
|
|
-#define SNDRV_SEQ_INSTR_PUT_CMD_MODIFY 2
|
|
-#define SNDRV_SEQ_INSTR_PUT_CMD_ADD 3
|
|
-#define SNDRV_SEQ_INSTR_PUT_CMD_REMOVE 4
|
|
-
|
|
-/* get commands */
|
|
-#define SNDRV_SEQ_INSTR_GET_CMD_FULL 0
|
|
-#define SNDRV_SEQ_INSTR_GET_CMD_PARTIAL 1
|
|
-
|
|
-/* query flags */
|
|
-#define SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0)
|
|
-
|
|
-/* free commands */
|
|
-#define SNDRV_SEQ_INSTR_FREE_CMD_ALL 0
|
|
-#define SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE 1
|
|
-#define SNDRV_SEQ_INSTR_FREE_CMD_CLUSTER 2
|
|
-#define SNDRV_SEQ_INSTR_FREE_CMD_SINGLE 3
|
|
-
|
|
-/* size of ROM/RAM */
|
|
-typedef unsigned int sndrv_seq_instr_size_t;
|
|
-
|
|
-/* INSTR_INFO */
|
|
-
|
|
-struct sndrv_seq_instr_info {
|
|
- int result; /* operation result */
|
|
- unsigned int formats[8]; /* bitmap of supported formats */
|
|
- int ram_count; /* count of RAM banks */
|
|
- sndrv_seq_instr_size_t ram_sizes[16]; /* size of RAM banks */
|
|
- int rom_count; /* count of ROM banks */
|
|
- sndrv_seq_instr_size_t rom_sizes[8]; /* size of ROM banks */
|
|
- char reserved[128];
|
|
-};
|
|
-
|
|
-/* INSTR_STATUS */
|
|
-
|
|
-struct sndrv_seq_instr_status {
|
|
- int result; /* operation result */
|
|
- sndrv_seq_instr_size_t free_ram[16]; /* free RAM in banks */
|
|
- int instrument_count; /* count of downloaded instruments */
|
|
- char reserved[128];
|
|
-};
|
|
-
|
|
-/* INSTR_FORMAT_INFO */
|
|
-
|
|
-struct sndrv_seq_instr_format_info {
|
|
- char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
|
|
- unsigned int len; /* max data length (without this structure) */
|
|
-};
|
|
-
|
|
-struct sndrv_seq_instr_format_info_result {
|
|
- int result; /* operation result */
|
|
- char format[16]; /* format identifier */
|
|
- unsigned int len; /* filled data length (without this structure) */
|
|
-};
|
|
-
|
|
-/* instrument data */
|
|
-struct sndrv_seq_instr_data {
|
|
- char name[32]; /* instrument name */
|
|
- char reserved[16]; /* for the future use */
|
|
- int type; /* instrument type */
|
|
- union {
|
|
- char format[16]; /* format identifier */
|
|
- struct sndrv_seq_instr alias;
|
|
- } data;
|
|
-};
|
|
-
|
|
-/* INSTR_PUT/GET, data are stored in one block (extended), header + data */
|
|
-
|
|
-struct sndrv_seq_instr_header {
|
|
- union {
|
|
- struct sndrv_seq_instr instr;
|
|
- sndrv_seq_instr_cluster_t cluster;
|
|
- } id; /* instrument identifier */
|
|
- unsigned int cmd; /* get/put/free command */
|
|
- unsigned int flags; /* query flags (only for get) */
|
|
- unsigned int len; /* real instrument data length (without header) */
|
|
- int result; /* operation result */
|
|
- char reserved[16]; /* for the future */
|
|
- struct sndrv_seq_instr_data data; /* instrument data (for put/get result) */
|
|
-};
|
|
-
|
|
-/* INSTR_CLUSTER_SET */
|
|
-
|
|
-struct sndrv_seq_instr_cluster_set {
|
|
- sndrv_seq_instr_cluster_t cluster; /* cluster identifier */
|
|
- char name[32]; /* cluster name */
|
|
- int priority; /* cluster priority */
|
|
- char reserved[64]; /* for the future use */
|
|
-};
|
|
-
|
|
-/* INSTR_CLUSTER_GET */
|
|
-
|
|
-struct sndrv_seq_instr_cluster_get {
|
|
- sndrv_seq_instr_cluster_t cluster; /* cluster identifier */
|
|
- char name[32]; /* cluster name */
|
|
- int priority; /* cluster priority */
|
|
- char reserved[64]; /* for the future use */
|
|
-};
|
|
-
|
|
-/*
|
|
* IOCTL commands
|
|
*/
|
|
|
|
diff -r 9e2f117f24b9 include/sound/asound_fm.h
|
|
--- a/include/sound/asound_fm.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/sound/asound_fm.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -29,16 +29,16 @@
|
|
#define SNDRV_DM_FM_MODE_OPL2 0x00
|
|
#define SNDRV_DM_FM_MODE_OPL3 0x01
|
|
|
|
-typedef struct snd_dm_fm_info {
|
|
+struct snd_dm_fm_info {
|
|
unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
|
|
unsigned char rhythm; /* percussion mode flag */
|
|
-} snd_dm_fm_info_t;
|
|
+};
|
|
|
|
/*
|
|
* Data structure composing an FM "note" or sound event.
|
|
*/
|
|
|
|
-typedef struct snd_dm_fm_voice {
|
|
+struct snd_dm_fm_voice {
|
|
unsigned char op; /* operator cell (0 or 1) */
|
|
unsigned char voice; /* FM voice (0 to 17) */
|
|
|
|
@@ -60,25 +60,25 @@ typedef struct snd_dm_fm_voice {
|
|
unsigned char left; /* stereo left */
|
|
unsigned char right; /* stereo right */
|
|
unsigned char waveform; /* 3 bits: waveform shape */
|
|
-} snd_dm_fm_voice_t;
|
|
+};
|
|
|
|
/*
|
|
* This describes an FM note by its voice, octave, frequency number (10bit)
|
|
* and key on/off.
|
|
*/
|
|
|
|
-typedef struct snd_dm_fm_note {
|
|
+struct snd_dm_fm_note {
|
|
unsigned char voice; /* 0-17 voice channel */
|
|
unsigned char octave; /* 3 bits: what octave to play */
|
|
unsigned int fnum; /* 10 bits: frequency number */
|
|
unsigned char key_on; /* set for active, clear for silent */
|
|
-} snd_dm_fm_note_t;
|
|
+};
|
|
|
|
/*
|
|
* FM parameters that apply globally to all voices, and thus are not "notes"
|
|
*/
|
|
|
|
-typedef struct snd_dm_fm_params {
|
|
+struct snd_dm_fm_params {
|
|
unsigned char am_depth; /* amplitude modulation depth (1=hi) */
|
|
unsigned char vib_depth; /* vibrato depth (1=hi) */
|
|
unsigned char kbd_split; /* keyboard split */
|
|
@@ -90,20 +90,22 @@ typedef struct snd_dm_fm_params {
|
|
unsigned char tomtom;
|
|
unsigned char cymbal;
|
|
unsigned char hihat;
|
|
-} snd_dm_fm_params_t;
|
|
+};
|
|
|
|
/*
|
|
* FM mode ioctl settings
|
|
*/
|
|
|
|
-#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, snd_dm_fm_info_t)
|
|
+#define SNDRV_DM_FM_IOCTL_INFO _IOR('H', 0x20, struct snd_dm_fm_info)
|
|
#define SNDRV_DM_FM_IOCTL_RESET _IO ('H', 0x21)
|
|
-#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, snd_dm_fm_note_t)
|
|
-#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, snd_dm_fm_voice_t)
|
|
-#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, snd_dm_fm_params_t)
|
|
+#define SNDRV_DM_FM_IOCTL_PLAY_NOTE _IOW('H', 0x22, struct snd_dm_fm_note)
|
|
+#define SNDRV_DM_FM_IOCTL_SET_VOICE _IOW('H', 0x23, struct snd_dm_fm_voice)
|
|
+#define SNDRV_DM_FM_IOCTL_SET_PARAMS _IOW('H', 0x24, struct snd_dm_fm_params)
|
|
#define SNDRV_DM_FM_IOCTL_SET_MODE _IOW('H', 0x25, int)
|
|
/* for OPL3 only */
|
|
#define SNDRV_DM_FM_IOCTL_SET_CONNECTION _IOW('H', 0x26, int)
|
|
+/* SBI patch management */
|
|
+#define SNDRV_DM_FM_IOCTL_CLEAR_PATCHES _IO ('H', 0x40)
|
|
|
|
#define SNDRV_DM_FM_OSS_IOCTL_RESET 0x20
|
|
#define SNDRV_DM_FM_OSS_IOCTL_PLAY_NOTE 0x21
|
|
@@ -112,4 +114,21 @@ typedef struct snd_dm_fm_params {
|
|
#define SNDRV_DM_FM_OSS_IOCTL_SET_MODE 0x24
|
|
#define SNDRV_DM_FM_OSS_IOCTL_SET_OPL 0x25
|
|
|
|
+/*
|
|
+ * Patch Record - fixed size for write
|
|
+ */
|
|
+
|
|
+#define FM_KEY_SBI "SBI\032"
|
|
+#define FM_KEY_2OP "2OP\032"
|
|
+#define FM_KEY_4OP "4OP\032"
|
|
+
|
|
+struct sbi_patch {
|
|
+ unsigned char prog;
|
|
+ unsigned char bank;
|
|
+ char key[4];
|
|
+ char name[25];
|
|
+ char extension[7];
|
|
+ unsigned char data[32];
|
|
+};
|
|
+
|
|
#endif /* __SOUND_ASOUND_FM_H */
|
|
diff -r 9e2f117f24b9 include/timer.h
|
|
--- a/include/timer.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/include/timer.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -164,7 +164,7 @@ ssize_t snd_timer_read(snd_timer_t *hand
|
|
|
|
size_t snd_timer_id_sizeof(void);
|
|
/** allocate #snd_timer_id_t container on stack */
|
|
-#define snd_timer_id_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_id_t *) alloca(snd_timer_id_sizeof()); memset(*ptr, 0, snd_timer_id_sizeof()); } while (0)
|
|
+#define snd_timer_id_alloca(ptr) __snd_alloca(ptr, snd_timer_id)
|
|
int snd_timer_id_malloc(snd_timer_id_t **ptr);
|
|
void snd_timer_id_free(snd_timer_id_t *obj);
|
|
void snd_timer_id_copy(snd_timer_id_t *dst, const snd_timer_id_t *src);
|
|
@@ -182,7 +182,7 @@ int snd_timer_id_get_subdevice(snd_timer
|
|
|
|
size_t snd_timer_ginfo_sizeof(void);
|
|
/** allocate #snd_timer_ginfo_t container on stack */
|
|
-#define snd_timer_ginfo_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_ginfo_t *) alloca(snd_timer_ginfo_sizeof()); memset(*ptr, 0, snd_timer_ginfo_sizeof()); } while (0)
|
|
+#define snd_timer_ginfo_alloca(ptr) __snd_alloca(ptr, snd_timer_ginfo)
|
|
int snd_timer_ginfo_malloc(snd_timer_ginfo_t **ptr);
|
|
void snd_timer_ginfo_free(snd_timer_ginfo_t *obj);
|
|
void snd_timer_ginfo_copy(snd_timer_ginfo_t *dst, const snd_timer_ginfo_t *src);
|
|
@@ -200,7 +200,7 @@ unsigned int snd_timer_ginfo_get_clients
|
|
|
|
size_t snd_timer_info_sizeof(void);
|
|
/** allocate #snd_timer_info_t container on stack */
|
|
-#define snd_timer_info_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_info_t *) alloca(snd_timer_info_sizeof()); memset(*ptr, 0, snd_timer_info_sizeof()); } while (0)
|
|
+#define snd_timer_info_alloca(ptr) __snd_alloca(ptr, snd_timer_info)
|
|
int snd_timer_info_malloc(snd_timer_info_t **ptr);
|
|
void snd_timer_info_free(snd_timer_info_t *obj);
|
|
void snd_timer_info_copy(snd_timer_info_t *dst, const snd_timer_info_t *src);
|
|
@@ -213,7 +213,7 @@ long snd_timer_info_get_resolution(snd_t
|
|
|
|
size_t snd_timer_params_sizeof(void);
|
|
/** allocate #snd_timer_params_t container on stack */
|
|
-#define snd_timer_params_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_params_t *) alloca(snd_timer_params_sizeof()); memset(*ptr, 0, snd_timer_params_sizeof()); } while (0)
|
|
+#define snd_timer_params_alloca(ptr) __snd_alloca(ptr, snd_timer_params)
|
|
int snd_timer_params_malloc(snd_timer_params_t **ptr);
|
|
void snd_timer_params_free(snd_timer_params_t *obj);
|
|
void snd_timer_params_copy(snd_timer_params_t *dst, const snd_timer_params_t *src);
|
|
@@ -233,7 +233,7 @@ unsigned int snd_timer_params_get_filter
|
|
|
|
size_t snd_timer_status_sizeof(void);
|
|
/** allocate #snd_timer_status_t container on stack */
|
|
-#define snd_timer_status_alloca(ptr) do { assert(ptr); *ptr = (snd_timer_status_t *) alloca(snd_timer_status_sizeof()); memset(*ptr, 0, snd_timer_status_sizeof()); } while (0)
|
|
+#define snd_timer_status_alloca(ptr) __snd_alloca(ptr, snd_timer_status)
|
|
int snd_timer_status_malloc(snd_timer_status_t **ptr);
|
|
void snd_timer_status_free(snd_timer_status_t *obj);
|
|
void snd_timer_status_copy(snd_timer_status_t *dst, const snd_timer_status_t *src);
|
|
diff -r 9e2f117f24b9 src/Makefile.am
|
|
--- a/src/Makefile.am Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/Makefile.am Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -37,10 +37,6 @@ if BUILD_SEQ
|
|
if BUILD_SEQ
|
|
SUBDIRS += seq
|
|
libasound_la_LIBADD += seq/libseq.la
|
|
-endif
|
|
-if BUILD_INSTR
|
|
-SUBDIRS += instr
|
|
-libasound_la_LIBADD += instr/libinstr.la
|
|
endif
|
|
if BUILD_ALISP
|
|
SUBDIRS += alisp
|
|
diff -r 9e2f117f24b9 src/Versions.in
|
|
--- a/src/Versions.in Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/Versions.in Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -1,8 +1,16 @@ ALSA_0.9 {
|
|
ALSA_0.9 {
|
|
global:
|
|
- @SYMBOL_PREFIX@__snd_*;
|
|
- @SYMBOL_PREFIX@_snd_*;
|
|
@SYMBOL_PREFIX@snd_*;
|
|
+
|
|
+ @SYMBOL_PREFIX@_snd_*_open;
|
|
+ @SYMBOL_PREFIX@_snd_*_dlsym_*;
|
|
+ @SYMBOL_PREFIX@_snd_*_poll_descriptor;
|
|
+ @SYMBOL_PREFIX@_snd_pcm_hook_*;
|
|
+
|
|
+ @SYMBOL_PREFIX@__snd_hw_params_*;
|
|
+ @SYMBOL_PREFIX@__snd_hw_params_*;
|
|
+ @SYMBOL_PREFIX@__snd_*_open_dlsym_*;
|
|
+
|
|
local:
|
|
*;
|
|
};
|
|
@@ -115,184 +123,9 @@ ALSA_0.9.5 {
|
|
@SYMBOL_PREFIX@alsa_lisp;
|
|
} ALSA_0.9.3;
|
|
|
|
-ALSA_0.9.6 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_hctl_open_ctl;
|
|
- @SYMBOL_PREFIX@snd_seq_port_info_get_timestamping;
|
|
- @SYMBOL_PREFIX@snd_seq_port_info_get_timestamp_real;
|
|
- @SYMBOL_PREFIX@snd_seq_port_info_get_timestamp_queue;
|
|
- @SYMBOL_PREFIX@snd_seq_port_info_set_timestamping;
|
|
- @SYMBOL_PREFIX@snd_seq_port_info_set_timestamp_real;
|
|
- @SYMBOL_PREFIX@snd_seq_port_info_set_timestamp_queue;
|
|
-} ALSA_0.9.5;
|
|
-
|
|
ALSA_0.9.7 {
|
|
global:
|
|
|
|
- @SYMBOL_PREFIX@snd_user_file;
|
|
- @SYMBOL_PREFIX@snd_hctl_ctl;
|
|
- @SYMBOL_PREFIX@sndo_*;
|
|
@SYMBOL_PREFIX@alsa_lisp_*;
|
|
-} ALSA_0.9.6;
|
|
+} ALSA_0.9.5;
|
|
|
|
-ALSA_0.9.8 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_add;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_replace;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_remove;
|
|
- @SYMBOL_PREFIX@snd_hctl_poll_descriptors_revents;
|
|
-} ALSA_0.9.7;
|
|
-
|
|
-ALSA_1.0.4 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_spcm_init;
|
|
- @SYMBOL_PREFIX@snd_spcm_init_duplex;
|
|
- @SYMBOL_PREFIX@snd_spcm_init_get_params;
|
|
-} ALSA_0.9.8;
|
|
-
|
|
-ALSA_1.0.5 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_asoundlib_version;
|
|
- @SYMBOL_PREFIX@snd_timer_params_set_early_event;
|
|
- @SYMBOL_PREFIX@snd_timer_params_get_early_event;
|
|
-} ALSA_1.0.4;
|
|
-
|
|
-ALSA_1.0.8 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_add_integer;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_add_integer64;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_add_boolean;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_add_iec958;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_remove;
|
|
-} ALSA_1.0.5;
|
|
-
|
|
-ALSA_1.0.9 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_names_list;
|
|
- @SYMBOL_PREFIX@snd_names_list_free;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_pcm_hw_params_set_rate_resample;
|
|
- @SYMBOL_PREFIX@snd_pcm_hw_params_get_rate_resample;
|
|
- @SYMBOL_PREFIX@snd_pcm_hw_params_set_export_buffer;
|
|
- @SYMBOL_PREFIX@snd_pcm_hw_params_get_export_buffer;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_pcm_ioplug_create;
|
|
- @SYMBOL_PREFIX@snd_pcm_ioplug_delete;
|
|
- @SYMBOL_PREFIX@snd_pcm_ioplug_reinit_status;
|
|
- @SYMBOL_PREFIX@snd_pcm_ioplug_params_reset;
|
|
- @SYMBOL_PREFIX@snd_pcm_ioplug_set_param_minmax;
|
|
- @SYMBOL_PREFIX@snd_pcm_ioplug_set_param_list;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_pcm_extplug_create;
|
|
- @SYMBOL_PREFIX@snd_pcm_extplug_delete;
|
|
- @SYMBOL_PREFIX@snd_pcm_extplug_params_reset;
|
|
- @SYMBOL_PREFIX@snd_pcm_extplug_set_param_list;
|
|
- @SYMBOL_PREFIX@snd_pcm_extplug_set_param_minmax;
|
|
- @SYMBOL_PREFIX@snd_pcm_extplug_set_slave_param_list;
|
|
- @SYMBOL_PREFIX@snd_pcm_extplug_set_slave_param_minmax;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_pcm_parse_control_id;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_async_add_timer_handler;
|
|
- @SYMBOL_PREFIX@snd_async_handler_get_timer;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_sizeof;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_malloc;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_free;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_copy;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_set_tid;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_tid;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_flags;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_card;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_id;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_name;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_resolution;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_resolution_min;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_resolution_max;
|
|
- @SYMBOL_PREFIX@snd_timer_ginfo_get_clients;
|
|
-
|
|
-} ALSA_1.0.8;
|
|
-
|
|
-ALSA_1.0.10 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_mixer_get_hctl;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_get_private;
|
|
- @SYMBOL_PREFIX@snd_mixer_attach_hctl;
|
|
- @SYMBOL_PREFIX@snd_mixer_detach_hctl;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_mixer_class_register;
|
|
- @SYMBOL_PREFIX@snd_mixer_add_elem;
|
|
- @SYMBOL_PREFIX@snd_mixer_remove_elem;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_new;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_add;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_remove;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_free;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_info;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_value;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_attach;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_detach;
|
|
- @SYMBOL_PREFIX@snd_mixer_elem_empty;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_mixer_class_malloc;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_free;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_copy;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_get_mixer;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_get_event;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_get_private;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_get_compare;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_set_event;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_set_private;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_set_private_free;
|
|
- @SYMBOL_PREFIX@snd_mixer_class_set_compare;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_mixer_selem_set_playback_dB_all;
|
|
- @SYMBOL_PREFIX@snd_mixer_selem_set_capture_dB_all;
|
|
- @SYMBOL_PREFIX@snd_mixer_selem_is_enum_playback;
|
|
- @SYMBOL_PREFIX@snd_mixer_selem_is_enum_capture;
|
|
- @SYMBOL_PREFIX@snd_mixer_selem_compare;
|
|
- @SYMBOL_PREFIX@snd_mixer_sbasic_info;
|
|
- @SYMBOL_PREFIX@snd_mixer_sbasic_get_private;
|
|
- @SYMBOL_PREFIX@snd_mixer_sbasic_set_private;
|
|
- @SYMBOL_PREFIX@snd_mixer_sbasic_set_private_free;
|
|
-
|
|
- @SYMBOL_PREFIX@snd_ctl_ext_create;
|
|
- @SYMBOL_PREFIX@snd_ctl_ext_delete;
|
|
-
|
|
-} ALSA_1.0.9;
|
|
-
|
|
-ALSA_1.0.11 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_pcm_recover;
|
|
- @SYMBOL_PREFIX@snd_pcm_set_params;
|
|
- @SYMBOL_PREFIX@snd_pcm_get_params;
|
|
-} ALSA_1.0.10;
|
|
-
|
|
-ALSA_1.0.12 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_tlv_read;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_tlv_write;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_tlv_command;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_info_is_tlv_readable;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_info_is_tlv_writable;
|
|
- @SYMBOL_PREFIX@snd_ctl_elem_info_is_tlv_commandable;
|
|
- @SYMBOL_PREFIX@snd_hctl_elem_tlv_read;
|
|
- @SYMBOL_PREFIX@snd_hctl_elem_tlv_write;
|
|
- @SYMBOL_PREFIX@snd_hctl_elem_tlv_command;
|
|
-} ALSA_1.0.11;
|
|
-
|
|
-ALSA_1.0.14 {
|
|
- global:
|
|
-
|
|
- @SYMBOL_PREFIX@snd_device_name_hint;
|
|
- @SYMBOL_PREFIX@snd_device_name_free_hint;
|
|
- @SYMBOL_PREFIX@snd_device_name_get_hint;
|
|
-} ALSA_1.0.12;
|
|
diff -r 9e2f117f24b9 src/conf.c
|
|
--- a/src/conf.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/conf.c Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -2897,7 +2897,7 @@ int snd_config_hook_load_for_all_cards(s
|
|
return err;
|
|
if (snd_config_search(root, fdriver, &n) >= 0) {
|
|
if (snd_config_get_string(n, &driver) < 0)
|
|
- continue;
|
|
+ goto __err;
|
|
while (1) {
|
|
char *s = strchr(driver, '.');
|
|
if (s == NULL)
|
|
@@ -2905,7 +2905,7 @@ int snd_config_hook_load_for_all_cards(s
|
|
driver = s + 1;
|
|
}
|
|
if (snd_config_search(root, driver, &n) >= 0)
|
|
- continue;
|
|
+ goto __err;
|
|
} else {
|
|
driver = fdriver;
|
|
}
|
|
diff -r 9e2f117f24b9 src/conf/alsa.conf
|
|
--- a/src/conf/alsa.conf Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/conf/alsa.conf Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -317,7 +317,7 @@ ctl.default {
|
|
}
|
|
|
|
ctl.hw {
|
|
- @args[ CARD ]
|
|
+ @args [ CARD ]
|
|
@args.CARD {
|
|
type string
|
|
default {
|
|
diff -r 9e2f117f24b9 src/conf/cards/CMI8788.conf
|
|
--- a/src/conf/cards/CMI8788.conf Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/conf/cards/CMI8788.conf Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -1,10 +1,6 @@
|
|
#
|
|
# Configuration for the CMI8788 chip
|
|
#
|
|
-
|
|
-# TODO: use 96 or 192 kHz for dmix?
|
|
-# TODO: remove softvol
|
|
-# TODO: add hooks for SPDIF mixer controls
|
|
|
|
<confdir:pcm/front.conf>
|
|
|
|
@@ -13,18 +9,11 @@ CMI8788.pcm.front.0 {
|
|
@args.CARD {
|
|
type string
|
|
}
|
|
- type softvol
|
|
- slave.pcm {
|
|
- type hw
|
|
- card $CARD
|
|
- }
|
|
- control {
|
|
- name "PCM Playback Volume"
|
|
- card $CARD
|
|
- }
|
|
+ type hw
|
|
+ card $CARD
|
|
}
|
|
|
|
-# default with dmix+softvol & dsnoop
|
|
+# default with dmix & dsnoop
|
|
CMI8788.pcm.default {
|
|
@args [ CARD ]
|
|
@args.CARD {
|
|
@@ -34,22 +23,15 @@ CMI8788.pcm.default {
|
|
playback.pcm {
|
|
type plug
|
|
slave.pcm {
|
|
- type softvol
|
|
- slave.pcm {
|
|
- @func concat
|
|
- strings [ "dmix:" $CARD ]
|
|
- }
|
|
- control {
|
|
- name "PCM Playback Volume"
|
|
- card $CARD
|
|
- }
|
|
+ @func concat
|
|
+ strings [ "dmix:" $CARD ",FORMAT=S32_LE" ]
|
|
}
|
|
}
|
|
capture.pcm {
|
|
type plug
|
|
slave.pcm {
|
|
@func concat
|
|
- strings [ "dsnoop:" $CARD ]
|
|
+ strings [ "dsnoop:" $CARD ",FORMAT=S32_LE" ]
|
|
}
|
|
}
|
|
}
|
|
@@ -61,16 +43,9 @@ CMI8788.pcm.surround40.0 {
|
|
@args.CARD {
|
|
type string
|
|
}
|
|
- type softvol
|
|
- slave.pcm {
|
|
- type hw
|
|
- card $CARD
|
|
- channels 4
|
|
- }
|
|
- control {
|
|
- name "PCM Playback Volume"
|
|
- card $CARD
|
|
- }
|
|
+ type hw
|
|
+ card $CARD
|
|
+ channels 4
|
|
}
|
|
|
|
|
|
@@ -83,16 +58,9 @@ CMI8788.pcm.surround51.0 {
|
|
@args.CARD {
|
|
type string
|
|
}
|
|
- type softvol
|
|
- slave.pcm {
|
|
- type hw
|
|
- card $CARD
|
|
- channels 6
|
|
- }
|
|
- control {
|
|
- name "PCM Playback Volume"
|
|
- card $CARD
|
|
- }
|
|
+ type hw
|
|
+ card $CARD
|
|
+ channels 6
|
|
}
|
|
|
|
<confdir:pcm/surround71.conf>
|
|
@@ -102,16 +70,9 @@ CMI8788.pcm.surround71.0 {
|
|
@args.CARD {
|
|
type string
|
|
}
|
|
- type softvol
|
|
- slave.pcm {
|
|
- type hw
|
|
- card $CARD
|
|
- channels 8
|
|
- }
|
|
- control {
|
|
- name "PCM Playback Volume"
|
|
- card $CARD
|
|
- }
|
|
+ type hw
|
|
+ card $CARD
|
|
+ channels 8
|
|
}
|
|
|
|
<confdir:pcm/iec958.conf>
|
|
@@ -135,9 +96,25 @@ CMI8788.pcm.iec958.0 {
|
|
}
|
|
type asym
|
|
playback.pcm {
|
|
- type hw
|
|
- card $CARD
|
|
- device 1
|
|
+ type hooks
|
|
+ slave.pcm {
|
|
+ type hw
|
|
+ card $CARD
|
|
+ device 1
|
|
+ }
|
|
+ hooks.0 {
|
|
+ type ctl_elems
|
|
+ hook_args [
|
|
+ {
|
|
+ interface PCM
|
|
+ device 1
|
|
+ name "IEC958 Playback PCM Stream"
|
|
+ lock true
|
|
+ preserve true
|
|
+ value [ $AES0 $AES1 $AES2 $AES3 ]
|
|
+ }
|
|
+ ]
|
|
+ }
|
|
}
|
|
capture.pcm {
|
|
type hw
|
|
diff -r 9e2f117f24b9 src/conf/cards/aliases.conf
|
|
--- a/src/conf/cards/aliases.conf Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/conf/cards/aliases.conf Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -49,6 +49,7 @@ Canyon3D-2 cards.Maestro3
|
|
Canyon3D-2 cards.Maestro3
|
|
Azalia cards.HDA-Intel
|
|
aaci-pl041 cards.AACI
|
|
+AV200 cards.CMI8788
|
|
|
|
<confdir:pcm/default.conf>
|
|
<confdir:pcm/dmix.conf>
|
|
diff -r 9e2f117f24b9 src/control/Makefile.am
|
|
--- a/src/control/Makefile.am Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/control/Makefile.am Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -1,6 +1,6 @@ EXTRA_LTLIBRARIES = libcontrol.la
|
|
EXTRA_LTLIBRARIES = libcontrol.la
|
|
|
|
-libcontrol_la_SOURCES = cards.c namehint.c hcontrol.c \
|
|
+libcontrol_la_SOURCES = cards.c tlv.c namehint.c hcontrol.c \
|
|
control.c control_hw.c setup.c control_symbols.c
|
|
if BUILD_CTL_PLUGIN_SHM
|
|
libcontrol_la_SOURCES += control_shm.c
|
|
diff -r 9e2f117f24b9 src/control/cards.c
|
|
--- a/src/control/cards.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/control/cards.c Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -39,12 +39,7 @@
|
|
#define SND_FILE_LOAD ALOAD_DEVICE_DIRECTORY "aloadC%i"
|
|
#endif
|
|
|
|
-/**
|
|
- * \brief Try to load the driver for a card.
|
|
- * \param card Card number.
|
|
- * \return 1 if driver is present, zero if driver is not present
|
|
- */
|
|
-int snd_card_load(int card)
|
|
+static int snd_card_load1(int card)
|
|
{
|
|
int open_dev;
|
|
char control[sizeof(SND_FILE_CONTROL) + 10];
|
|
@@ -61,9 +56,20 @@ int snd_card_load(int card)
|
|
#endif
|
|
if (open_dev >= 0) {
|
|
close (open_dev);
|
|
- return 1;
|
|
+ return 0;
|
|
+ } else {
|
|
+ return -errno;
|
|
}
|
|
- return 0;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Try to load the driver for a card.
|
|
+ * \param card Card number.
|
|
+ * \return 1 if driver is present, zero if driver is not present
|
|
+ */
|
|
+int snd_card_load(int card)
|
|
+{
|
|
+ return !!(snd_card_load1(card) == 0);
|
|
}
|
|
|
|
/**
|
|
@@ -104,7 +110,7 @@ int snd_card_next(int *rcard)
|
|
*/
|
|
int snd_card_get_index(const char *string)
|
|
{
|
|
- int card;
|
|
+ int card, err;
|
|
snd_ctl_t *handle;
|
|
snd_ctl_card_info_t info;
|
|
|
|
@@ -116,13 +122,16 @@ int snd_card_get_index(const char *strin
|
|
return -EINVAL;
|
|
if (card < 0 || card > 31)
|
|
return -EINVAL;
|
|
- if (snd_card_load(card))
|
|
+ err = snd_card_load1(card);
|
|
+ if (err >= 0)
|
|
return card;
|
|
- return -ENODEV;
|
|
+ return err;
|
|
}
|
|
for (card = 0; card < 32; card++) {
|
|
+#ifdef SUPPORT_ALOAD
|
|
if (! snd_card_load(card))
|
|
continue;
|
|
+#endif
|
|
if (snd_ctl_hw_open(&handle, NULL, card, 0) < 0)
|
|
continue;
|
|
if (snd_ctl_card_info(handle, &info) < 0) {
|
|
diff -r 9e2f117f24b9 src/control/control_local.h
|
|
--- a/src/control/control_local.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/control/control_local.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -89,6 +89,9 @@ struct _snd_hctl {
|
|
};
|
|
|
|
|
|
+/* make local functions really local */
|
|
+#define snd_ctl_new snd1_ctl_new
|
|
+
|
|
int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name);
|
|
int _snd_ctl_poll_descriptor(snd_ctl_t *ctl);
|
|
#define _snd_ctl_async_descriptor _snd_ctl_poll_descriptor
|
|
diff -r 9e2f117f24b9 src/control/tlv.c
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
+++ b/src/control/tlv.c Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -0,0 +1,429 @@
|
|
+/**
|
|
+ * \file control/tlv.c
|
|
+ * \brief dB conversion functions from control TLV information
|
|
+ * \author Takashi Iwai <tiwai@suse.de>
|
|
+ * \date 2007
|
|
+ */
|
|
+/*
|
|
+ * Control Interface - dB conversion functions from control TLV information
|
|
+ *
|
|
+ * Copyright (c) 2007 Takashi Iwai <tiwai@suse.de>
|
|
+ *
|
|
+ *
|
|
+ * 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
|
|
+ *
|
|
+ */
|
|
+
|
|
+#include <stdio.h>
|
|
+#include <stdlib.h>
|
|
+#include <unistd.h>
|
|
+#include <string.h>
|
|
+#ifndef HAVE_SOFT_FLOAT
|
|
+#include <math.h>
|
|
+#endif
|
|
+#include "control_local.h"
|
|
+
|
|
+#ifndef DOC_HIDDEN
|
|
+/* convert to index of integer array */
|
|
+#define int_index(size) (((size) + sizeof(int) - 1) / sizeof(int))
|
|
+/* max size of a TLV entry for dB information (including compound one) */
|
|
+#define MAX_TLV_RANGE_SIZE 256
|
|
+#endif
|
|
+
|
|
+/**
|
|
+ * \brief Parse TLV stream and retrieve dB information
|
|
+ * \param tlv the TLV source
|
|
+ * \param tlv_size the byte size of TLV source
|
|
+ * \param db_tlvp the pointer stored the dB TLV information
|
|
+ * \return the byte size of dB TLV information if found in the given
|
|
+ * TLV source, or a negative error code.
|
|
+ *
|
|
+ * This function parses the given TLV source and stores the TLV start
|
|
+ * point if the TLV information regarding dB conversion is found.
|
|
+ * The stored TLV pointer can be passed to the convesion functions
|
|
+ * #snd_tlv_convert_to_dB(), #snd_tlv_convert_from_dB() and
|
|
+ * #snd_tlv_get_dB_range().
|
|
+ */
|
|
+int snd_tlv_parse_dB_info(unsigned int *tlv,
|
|
+ unsigned int tlv_size,
|
|
+ unsigned int **db_tlvp)
|
|
+{
|
|
+ unsigned int type;
|
|
+ unsigned int size;
|
|
+ int err;
|
|
+
|
|
+ *db_tlvp = NULL;
|
|
+ type = tlv[0];
|
|
+ size = tlv[1];
|
|
+ tlv_size -= 2 * sizeof(int);
|
|
+ if (size > tlv_size) {
|
|
+ SNDERR("TLV size error");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ switch (type) {
|
|
+ case SND_CTL_TLVT_CONTAINER:
|
|
+ size = int_index(size) * sizeof(int);
|
|
+ tlv += 2;
|
|
+ while (size > 0) {
|
|
+ unsigned int len;
|
|
+ err = snd_tlv_parse_dB_info(tlv, size, db_tlvp);
|
|
+ if (err < 0)
|
|
+ return err; /* error */
|
|
+ if (err > 0)
|
|
+ return err; /* found */
|
|
+ len = int_index(tlv[1]) + 2;
|
|
+ size -= len * sizeof(int);
|
|
+ tlv += len;
|
|
+ }
|
|
+ break;
|
|
+ case SND_CTL_TLVT_DB_SCALE:
|
|
+#ifndef HAVE_SOFT_FLOAT
|
|
+ case SND_CTL_TLVT_DB_LINEAR:
|
|
+#endif
|
|
+ case SND_CTL_TLVT_DB_RANGE: {
|
|
+ unsigned int minsize;
|
|
+ if (type == SND_CTL_TLVT_DB_RANGE)
|
|
+ minsize = 4 * sizeof(int);
|
|
+ else
|
|
+ minsize = 2 * sizeof(int);
|
|
+ if (size < minsize) {
|
|
+ SNDERR("Invalid dB_scale TLV size");
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ if (size > MAX_TLV_RANGE_SIZE) {
|
|
+ SNDERR("Too big dB_scale TLV size: %d", size);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ *db_tlvp = tlv;
|
|
+ return size + sizeof(int) * 2;
|
|
+ }
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+ return -EINVAL; /* not found */
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Get the dB min/max values
|
|
+ * \param tlv the TLV source returned by #snd_tlv_parse_dB_info()
|
|
+ * \param rangemin the minimum value of the raw volume
|
|
+ * \param rangemax the maximum value of the raw volume
|
|
+ * \param min the pointer to store the minimum dB value (in 0.01dB unit)
|
|
+ * \param max the pointer to store the maximum dB value (in 0.01dB unit)
|
|
+ * \return 0 if successful, or a negative error code
|
|
+ */
|
|
+int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
|
|
+ long *min, long *max)
|
|
+{
|
|
+ int err;
|
|
+
|
|
+ switch (tlv[0]) {
|
|
+ case SND_CTL_TLVT_DB_RANGE: {
|
|
+ unsigned int pos, len;
|
|
+ len = int_index(tlv[1]);
|
|
+ if (len > MAX_TLV_RANGE_SIZE)
|
|
+ return -EINVAL;
|
|
+ pos = 2;
|
|
+ while (pos + 4 <= len) {
|
|
+ long rmin, rmax;
|
|
+ rangemin = (int)tlv[pos];
|
|
+ rangemax = (int)tlv[pos + 1];
|
|
+ err = snd_tlv_get_dB_range(tlv + pos + 2,
|
|
+ rangemin, rangemax,
|
|
+ &rmin, &rmax);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ if (pos > 2) {
|
|
+ if (rmin < *min)
|
|
+ *min = rmin;
|
|
+ if (rmax > *max)
|
|
+ *max = rmax;
|
|
+ } else {
|
|
+ *min = rmin;
|
|
+ *max = rmax;
|
|
+ }
|
|
+ pos += int_index(tlv[pos + 3]) + 4;
|
|
+ }
|
|
+ return 0;
|
|
+ }
|
|
+ case SND_CTL_TLVT_DB_SCALE: {
|
|
+ int step;
|
|
+ *min = (int)tlv[2];
|
|
+ step = (tlv[3] & 0xffff);
|
|
+ *max = *min + (long)(step * (rangemax - rangemin));
|
|
+ return 0;
|
|
+ }
|
|
+ case SND_CTL_TLVT_DB_LINEAR:
|
|
+ *min = (int)tlv[2];
|
|
+ *max = (int)tlv[3];
|
|
+ return 0;
|
|
+ }
|
|
+ return -EINVAL;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Convert the given raw volume value to a dB gain
|
|
+ * \param tlv the TLV source returned by #snd_tlv_parse_dB_info()
|
|
+ * \param rangemin the minimum value of the raw volume
|
|
+ * \param rangemax the maximum value of the raw volume
|
|
+ * \param volume the raw volume value to convert
|
|
+ * \param db_gain the dB gain (in 0.01dB unit)
|
|
+ * \return 0 if successful, or a negative error code
|
|
+ */
|
|
+int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
|
|
+ long volume, long *db_gain)
|
|
+{
|
|
+ switch (tlv[0]) {
|
|
+ case SND_CTL_TLVT_DB_RANGE: {
|
|
+ unsigned int pos, len;
|
|
+ len = int_index(tlv[1]);
|
|
+ if (len > MAX_TLV_RANGE_SIZE)
|
|
+ return -EINVAL;
|
|
+ pos = 2;
|
|
+ while (pos + 4 <= len) {
|
|
+ rangemin = (int)tlv[pos];
|
|
+ rangemax = (int)tlv[pos + 1];
|
|
+ if (volume >= rangemin && volume <= rangemax)
|
|
+ return snd_tlv_convert_to_dB(tlv + pos + 2,
|
|
+ rangemin, rangemax,
|
|
+ volume, db_gain);
|
|
+ pos += int_index(tlv[pos + 3]) + 4;
|
|
+ }
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ case SND_CTL_TLVT_DB_SCALE: {
|
|
+ int min, step, mute;
|
|
+ min = tlv[2];
|
|
+ step = (tlv[3] & 0xffff);
|
|
+ mute = (tlv[3] >> 16) & 1;
|
|
+ if (mute && volume == rangemin)
|
|
+ *db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
|
|
+ else
|
|
+ *db_gain = (volume - rangemin) * step + min;
|
|
+ return 0;
|
|
+ }
|
|
+#ifndef HAVE_SOFT_FLOAT
|
|
+ case SND_CTL_TLVT_DB_LINEAR: {
|
|
+ int mindb = tlv[2];
|
|
+ int maxdb = tlv[3];
|
|
+ if (volume <= rangemin || rangemax <= rangemin)
|
|
+ *db_gain = mindb;
|
|
+ else if (volume >= rangemax)
|
|
+ *db_gain = maxdb;
|
|
+ else {
|
|
+ double val = (double)(volume - rangemin) /
|
|
+ (double)(rangemax - rangemin);
|
|
+ if (mindb <= SND_CTL_TLV_DB_GAIN_MUTE)
|
|
+ *db_gain = (long)(100.0 * 20.0 * log10(val)) +
|
|
+ maxdb;
|
|
+ else {
|
|
+ /* FIXME: precalculate and cache these values */
|
|
+ double lmin = pow(10.0, mindb/2000.0);
|
|
+ double lmax = pow(10.0, maxdb/2000.0);
|
|
+ val = (lmax - lmin) * val + lmin;
|
|
+ *db_gain = (long)(100.0 * 20.0 * log10(val));
|
|
+ }
|
|
+ }
|
|
+ return 0;
|
|
+ }
|
|
+#endif
|
|
+ }
|
|
+ return -EINVAL;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Convert from dB gain to the corresponding raw value
|
|
+ * \param tlv the TLV source returned by #snd_tlv_parse_dB_info()
|
|
+ * \param rangemin the minimum value of the raw volume
|
|
+ * \param rangemax the maximum value of the raw volume
|
|
+ * \param db_gain the dB gain to convert (in 0.01dB unit)
|
|
+ * \param value the pointer to store the converted raw volume value
|
|
+ * \param xdir the direction for round-up. The value is round up
|
|
+ * when this is positive.
|
|
+ * \return 0 if successful, or a negative error code
|
|
+ */
|
|
+int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
|
|
+ long db_gain, long *value, int xdir)
|
|
+{
|
|
+ switch (tlv[0]) {
|
|
+ case SND_CTL_TLVT_DB_RANGE: {
|
|
+ unsigned int pos, len;
|
|
+ len = int_index(tlv[1]);
|
|
+ if (len > MAX_TLV_RANGE_SIZE)
|
|
+ return -EINVAL;
|
|
+ pos = 2;
|
|
+ while (pos + 4 <= len) {
|
|
+ long dbmin, dbmax;
|
|
+ rangemin = (int)tlv[pos];
|
|
+ rangemax = (int)tlv[pos + 1];
|
|
+ if (!snd_tlv_get_dB_range(tlv + pos + 2,
|
|
+ rangemin, rangemax,
|
|
+ &dbmin, &dbmax) &&
|
|
+ db_gain >= dbmin && db_gain <= dbmax)
|
|
+ return snd_tlv_convert_from_dB(tlv + pos + 2,
|
|
+ rangemin, rangemax,
|
|
+ db_gain, value, xdir);
|
|
+ pos += int_index(tlv[pos + 3]) + 4;
|
|
+ }
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ case SND_CTL_TLVT_DB_SCALE: {
|
|
+ int min, step, max;
|
|
+ min = tlv[2];
|
|
+ step = (tlv[3] & 0xffff);
|
|
+ max = min + (int)(step * (rangemax - rangemin));
|
|
+ if (db_gain <= min)
|
|
+ *value = rangemin;
|
|
+ else if (db_gain >= max)
|
|
+ *value = rangemax;
|
|
+ else {
|
|
+ long v = (db_gain - min) * (rangemax - rangemin);
|
|
+ if (xdir > 0)
|
|
+ v += (max - min) - 1;
|
|
+ v = v / (max - min) + rangemin;
|
|
+ *value = v;
|
|
+ }
|
|
+ return 0;
|
|
+ }
|
|
+#ifndef HAVE_SOFT_FLOAT
|
|
+ case SND_CTL_TLVT_DB_LINEAR: {
|
|
+ int min, max;
|
|
+ min = tlv[2];
|
|
+ max = tlv[3];
|
|
+ if (db_gain <= min)
|
|
+ *value = rangemin;
|
|
+ else if (db_gain >= max)
|
|
+ *value = rangemax;
|
|
+ else {
|
|
+ /* FIXME: precalculate and cache vmin and vmax */
|
|
+ double vmin, vmax, v;
|
|
+ vmin = (min <= SND_CTL_TLV_DB_GAIN_MUTE) ? 0.0 :
|
|
+ pow(10.0, (double)min / 2000.0);
|
|
+ vmax = !max ? 1.0 : pow(10.0, (double)max / 2000.0);
|
|
+ v = pow(10.0, (double)db_gain / 2000.0);
|
|
+ v = (v - vmin) * (rangemax - rangemin) / (vmax - vmin);
|
|
+ if (xdir > 0)
|
|
+ v = ceil(v);
|
|
+ *value = (long)v + rangemin;
|
|
+ }
|
|
+ return 0;
|
|
+ }
|
|
+#endif
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+ return -EINVAL;
|
|
+}
|
|
+
|
|
+#ifndef DOC_HIDDEN
|
|
+#define TEMP_TLV_SIZE 4096
|
|
+struct tlv_info {
|
|
+ long minval, maxval;
|
|
+ unsigned int *tlv;
|
|
+ unsigned int buf[TEMP_TLV_SIZE];
|
|
+};
|
|
+#endif
|
|
+
|
|
+static int get_tlv_info(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
|
+ struct tlv_info *rec)
|
|
+{
|
|
+ snd_ctl_elem_info_t *info;
|
|
+ int err;
|
|
+
|
|
+ snd_ctl_elem_info_alloca(&info);
|
|
+ snd_ctl_elem_info_set_id(info, id);
|
|
+ err = snd_ctl_elem_info(ctl, info);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ if (!snd_ctl_elem_info_is_tlv_readable(info))
|
|
+ return -EINVAL;
|
|
+ if (snd_ctl_elem_info_get_type(info) != SND_CTL_ELEM_TYPE_INTEGER)
|
|
+ return -EINVAL;
|
|
+ rec->minval = snd_ctl_elem_info_get_min(info);
|
|
+ rec->maxval = snd_ctl_elem_info_get_max(info);
|
|
+ err = snd_ctl_elem_tlv_read(ctl, id, rec->buf, sizeof(rec->buf));
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ err = snd_tlv_parse_dB_info(rec->buf, sizeof(rec->buf), &rec->tlv);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Get the dB min/max values on the given control element
|
|
+ * \param ctl the control handler
|
|
+ * \param id the element id
|
|
+ * \param volume the raw volume value to convert
|
|
+ * \param min the pointer to store the minimum dB value (in 0.01dB unit)
|
|
+ * \param max the pointer to store the maximum dB value (in 0.01dB unit)
|
|
+ * \return 0 if successful, or a negative error code
|
|
+ */
|
|
+int snd_ctl_get_dB_range(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
|
+ long *min, long *max)
|
|
+{
|
|
+ struct tlv_info info;
|
|
+ int err;
|
|
+
|
|
+ err = get_tlv_info(ctl, id, &info);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ return snd_tlv_get_dB_range(info.tlv, info.minval, info.maxval,
|
|
+ min, max);
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Convert the volume value to dB on the given control element
|
|
+ * \param ctl the control handler
|
|
+ * \param id the element id
|
|
+ * \param volume the raw volume value to convert
|
|
+ * \param db_gain the dB gain (in 0.01dB unit)
|
|
+ * \return 0 if successful, or a negative error code
|
|
+ */
|
|
+int snd_ctl_convert_to_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
|
+ long volume, long *db_gain)
|
|
+{
|
|
+ struct tlv_info info;
|
|
+ int err;
|
|
+
|
|
+ err = get_tlv_info(ctl, id, &info);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ return snd_tlv_convert_to_dB(info.tlv, info.minval, info.maxval,
|
|
+ volume, db_gain);
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Convert from dB gain to the raw volume value on the given control element
|
|
+ * \param ctl the control handler
|
|
+ * \param id the element id
|
|
+ * \param db_gain the dB gain to convert (in 0.01dB unit)
|
|
+ * \param value the pointer to store the converted raw volume value
|
|
+ * \param xdir the direction for round-up. The value is round up
|
|
+ * when this is positive.
|
|
+ * \return 0 if successful, or a negative error code
|
|
+ */
|
|
+int snd_ctl_convert_from_dB(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
|
|
+ long db_gain, long *value, int xdir)
|
|
+{
|
|
+ struct tlv_info info;
|
|
+ int err;
|
|
+
|
|
+ err = get_tlv_info(ctl, id, &info);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ return snd_tlv_convert_from_dB(info.tlv, info.minval, info.maxval,
|
|
+ db_gain, value, xdir);
|
|
+}
|
|
diff -r 9e2f117f24b9 src/error.c
|
|
--- a/src/error.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/error.c Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -135,8 +135,11 @@ static void snd_err_msg_default(const ch
|
|
fprintf(stderr, ": %s", snd_strerror(err));
|
|
putc('\n', stderr);
|
|
va_end(arg);
|
|
- if (! strcmp(verbose, "assert") || atoi(verbose) > 1)
|
|
+#ifdef ALSA_DEBUG_ASSERT
|
|
+ verbose = getenv("LIBASOUND_DEBUG_ASSERT");
|
|
+ if (verbose && *verbose)
|
|
assert(0);
|
|
+#endif
|
|
}
|
|
|
|
/**
|
|
diff -r 9e2f117f24b9 src/mixer/mixer_simple.h
|
|
--- a/src/mixer/mixer_simple.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/mixer/mixer_simple.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -21,5 +21,11 @@
|
|
|
|
#include "mixer_abst.h"
|
|
|
|
+/* make local functions really local */
|
|
+#define snd_mixer_simple_none_register \
|
|
+ snd1_mixer_simple_none_register
|
|
+#define snd_mixer_simple_basic_register \
|
|
+ snd1_mixer_simple_basic_register
|
|
+
|
|
int snd_mixer_simple_none_register(snd_mixer_t *mixer, struct snd_mixer_selem_regopt *options, snd_mixer_class_t **classp);
|
|
int snd_mixer_simple_basic_register(snd_mixer_t *mixer, struct snd_mixer_selem_regopt *options, snd_mixer_class_t **classp);
|
|
diff -r 9e2f117f24b9 src/mixer/simple_none.c
|
|
--- a/src/mixer/simple_none.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/mixer/simple_none.c Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -35,7 +35,9 @@
|
|
#include <string.h>
|
|
#include <fcntl.h>
|
|
#include <sys/ioctl.h>
|
|
+#include <assert.h>
|
|
#include <math.h>
|
|
+#include <limits.h>
|
|
#include <alsa/asoundlib.h>
|
|
#include "mixer_simple.h"
|
|
|
|
@@ -671,9 +673,11 @@ static int simple_update(snd_mixer_elem_
|
|
|
|
caps = 0;
|
|
pchannels = 0;
|
|
- pmin = pmax = 0;
|
|
+ pmin = LONG_MAX;
|
|
+ pmax = LONG_MIN;
|
|
cchannels = 0;
|
|
- cmin = cmax = 0;
|
|
+ cmin = LONG_MAX;
|
|
+ cmax = LONG_MIN;
|
|
assert(snd_mixer_elem_get_type(melem) == SND_MIXER_ELEM_SIMPLE);
|
|
simple = snd_mixer_elem_get_private(melem);
|
|
name = snd_mixer_selem_get_name(melem);
|
|
@@ -867,13 +871,13 @@ static int simple_update(snd_mixer_elem_
|
|
simple->selem.caps = caps;
|
|
simple->str[SM_PLAY].channels = pchannels;
|
|
if (!simple->str[SM_PLAY].range) {
|
|
- simple->str[SM_PLAY].min = pmin;
|
|
- simple->str[SM_PLAY].max = pmax;
|
|
+ simple->str[SM_PLAY].min = pmin != LONG_MAX ? pmin : 0;
|
|
+ simple->str[SM_PLAY].max = pmax != LONG_MIN ? pmax : 0;
|
|
}
|
|
simple->str[SM_CAPT].channels = cchannels;
|
|
if (!simple->str[SM_CAPT].range) {
|
|
- simple->str[SM_CAPT].min = cmin;
|
|
- simple->str[SM_CAPT].max = cmax;
|
|
+ simple->str[SM_CAPT].min = cmin != LONG_MAX ? cmin : 0;
|
|
+ simple->str[SM_CAPT].max = cmax != LONG_MIN ? cmax : 0;
|
|
}
|
|
return 0;
|
|
}
|
|
@@ -1068,150 +1072,13 @@ static int get_volume_ops(snd_mixer_elem
|
|
|
|
static int init_db_range(snd_hctl_elem_t *ctl, struct selem_str *rec);
|
|
|
|
-/* convert to index of integer array */
|
|
-#ifndef DOC_HIDDEN
|
|
-#define int_index(size) (((size) + sizeof(int) - 1) / sizeof(int))
|
|
-#endif
|
|
-
|
|
-/* max size of a TLV entry for dB information (including compound one) */
|
|
-#ifndef DOC_HIDDEN
|
|
-#define MAX_TLV_RANGE_SIZE 256
|
|
-#endif
|
|
-
|
|
-/* parse TLV stream and retrieve dB information
|
|
- * return 0 if successly found and stored to rec,
|
|
- * return 1 if no information is found,
|
|
- * or return a negative error code
|
|
- */
|
|
-static int parse_db_range(struct selem_str *rec, unsigned int *tlv,
|
|
- unsigned int tlv_size)
|
|
-{
|
|
- unsigned int type;
|
|
- unsigned int size;
|
|
- int err;
|
|
-
|
|
- type = tlv[0];
|
|
- size = tlv[1];
|
|
- tlv_size -= 2 * sizeof(int);
|
|
- if (size > tlv_size) {
|
|
- SNDERR("TLV size error");
|
|
- return -EINVAL;
|
|
- }
|
|
- switch (type) {
|
|
- case SND_CTL_TLVT_CONTAINER:
|
|
- size = int_index(size) * sizeof(int);
|
|
- tlv += 2;
|
|
- while (size > 0) {
|
|
- unsigned int len;
|
|
- err = parse_db_range(rec, tlv, size);
|
|
- if (err <= 0)
|
|
- return err; /* error or found dB */
|
|
- len = int_index(tlv[1]) + 2;
|
|
- size -= len * sizeof(int);
|
|
- tlv += len;
|
|
- }
|
|
- break;
|
|
- case SND_CTL_TLVT_DB_SCALE:
|
|
-#ifndef HAVE_SOFT_FLOAT
|
|
- case SND_CTL_TLVT_DB_LINEAR:
|
|
-#endif
|
|
- case SND_CTL_TLVT_DB_RANGE: {
|
|
- unsigned int minsize;
|
|
- if (type == SND_CTL_TLVT_DB_RANGE)
|
|
- minsize = 4 * sizeof(int);
|
|
- else
|
|
- minsize = 2 * sizeof(int);
|
|
- if (size < minsize) {
|
|
- SNDERR("Invalid dB_scale TLV size");
|
|
- return -EINVAL;
|
|
- }
|
|
- if (size > MAX_TLV_RANGE_SIZE) {
|
|
- SNDERR("Too big dB_scale TLV size: %d", size);
|
|
- return -EINVAL;
|
|
- }
|
|
- rec->db_info = malloc(size + sizeof(int) * 2);
|
|
- if (! rec->db_info)
|
|
- return -ENOMEM;
|
|
- memcpy(rec->db_info, tlv, size + sizeof(int) * 2);
|
|
- return 0;
|
|
- }
|
|
- default:
|
|
- break;
|
|
- }
|
|
- return -EINVAL; /* not found */
|
|
-}
|
|
-
|
|
-/* convert the given raw volume value to a dB gain
|
|
- */
|
|
-
|
|
-static int do_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
|
|
- long volume, long *db_gain)
|
|
-{
|
|
- switch (tlv[0]) {
|
|
- case SND_CTL_TLVT_DB_RANGE: {
|
|
- unsigned int pos, len;
|
|
- len = int_index(tlv[1]);
|
|
- if (len > MAX_TLV_RANGE_SIZE)
|
|
- return -EINVAL;
|
|
- pos = 2;
|
|
- while (pos + 4 <= len) {
|
|
- rangemin = (int)tlv[pos];
|
|
- rangemax = (int)tlv[pos + 1];
|
|
- if (volume >= rangemin && volume <= rangemax)
|
|
- return do_convert_to_dB(tlv + pos + 2,
|
|
- rangemin, rangemax,
|
|
- volume, db_gain);
|
|
- pos += int_index(tlv[pos + 3]) + 4;
|
|
- }
|
|
- return -EINVAL;
|
|
- }
|
|
- case SND_CTL_TLVT_DB_SCALE: {
|
|
- int min, step, mute;
|
|
- min = tlv[2];
|
|
- step = (tlv[3] & 0xffff);
|
|
- mute = (tlv[3] >> 16) & 1;
|
|
- if (mute && volume == rangemin)
|
|
- *db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
|
|
- else
|
|
- *db_gain = (volume - rangemin) * step + min;
|
|
- return 0;
|
|
- }
|
|
-#ifndef HAVE_SOFT_FLOAT
|
|
- case SND_CTL_TLVT_DB_LINEAR: {
|
|
- int mindb = tlv[2];
|
|
- int maxdb = tlv[3];
|
|
- if (volume <= rangemin || rangemax <= rangemin)
|
|
- *db_gain = mindb;
|
|
- else if (volume >= rangemax)
|
|
- *db_gain = maxdb;
|
|
- else {
|
|
- double val = (double)(volume - rangemin) /
|
|
- (double)(rangemax - rangemin);
|
|
- if (mindb <= SND_CTL_TLV_DB_GAIN_MUTE)
|
|
- *db_gain = (long)(100.0 * 20.0 * log10(val)) +
|
|
- maxdb;
|
|
- else {
|
|
- /* FIXME: precalculate and cache these values */
|
|
- double lmin = pow(10.0, mindb/2000.0);
|
|
- double lmax = pow(10.0, maxdb/2000.0);
|
|
- val = (lmax - lmin) * val + lmin;
|
|
- *db_gain = (long)(100.0 * 20.0 * log10(val));
|
|
- }
|
|
- }
|
|
- return 0;
|
|
- }
|
|
-#endif
|
|
- }
|
|
- return -EINVAL;
|
|
-}
|
|
-
|
|
static int convert_to_dB(snd_hctl_elem_t *ctl, struct selem_str *rec,
|
|
long volume, long *db_gain)
|
|
{
|
|
if (init_db_range(ctl, rec) < 0)
|
|
return -EINVAL;
|
|
- return do_convert_to_dB(rec->db_info, rec->min, rec->max,
|
|
- volume, db_gain);
|
|
+ return snd_tlv_convert_to_dB(rec->db_info, rec->min, rec->max,
|
|
+ volume, db_gain);
|
|
}
|
|
|
|
/* initialize dB range information, reading TLV via hcontrol
|
|
@@ -1221,6 +1088,8 @@ static int init_db_range(snd_hctl_elem_t
|
|
snd_ctl_elem_info_t *info;
|
|
unsigned int *tlv = NULL;
|
|
const unsigned int tlv_size = 4096;
|
|
+ unsigned int *dbrec;
|
|
+ int db_size;
|
|
|
|
if (rec->db_init_error)
|
|
return -EINVAL;
|
|
@@ -1237,8 +1106,13 @@ static int init_db_range(snd_hctl_elem_t
|
|
return -ENOMEM;
|
|
if (snd_hctl_elem_tlv_read(ctl, tlv, tlv_size) < 0)
|
|
goto error;
|
|
- if (parse_db_range(rec, tlv, tlv_size) < 0)
|
|
+ db_size = snd_tlv_parse_dB_info(tlv, tlv_size, &dbrec);
|
|
+ if (db_size < 0)
|
|
goto error;
|
|
+ rec->db_info = malloc(db_size);
|
|
+ if (!rec->db_info)
|
|
+ goto error;
|
|
+ memcpy(rec->db_info, dbrec, db_size);
|
|
free(tlv);
|
|
rec->db_initialized = 1;
|
|
return 0;
|
|
@@ -1269,59 +1143,13 @@ static selem_ctl_t *get_selem_ctl(selem_
|
|
return c;
|
|
}
|
|
|
|
-/* Get the dB min/max values
|
|
- */
|
|
-static int do_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
|
|
- long *min, long *max)
|
|
-{
|
|
- switch (tlv[0]) {
|
|
- case SND_CTL_TLVT_DB_RANGE: {
|
|
- unsigned int pos, len;
|
|
- len = int_index(tlv[1]);
|
|
- if (len > MAX_TLV_RANGE_SIZE)
|
|
- return -EINVAL;
|
|
- pos = 2;
|
|
- while (pos + 4 <= len) {
|
|
- long rmin, rmax;
|
|
- rangemin = (int)tlv[pos];
|
|
- rangemax = (int)tlv[pos + 1];
|
|
- do_get_dB_range(tlv + pos + 2, rangemin, rangemax,
|
|
- &rmin, &rmax);
|
|
- if (pos > 2) {
|
|
- if (rmin < *min)
|
|
- *min = rmin;
|
|
- if (rmax > *max)
|
|
- *max = rmax;
|
|
- } else {
|
|
- *min = rmin;
|
|
- *max = rmax;
|
|
- }
|
|
- pos += int_index(tlv[pos + 3]) + 4;
|
|
- }
|
|
- return 0;
|
|
- }
|
|
- case SND_CTL_TLVT_DB_SCALE: {
|
|
- int step;
|
|
- *min = (int)tlv[2];
|
|
- step = (tlv[3] & 0xffff);
|
|
- *max = *min + (long)(step * (rangemax - rangemin));
|
|
- return 0;
|
|
- }
|
|
- case SND_CTL_TLVT_DB_LINEAR:
|
|
- *min = (int)tlv[2];
|
|
- *max = (int)tlv[3];
|
|
- return 0;
|
|
- }
|
|
- return -EINVAL;
|
|
-}
|
|
-
|
|
static int get_dB_range(snd_hctl_elem_t *ctl, struct selem_str *rec,
|
|
long *min, long *max)
|
|
{
|
|
if (init_db_range(ctl, rec) < 0)
|
|
return -EINVAL;
|
|
|
|
- return do_get_dB_range(rec->db_info, rec->min, rec->max, min, max);
|
|
+ return snd_tlv_get_dB_range(rec->db_info, rec->min, rec->max, min, max);
|
|
}
|
|
|
|
static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir,
|
|
@@ -1336,89 +1164,14 @@ static int get_dB_range_ops(snd_mixer_el
|
|
return get_dB_range(c->elem, &s->str[dir], min, max);
|
|
}
|
|
|
|
-/* Convert from dB gain to the corresponding raw value.
|
|
- * The value is round up when xdir > 0.
|
|
- */
|
|
-static int do_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
|
|
- long db_gain, long *value, int xdir)
|
|
-{
|
|
- switch (tlv[0]) {
|
|
- case SND_CTL_TLVT_DB_RANGE: {
|
|
- unsigned int pos, len;
|
|
- len = int_index(tlv[1]);
|
|
- if (len > MAX_TLV_RANGE_SIZE)
|
|
- return -EINVAL;
|
|
- pos = 2;
|
|
- while (pos + 4 <= len) {
|
|
- long dbmin, dbmax;
|
|
- rangemin = (int)tlv[pos];
|
|
- rangemax = (int)tlv[pos + 1];
|
|
- if (! do_get_dB_range(tlv + pos + 2, rangemin, rangemax,
|
|
- &dbmin, &dbmax) &&
|
|
- db_gain >= dbmin && db_gain <= dbmax)
|
|
- return do_convert_from_dB(tlv + pos + 2,
|
|
- rangemin, rangemax,
|
|
- db_gain, value, xdir);
|
|
- pos += int_index(tlv[pos + 3]) + 4;
|
|
- }
|
|
- return -EINVAL;
|
|
- }
|
|
- case SND_CTL_TLVT_DB_SCALE: {
|
|
- int min, step, max;
|
|
- min = tlv[2];
|
|
- step = (tlv[3] & 0xffff);
|
|
- max = min + (int)(step * (rangemax - rangemin));
|
|
- if (db_gain <= min)
|
|
- *value = rangemin;
|
|
- else if (db_gain >= max)
|
|
- *value = rangemax;
|
|
- else {
|
|
- long v = (db_gain - min) * (rangemax - rangemin);
|
|
- if (xdir > 0)
|
|
- v += (max - min) - 1;
|
|
- v = v / (max - min) + rangemin;
|
|
- *value = v;
|
|
- }
|
|
- return 0;
|
|
- }
|
|
-#ifndef HAVE_SOFT_FLOAT
|
|
- case SND_CTL_TLVT_DB_LINEAR: {
|
|
- int min, max;
|
|
- min = tlv[2];
|
|
- max = tlv[3];
|
|
- if (db_gain <= min)
|
|
- *value = rangemin;
|
|
- else if (db_gain >= max)
|
|
- *value = rangemax;
|
|
- else {
|
|
- /* FIXME: precalculate and cache vmin and vmax */
|
|
- double vmin, vmax, v;
|
|
- vmin = (min <= SND_CTL_TLV_DB_GAIN_MUTE) ? 0.0 :
|
|
- pow(10.0, (double)min / 2000.0);
|
|
- vmax = !max ? 1.0 : pow(10.0, (double)max / 2000.0);
|
|
- v = pow(10.0, (double)db_gain / 2000.0);
|
|
- v = (v - vmin) * (rangemax - rangemin) / (vmax - vmin);
|
|
- if (xdir > 0)
|
|
- v = ceil(v);
|
|
- *value = (long)v + rangemin;
|
|
- }
|
|
- return 0;
|
|
- }
|
|
-#endif
|
|
- default:
|
|
- break;
|
|
- }
|
|
- return -EINVAL;
|
|
-}
|
|
-
|
|
static int convert_from_dB(snd_hctl_elem_t *ctl, struct selem_str *rec,
|
|
long db_gain, long *value, int xdir)
|
|
{
|
|
if (init_db_range(ctl, rec) < 0)
|
|
return -EINVAL;
|
|
|
|
- return do_convert_from_dB(rec->db_info, rec->min, rec->max,
|
|
- db_gain, value, xdir);
|
|
+ return snd_tlv_convert_from_dB(rec->db_info, rec->min, rec->max,
|
|
+ db_gain, value, xdir);
|
|
}
|
|
|
|
static int get_dB_ops(snd_mixer_elem_t *elem,
|
|
diff -r 9e2f117f24b9 src/pcm/interval.h
|
|
--- a/src/pcm/interval.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/interval.h Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -42,6 +42,22 @@ int snd_interval_never_eq(const snd_inte
|
|
int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2);
|
|
#endif
|
|
|
|
+/* make local functions really local */
|
|
+#define snd_interval_add snd1_interval_add
|
|
+#define snd_interval_sub snd1_interval_sub
|
|
+#define snd_interval_mul snd1_interval_mul
|
|
+#define snd_interval_div snd1_interval_div
|
|
+#define snd_interval_muldiv snd1_interval_muldiv
|
|
+#define snd_interval_muldivk snd1_interval_muldivk
|
|
+#define snd_interval_mulkdiv snd1_interval_mulkdiv
|
|
+#define snd_interval_print snd1_interval_print
|
|
+#define snd_interval_refine_min snd1_interval_refine_min
|
|
+#define snd_interval_refine_max snd1_interval_refine_max
|
|
+#define snd_interval_refine snd1_interval_refine
|
|
+#define snd_interval_refine_first snd1_interval_refine_first
|
|
+#define snd_interval_refine_last snd1_interval_refine_last
|
|
+#define snd_interval_refine_set snd1_interval_refine_set
|
|
+
|
|
void snd_interval_add(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
|
|
void snd_interval_sub(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
|
|
void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
|
|
diff -r 9e2f117f24b9 src/pcm/pcm.c
|
|
--- a/src/pcm/pcm.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm.c Fri Dec 14 15:27:52 2007 +0100
|
|
@@ -2226,9 +2226,10 @@ int snd_pcm_free(snd_pcm_t *pcm)
|
|
return 0;
|
|
}
|
|
|
|
-int snd_pcm_open_slave(snd_pcm_t **pcmp, snd_config_t *root,
|
|
- snd_config_t *conf, snd_pcm_stream_t stream,
|
|
- int mode, snd_config_t *parent_conf)
|
|
+int snd_pcm_open_named_slave(snd_pcm_t **pcmp, const char *name,
|
|
+ snd_config_t *root,
|
|
+ snd_config_t *conf, snd_pcm_stream_t stream,
|
|
+ int mode, snd_config_t *parent_conf)
|
|
{
|
|
const char *str;
|
|
int hop;
|
|
@@ -2238,7 +2239,7 @@ int snd_pcm_open_slave(snd_pcm_t **pcmp,
|
|
if (snd_config_get_string(conf, &str) >= 0)
|
|
return snd_pcm_open_noupdate(pcmp, root, str, stream, mode,
|
|
hop + 1);
|
|
- return snd_pcm_open_conf(pcmp, NULL, root, conf, stream, mode);
|
|
+ return snd_pcm_open_conf(pcmp, name, root, conf, stream, mode);
|
|
}
|
|
#endif
|
|
|
|
@@ -5577,6 +5578,12 @@ int snd_pcm_sw_params_set_avail_min(snd_
|
|
#endif
|
|
{
|
|
assert(pcm && params);
|
|
+ /* Fix avail_min if it's below period size. The period_size
|
|
+ * defines the minimal wake-up timing accuracy, so it doesn't
|
|
+ * make sense to set below that.
|
|
+ */
|
|
+ if (val < pcm->period_size)
|
|
+ val = pcm->period_size;
|
|
params->avail_min = val;
|
|
return 0;
|
|
}
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_asym.c
|
|
--- a/src/pcm/pcm_asym.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_asym.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -109,7 +109,8 @@ int _snd_pcm_asym_open(snd_pcm_t **pcmp,
|
|
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
|
if (err < 0)
|
|
return err;
|
|
- err = snd_pcm_open_slave(pcmp, root, sconf, stream, mode, conf);
|
|
+ err = snd_pcm_open_named_slave(pcmp, name, root, sconf, stream,
|
|
+ mode, conf);
|
|
snd_config_delete(sconf);
|
|
return err;
|
|
}
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_direct.c
|
|
--- a/src/pcm/pcm_direct.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_direct.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -109,13 +109,15 @@ retryget:
|
|
}
|
|
dmix->shmptr = shmat(dmix->shmid, 0, 0);
|
|
if (dmix->shmptr == (void *) -1) {
|
|
+ err = -errno;
|
|
snd_pcm_direct_shm_discard(dmix);
|
|
- return -errno;
|
|
+ return err;
|
|
}
|
|
mlock(dmix->shmptr, sizeof(snd_pcm_direct_share_t));
|
|
if (shmctl(dmix->shmid, IPC_STAT, &buf) < 0) {
|
|
+ err = -errno;
|
|
snd_pcm_direct_shm_discard(dmix);
|
|
- return -errno;
|
|
+ return err;
|
|
}
|
|
if (buf.shm_nattch == 1) { /* we're the first user, clear the segment */
|
|
memset(dmix->shmptr, 0, sizeof(snd_pcm_direct_share_t));
|
|
@@ -128,7 +130,7 @@ retryget:
|
|
} else {
|
|
if (dmix->shmptr->magic != SND_PCM_DIRECT_MAGIC) {
|
|
snd_pcm_direct_shm_discard(dmix);
|
|
- return -errno;
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
return 0;
|
|
@@ -883,6 +885,7 @@ int snd_pcm_direct_initialize_slave(snd_
|
|
SND_PCM_FORMAT_S16,
|
|
SND_PCM_FORMAT_S16 ^ SND_PCM_FORMAT_S16_LE ^ SND_PCM_FORMAT_S16_BE,
|
|
SND_PCM_FORMAT_S24_3LE,
|
|
+ SND_PCM_FORMAT_U8,
|
|
};
|
|
snd_pcm_format_t format;
|
|
unsigned int i;
|
|
@@ -996,6 +999,17 @@ int snd_pcm_direct_initialize_slave(snd_
|
|
ret = snd_pcm_sw_params_set_stop_threshold(spcm, sw_params, boundary);
|
|
if (ret < 0) {
|
|
SNDERR("unable to set stop threshold");
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ /* set timestamp mode to MMAP
|
|
+ * the slave timestamp is copied appropriately in dsnoop/dmix/dshare
|
|
+ * based on the tstamp_mode of each client
|
|
+ */
|
|
+ ret = snd_pcm_sw_params_set_tstamp_mode(spcm, sw_params,
|
|
+ SND_PCM_TSTAMP_MMAP);
|
|
+ if (ret < 0) {
|
|
+ SNDERR("unable to tstamp mode MMAP");
|
|
return ret;
|
|
}
|
|
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_direct.h
|
|
--- a/src/pcm/pcm_direct.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_direct.h Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -24,20 +24,30 @@
|
|
#define DIRECT_IPC_SEMS 1
|
|
#define DIRECT_IPC_SEM_CLIENT 0
|
|
|
|
-typedef void (mix_areas1_t)(unsigned int size,
|
|
- volatile signed short *dst, signed short *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step);
|
|
+typedef void (mix_areas_t)(unsigned int size,
|
|
+ volatile void *dst, void *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step);
|
|
|
|
-typedef void (mix_areas2_t)(unsigned int size,
|
|
- volatile signed int *dst, signed int *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step);
|
|
+typedef void (mix_areas_16_t)(unsigned int size,
|
|
+ volatile signed short *dst, signed short *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step);
|
|
|
|
-typedef void (mix_areas3_t)(unsigned int size,
|
|
- volatile unsigned char *dst, unsigned char *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step);
|
|
+typedef void (mix_areas_32_t)(unsigned int size,
|
|
+ volatile signed int *dst, signed int *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step);
|
|
+
|
|
+typedef void (mix_areas_24_t)(unsigned int size,
|
|
+ volatile unsigned char *dst, unsigned char *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step);
|
|
+
|
|
+typedef void (mix_areas_u8_t)(unsigned int size,
|
|
+ volatile unsigned char *dst, unsigned char *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step);
|
|
|
|
struct slave_params {
|
|
snd_pcm_format_t format;
|
|
@@ -148,9 +158,10 @@ struct snd_pcm_direct {
|
|
struct {
|
|
int shmid_sum; /* IPC global sum ring buffer memory identification */
|
|
signed int *sum_buffer; /* shared sum buffer */
|
|
- mix_areas1_t *mix_areas1;
|
|
- mix_areas2_t *mix_areas2;
|
|
- mix_areas3_t *mix_areas3;
|
|
+ mix_areas_16_t *mix_areas_16;
|
|
+ mix_areas_32_t *mix_areas_32;
|
|
+ mix_areas_24_t *mix_areas_24;
|
|
+ mix_areas_u8_t *mix_areas_u8;
|
|
} dmix;
|
|
struct {
|
|
} dsnoop;
|
|
@@ -160,6 +171,66 @@ struct snd_pcm_direct {
|
|
} u;
|
|
void (*server_free)(snd_pcm_direct_t *direct);
|
|
};
|
|
+
|
|
+/* make local functions really local */
|
|
+#define snd_pcm_direct_semaphore_create_or_connect \
|
|
+ snd1_pcm_direct_semaphore_create_or_connect
|
|
+#define snd_pcm_direct_shm_create_or_connect \
|
|
+ snd1_pcm_direct_shm_create_or_connect
|
|
+#define snd_pcm_direct_shm_discard \
|
|
+ snd1_pcm_direct_shm_discard
|
|
+#define snd_pcm_direct_server_create \
|
|
+ snd1_pcm_direct_server_create
|
|
+#define snd_pcm_direct_server_discard \
|
|
+ snd1_pcm_direct_server_discard
|
|
+#define snd_pcm_direct_client_connect \
|
|
+ snd1_pcm_direct_client_connect
|
|
+#define snd_pcm_direct_client_discard \
|
|
+ snd1_pcm_direct_client_discard
|
|
+#define snd_pcm_direct_initialize_slave \
|
|
+ snd1_pcm_direct_initialize_slave
|
|
+#define snd_pcm_direct_initialize_secondary_slave \
|
|
+ snd1_pcm_direct_initialize_secondary_slave
|
|
+#define snd_pcm_direct_initialize_poll_fd \
|
|
+ snd1_pcm_direct_initialize_poll_fd
|
|
+#define snd_pcm_direct_check_interleave \
|
|
+ snd1_pcm_direct_check_interleave
|
|
+#define snd_pcm_direct_parse_bindings \
|
|
+ snd1_pcm_direct_parse_bindings
|
|
+#define snd_pcm_direct_nonblock \
|
|
+ snd1_pcm_direct_nonblock
|
|
+#define snd_pcm_direct_async \
|
|
+ snd1_pcm_direct_async
|
|
+#define snd_pcm_direct_poll_revents \
|
|
+ snd1_pcm_direct_poll_revents
|
|
+#define snd_pcm_direct_info \
|
|
+ snd1_pcm_direct_info
|
|
+#define snd_pcm_direct_hw_refine \
|
|
+ snd1_pcm_direct_hw_refine
|
|
+#define snd_pcm_direct_hw_params \
|
|
+ snd1_pcm_direct_hw_params
|
|
+#define snd_pcm_direct_hw_free \
|
|
+ snd1_pcm_direct_hw_free
|
|
+#define snd_pcm_direct_sw_params \
|
|
+ snd1_pcm_direct_sw_params
|
|
+#define snd_pcm_direct_channel_info \
|
|
+ snd1_pcm_direct_channel_info
|
|
+#define snd_pcm_direct_mmap \
|
|
+ snd1_pcm_direct_mmap
|
|
+#define snd_pcm_direct_munmap \
|
|
+ snd1_pcm_direct_munmap
|
|
+#define snd_pcm_direct_resume \
|
|
+ snd1_pcm_direct_resume
|
|
+#define snd_pcm_direct_timer_stop \
|
|
+ snd1_pcm_direct_timer_stop
|
|
+#define snd_pcm_direct_clear_timer_queue \
|
|
+ snd1_pcm_direct_clear_timer_queue
|
|
+#define snd_pcm_direct_set_timer_params \
|
|
+ snd1_pcm_direct_set_timer_params
|
|
+#define snd_pcm_direct_open_secondary_client \
|
|
+ snd1_pcm_direct_open_secondary_client
|
|
+#define snd_pcm_direct_parse_open_conf \
|
|
+ snd1_pcm_direct_parse_open_conf
|
|
|
|
int snd_pcm_direct_semaphore_create_or_connect(snd_pcm_direct_t *dmix);
|
|
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_dmix.c
|
|
--- a/src/pcm/pcm_dmix.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_dmix.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -156,95 +156,60 @@ static void mix_areas(snd_pcm_direct_t *
|
|
snd_pcm_uframes_t dst_ofs,
|
|
snd_pcm_uframes_t size)
|
|
{
|
|
- volatile signed int *sum;
|
|
unsigned int src_step, dst_step;
|
|
- unsigned int chn, dchn, channels;
|
|
+ unsigned int chn, dchn, channels, sample_size;
|
|
+ mix_areas_t *do_mix_areas;
|
|
|
|
channels = dmix->channels;
|
|
- if (dmix->shmptr->s.format == SND_PCM_FORMAT_S16_LE ||
|
|
- dmix->shmptr->s.format == SND_PCM_FORMAT_S16_BE) {
|
|
- signed short *src;
|
|
- volatile signed short *dst;
|
|
- if (dmix->interleaved) {
|
|
- /*
|
|
- * process all areas in one loop
|
|
- * it optimizes the memory accesses for this case
|
|
- */
|
|
- dmix->u.dmix.mix_areas1(size * channels,
|
|
- ((signed short *)dst_areas[0].addr) + (dst_ofs * channels),
|
|
- ((signed short *)src_areas[0].addr) + (src_ofs * channels),
|
|
- dmix->u.dmix.sum_buffer + (dst_ofs * channels),
|
|
- sizeof(signed short),
|
|
- sizeof(signed short),
|
|
- sizeof(signed int));
|
|
- return;
|
|
- }
|
|
- for (chn = 0; chn < channels; chn++) {
|
|
- dchn = dmix->bindings ? dmix->bindings[chn] : chn;
|
|
- if (dchn >= dmix->shmptr->s.channels)
|
|
- continue;
|
|
- src_step = src_areas[chn].step / 8;
|
|
- dst_step = dst_areas[dchn].step / 8;
|
|
- src = (signed short *)(((char *)src_areas[chn].addr + src_areas[chn].first / 8) + (src_ofs * src_step));
|
|
- dst = (signed short *)(((char *)dst_areas[dchn].addr + dst_areas[dchn].first / 8) + (dst_ofs * dst_step));
|
|
- sum = dmix->u.dmix.sum_buffer + channels * dst_ofs + chn;
|
|
- dmix->u.dmix.mix_areas1(size, dst, src, sum, dst_step, src_step, channels * sizeof(signed int));
|
|
- }
|
|
- } else if (dmix->shmptr->s.format == SND_PCM_FORMAT_S32_LE ||
|
|
- dmix->shmptr->s.format == SND_PCM_FORMAT_S32_BE) {
|
|
- signed int *src;
|
|
- volatile signed int *dst;
|
|
- if (dmix->interleaved) {
|
|
- /*
|
|
- * process all areas in one loop
|
|
- * it optimizes the memory accesses for this case
|
|
- */
|
|
- dmix->u.dmix.mix_areas2(size * channels,
|
|
- ((signed int *)dst_areas[0].addr) + (dst_ofs * channels),
|
|
- ((signed int *)src_areas[0].addr) + (src_ofs * channels),
|
|
- dmix->u.dmix.sum_buffer + (dst_ofs * channels),
|
|
- sizeof(signed int),
|
|
- sizeof(signed int),
|
|
- sizeof(signed int));
|
|
- return;
|
|
- }
|
|
- for (chn = 0; chn < channels; chn++) {
|
|
- dchn = dmix->bindings ? dmix->bindings[chn] : chn;
|
|
- if (dchn >= dmix->shmptr->s.channels)
|
|
- continue;
|
|
- src_step = src_areas[chn].step / 8;
|
|
- dst_step = dst_areas[dchn].step / 8;
|
|
- src = (signed int *)(((char *)src_areas[chn].addr + src_areas[chn].first / 8) + (src_ofs * src_step));
|
|
- dst = (signed int *)(((char *)dst_areas[dchn].addr + dst_areas[dchn].first / 8) + (dst_ofs * dst_step));
|
|
- sum = dmix->u.dmix.sum_buffer + channels * dst_ofs + chn;
|
|
- dmix->u.dmix.mix_areas2(size, dst, src, sum, dst_step, src_step, channels * sizeof(signed int));
|
|
- }
|
|
- } else { /* SND_PCM_FORMAT_S24_3LE */
|
|
- unsigned char *src;
|
|
- volatile unsigned char *dst;
|
|
- if (dmix->interleaved) {
|
|
- /*
|
|
- * process all areas in one loop
|
|
- * it optimizes the memory accesses for this case
|
|
- */
|
|
- dmix->u.dmix.mix_areas3(size * channels,
|
|
- ((unsigned char *)dst_areas[0].addr) + 3 * dst_ofs * channels,
|
|
- ((unsigned char *)src_areas[0].addr) + 3 * src_ofs * channels,
|
|
- dmix->u.dmix.sum_buffer + (dst_ofs * channels),
|
|
- 3, 3, sizeof(signed int));
|
|
- return;
|
|
- }
|
|
- for (chn = 0; chn < channels; chn++) {
|
|
- dchn = dmix->bindings ? dmix->bindings[chn] : chn;
|
|
- if (dchn >= dmix->shmptr->s.channels)
|
|
- continue;
|
|
- src_step = src_areas[chn].step / 8;
|
|
- dst_step = dst_areas[dchn].step / 8;
|
|
- src = (unsigned char *)(((char *)src_areas[chn].addr + src_areas[chn].first / 8) + (src_ofs * src_step));
|
|
- dst = (unsigned char *)(((char *)dst_areas[dchn].addr + dst_areas[dchn].first / 8) + (dst_ofs * dst_step));
|
|
- sum = dmix->u.dmix.sum_buffer + channels * dst_ofs + chn;
|
|
- dmix->u.dmix.mix_areas3(size, dst, src, sum, dst_step, src_step, channels * sizeof(signed int));
|
|
- }
|
|
+ switch (dmix->shmptr->s.format) {
|
|
+ case SND_PCM_FORMAT_S16_LE:
|
|
+ case SND_PCM_FORMAT_S16_BE:
|
|
+ sample_size = 2;
|
|
+ do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_16;
|
|
+ break;
|
|
+ case SND_PCM_FORMAT_S32_LE:
|
|
+ case SND_PCM_FORMAT_S32_BE:
|
|
+ sample_size = 4;
|
|
+ do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_32;
|
|
+ break;
|
|
+ case SND_PCM_FORMAT_S24_3LE:
|
|
+ sample_size = 3;
|
|
+ do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_24;
|
|
+ break;
|
|
+ case SND_PCM_FORMAT_U8:
|
|
+ sample_size = 1;
|
|
+ do_mix_areas = (mix_areas_t *)dmix->u.dmix.mix_areas_u8;
|
|
+ break;
|
|
+ default:
|
|
+ return;
|
|
+ }
|
|
+ if (dmix->interleaved) {
|
|
+ /*
|
|
+ * process all areas in one loop
|
|
+ * it optimizes the memory accesses for this case
|
|
+ */
|
|
+ do_mix_areas(size * channels,
|
|
+ (unsigned char *)dst_areas[0].addr + sample_size * dst_ofs * channels,
|
|
+ (unsigned char *)src_areas[0].addr + sample_size * src_ofs * channels,
|
|
+ dmix->u.dmix.sum_buffer + dst_ofs * channels,
|
|
+ sample_size,
|
|
+ sample_size,
|
|
+ sizeof(signed int));
|
|
+ return;
|
|
+ }
|
|
+ for (chn = 0; chn < channels; chn++) {
|
|
+ dchn = dmix->bindings ? dmix->bindings[chn] : chn;
|
|
+ if (dchn >= dmix->shmptr->s.channels)
|
|
+ continue;
|
|
+ src_step = src_areas[chn].step / 8;
|
|
+ dst_step = dst_areas[dchn].step / 8;
|
|
+ do_mix_areas(size,
|
|
+ ((unsigned char *)dst_areas[dchn].addr + dst_areas[dchn].first / 8) + dst_ofs * dst_step,
|
|
+ ((unsigned char *)src_areas[chn].addr + src_areas[chn].first / 8) + src_ofs * src_step,
|
|
+ dmix->u.dmix.sum_buffer + channels * dst_ofs + chn,
|
|
+ dst_step,
|
|
+ src_step,
|
|
+ channels * sizeof(signed int));
|
|
}
|
|
}
|
|
|
|
@@ -367,11 +332,8 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm
|
|
if (avail > dmix->avail_max)
|
|
dmix->avail_max = avail;
|
|
if (avail >= pcm->stop_threshold) {
|
|
- struct timeval tv;
|
|
snd_timer_stop(dmix->timer);
|
|
- gettimeofday(&tv, 0);
|
|
- dmix->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- dmix->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&dmix->trigger_tstamp);
|
|
if (dmix->state == SND_PCM_STATE_RUNNING) {
|
|
dmix->state = SND_PCM_STATE_XRUN;
|
|
return -EPIPE;
|
|
@@ -420,7 +382,10 @@ static int snd_pcm_dmix_status(snd_pcm_t
|
|
memset(status, 0, sizeof(*status));
|
|
status->state = snd_pcm_dmix_state(pcm);
|
|
status->trigger_tstamp = dmix->trigger_tstamp;
|
|
- status->tstamp = snd_pcm_hw_fast_tstamp(dmix->spcm);
|
|
+ if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
|
|
+ status->tstamp = snd_pcm_hw_fast_tstamp(dmix->spcm);
|
|
+ else
|
|
+ gettimestamp(&status->tstamp);
|
|
status->avail = snd_pcm_mmap_playback_avail(pcm);
|
|
status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max;
|
|
dmix->avail_max = 0;
|
|
@@ -525,7 +490,6 @@ static int snd_pcm_dmix_start(snd_pcm_t
|
|
{
|
|
snd_pcm_direct_t *dmix = pcm->private_data;
|
|
snd_pcm_sframes_t avail;
|
|
- struct timeval tv;
|
|
int err;
|
|
|
|
if (dmix->state != SND_PCM_STATE_PREPARED)
|
|
@@ -540,9 +504,7 @@ static int snd_pcm_dmix_start(snd_pcm_t
|
|
return err;
|
|
snd_pcm_dmix_sync_area(pcm);
|
|
}
|
|
- gettimeofday(&tv, 0);
|
|
- dmix->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- dmix->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&dmix->trigger_tstamp);
|
|
return 0;
|
|
}
|
|
|
|
@@ -652,9 +614,10 @@ static int snd_pcm_dmix_close(snd_pcm_t
|
|
if (dmix->client)
|
|
snd_pcm_direct_client_discard(dmix);
|
|
shm_sum_discard(dmix);
|
|
- if (snd_pcm_direct_shm_discard(dmix))
|
|
- snd_pcm_direct_semaphore_discard(dmix);
|
|
- else
|
|
+ if (snd_pcm_direct_shm_discard(dmix)) {
|
|
+ if (snd_pcm_direct_semaphore_discard(dmix))
|
|
+ snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
|
|
+ } else
|
|
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
|
|
free(dmix->bindings);
|
|
pcm->private_data = NULL;
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_dmix_generic.c
|
|
--- a/src/pcm/pcm_dmix_generic.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_dmix_generic.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -48,10 +48,10 @@ static inline unsigned long __cmpxchg(vo
|
|
#endif
|
|
|
|
#if IS_CONCURRENT
|
|
-static void mix_areas1(unsigned int size,
|
|
- volatile signed short *dst, signed short *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void mix_areas_16(unsigned int size,
|
|
+ volatile signed short *dst, signed short *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
register signed int sample, old_sample;
|
|
|
|
@@ -79,10 +79,10 @@ static void mix_areas1(unsigned int size
|
|
}
|
|
}
|
|
|
|
-static void mix_areas2(unsigned int size,
|
|
- volatile signed int *dst, signed int *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void mix_areas_32(unsigned int size,
|
|
+ volatile signed int *dst, signed int *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
register signed int sample, old_sample;
|
|
|
|
@@ -112,8 +112,8 @@ static void mix_areas2(unsigned int size
|
|
|
|
static void mix_select_callbacks(snd_pcm_direct_t *dmix)
|
|
{
|
|
- dmix->u.dmix.mix_areas1 = mix_areas1;
|
|
- dmix->u.dmix.mix_areas2 = mix_areas2;
|
|
+ dmix->u.dmix.mix_areas_16 = mix_areas_16;
|
|
+ dmix->u.dmix.mix_areas_32 = mix_areas_32;
|
|
}
|
|
|
|
#else
|
|
@@ -122,14 +122,18 @@ static void mix_select_callbacks(snd_pcm
|
|
#define generic_dmix_supported_format \
|
|
((1ULL << SND_PCM_FORMAT_S16_LE) | (1ULL << SND_PCM_FORMAT_S32_LE) |\
|
|
(1ULL << SND_PCM_FORMAT_S16_BE) | (1ULL << SND_PCM_FORMAT_S32_BE) |\
|
|
- (1ULL << SND_PCM_FORMAT_S24_3LE))
|
|
+ (1ULL << SND_PCM_FORMAT_S24_3LE) | \
|
|
+ (1ULL << SND_PCM_FORMAT_U8))
|
|
|
|
#include <byteswap.h>
|
|
|
|
-static void generic_mix_areas1_native(unsigned int size,
|
|
- volatile signed short *dst, signed short *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void generic_mix_areas_16_native(unsigned int size,
|
|
+ volatile signed short *dst,
|
|
+ signed short *src,
|
|
+ volatile signed int *sum,
|
|
+ size_t dst_step,
|
|
+ size_t src_step,
|
|
+ size_t sum_step)
|
|
{
|
|
register signed int sample;
|
|
|
|
@@ -155,10 +159,13 @@ static void generic_mix_areas1_native(un
|
|
}
|
|
}
|
|
|
|
-static void generic_mix_areas2_native(unsigned int size,
|
|
- volatile signed int *dst, signed int *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void generic_mix_areas_32_native(unsigned int size,
|
|
+ volatile signed int *dst,
|
|
+ signed int *src,
|
|
+ volatile signed int *sum,
|
|
+ size_t dst_step,
|
|
+ size_t src_step,
|
|
+ size_t sum_step)
|
|
{
|
|
register signed int sample;
|
|
|
|
@@ -186,10 +193,13 @@ static void generic_mix_areas2_native(un
|
|
}
|
|
}
|
|
|
|
-static void generic_mix_areas1_swap(unsigned int size,
|
|
- volatile signed short *dst, signed short *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void generic_mix_areas_16_swap(unsigned int size,
|
|
+ volatile signed short *dst,
|
|
+ signed short *src,
|
|
+ volatile signed int *sum,
|
|
+ size_t dst_step,
|
|
+ size_t src_step,
|
|
+ size_t sum_step)
|
|
{
|
|
register signed int sample;
|
|
|
|
@@ -215,10 +225,13 @@ static void generic_mix_areas1_swap(unsi
|
|
}
|
|
}
|
|
|
|
-static void generic_mix_areas2_swap(unsigned int size,
|
|
- volatile signed int *dst, signed int *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void generic_mix_areas_32_swap(unsigned int size,
|
|
+ volatile signed int *dst,
|
|
+ signed int *src,
|
|
+ volatile signed int *sum,
|
|
+ size_t dst_step,
|
|
+ size_t src_step,
|
|
+ size_t sum_step)
|
|
{
|
|
register signed int sample;
|
|
|
|
@@ -247,10 +260,13 @@ static void generic_mix_areas2_swap(unsi
|
|
}
|
|
|
|
/* always little endian */
|
|
-static void generic_mix_areas3(unsigned int size,
|
|
- volatile unsigned char *dst, unsigned char *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void generic_mix_areas_24(unsigned int size,
|
|
+ volatile unsigned char *dst,
|
|
+ unsigned char *src,
|
|
+ volatile signed int *sum,
|
|
+ size_t dst_step,
|
|
+ size_t src_step,
|
|
+ size_t sum_step)
|
|
{
|
|
register signed int sample;
|
|
|
|
@@ -277,17 +293,47 @@ static void generic_mix_areas3(unsigned
|
|
}
|
|
}
|
|
|
|
+static void generic_mix_areas_u8(unsigned int size,
|
|
+ volatile unsigned char *dst,
|
|
+ unsigned char *src,
|
|
+ volatile signed int *sum,
|
|
+ size_t dst_step,
|
|
+ size_t src_step,
|
|
+ size_t sum_step)
|
|
+{
|
|
+ for (;;) {
|
|
+ register int sample = *src - 0x80;
|
|
+ if (*dst == 0x80) {
|
|
+ *sum = sample;
|
|
+ } else {
|
|
+ sample += *sum;
|
|
+ *sum = sample;
|
|
+ if (sample > 0x7f)
|
|
+ sample = 0x7f;
|
|
+ else if (sample < -0x80)
|
|
+ sample = -0x80;
|
|
+ }
|
|
+ *dst = sample + 0x80;
|
|
+ if (!--size)
|
|
+ return;
|
|
+ dst += dst_step;
|
|
+ src += src_step;
|
|
+ sum = (signed int *) ((char *)sum + sum_step);
|
|
+ }
|
|
+}
|
|
+
|
|
|
|
static void generic_mix_select_callbacks(snd_pcm_direct_t *dmix)
|
|
{
|
|
if (snd_pcm_format_cpu_endian(dmix->shmptr->s.format)) {
|
|
- dmix->u.dmix.mix_areas1 = generic_mix_areas1_native;
|
|
- dmix->u.dmix.mix_areas2 = generic_mix_areas2_native;
|
|
+ dmix->u.dmix.mix_areas_16 = generic_mix_areas_16_native;
|
|
+ dmix->u.dmix.mix_areas_32 = generic_mix_areas_32_native;
|
|
} else {
|
|
- dmix->u.dmix.mix_areas1 = generic_mix_areas1_swap;
|
|
- dmix->u.dmix.mix_areas2 = generic_mix_areas2_swap;
|
|
+ dmix->u.dmix.mix_areas_16 = generic_mix_areas_16_swap;
|
|
+ dmix->u.dmix.mix_areas_32 = generic_mix_areas_32_swap;
|
|
}
|
|
- dmix->u.dmix.mix_areas3 = generic_mix_areas3;
|
|
+ dmix->u.dmix.mix_areas_24 = generic_mix_areas_24;
|
|
+ dmix->u.dmix.mix_areas_u8 = generic_mix_areas_u8;
|
|
}
|
|
|
|
#endif
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_dmix_i386.c
|
|
--- a/src/pcm/pcm_dmix_i386.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_dmix_i386.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -2,32 +2,32 @@
|
|
* optimized mixing code for i386
|
|
*/
|
|
|
|
-#define MIX_AREAS1 mix_areas1
|
|
-#define MIX_AREAS1_MMX mix_areas1_mmx
|
|
-#define MIX_AREAS2 mix_areas2
|
|
-#define MIX_AREAS3 mix_areas3
|
|
-#define MIX_AREAS3_CMOV mix_areas3_cmov
|
|
+#define MIX_AREAS_16 mix_areas_16
|
|
+#define MIX_AREAS_16_MMX mix_areas_16_mmx
|
|
+#define MIX_AREAS_32 mix_areas_32
|
|
+#define MIX_AREAS_24 mix_areas_24
|
|
+#define MIX_AREAS_24_CMOV mix_areas_24_cmov
|
|
#define LOCK_PREFIX ""
|
|
#include "pcm_dmix_i386.h"
|
|
-#undef MIX_AREAS1
|
|
-#undef MIX_AREAS1_MMX
|
|
-#undef MIX_AREAS2
|
|
-#undef MIX_AREAS3
|
|
-#undef MIX_AREAS3_CMOV
|
|
+#undef MIX_AREAS_16
|
|
+#undef MIX_AREAS_16_MMX
|
|
+#undef MIX_AREAS_32
|
|
+#undef MIX_AREAS_24
|
|
+#undef MIX_AREAS_24_CMOV
|
|
#undef LOCK_PREFIX
|
|
|
|
-#define MIX_AREAS1 mix_areas1_smp
|
|
-#define MIX_AREAS1_MMX mix_areas1_smp_mmx
|
|
-#define MIX_AREAS2 mix_areas2_smp
|
|
-#define MIX_AREAS3 mix_areas3_smp
|
|
-#define MIX_AREAS3_CMOV mix_areas3_smp_cmov
|
|
+#define MIX_AREAS_16 mix_areas_16_smp
|
|
+#define MIX_AREAS_16_MMX mix_areas_16_smp_mmx
|
|
+#define MIX_AREAS_32 mix_areas_32_smp
|
|
+#define MIX_AREAS_24 mix_areas_24_smp
|
|
+#define MIX_AREAS_24_CMOV mix_areas_24_smp_cmov
|
|
#define LOCK_PREFIX "lock ; "
|
|
#include "pcm_dmix_i386.h"
|
|
-#undef MIX_AREAS1
|
|
-#undef MIX_AREAS1_MMX
|
|
-#undef MIX_AREAS2
|
|
-#undef MIX_AREAS3
|
|
-#undef MIX_AREAS3_CMOV
|
|
+#undef MIX_AREAS_16
|
|
+#undef MIX_AREAS_16_MMX
|
|
+#undef MIX_AREAS_32
|
|
+#undef MIX_AREAS_24
|
|
+#undef MIX_AREAS_24_CMOV
|
|
#undef LOCK_PREFIX
|
|
|
|
#define i386_dmix_supported_format \
|
|
@@ -70,14 +70,14 @@ static void mix_select_callbacks(snd_pcm
|
|
}
|
|
|
|
if (mmx) {
|
|
- dmix->u.dmix.mix_areas1 = smp > 1 ? mix_areas1_smp_mmx : mix_areas1_mmx;
|
|
+ dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp_mmx : mix_areas_16_mmx;
|
|
} else {
|
|
- dmix->u.dmix.mix_areas1 = smp > 1 ? mix_areas1_smp : mix_areas1;
|
|
+ dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp : mix_areas_16;
|
|
}
|
|
- dmix->u.dmix.mix_areas2 = smp > 1 ? mix_areas2_smp : mix_areas2;
|
|
+ dmix->u.dmix.mix_areas_32 = smp > 1 ? mix_areas_32_smp : mix_areas_32;
|
|
if (cmov) {
|
|
- dmix->u.dmix.mix_areas3 = smp > 1 ? mix_areas3_smp_cmov : mix_areas3_cmov;
|
|
+ dmix->u.dmix.mix_areas_24 = smp > 1 ? mix_areas_24_smp_cmov : mix_areas_24_cmov;
|
|
} else {
|
|
- dmix->u.dmix.mix_areas3 = smp > 1 ? mix_areas3_smp: mix_areas3;
|
|
+ dmix->u.dmix.mix_areas_24 = smp > 1 ? mix_areas_24_smp: mix_areas_24;
|
|
}
|
|
}
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_dmix_i386.h
|
|
--- a/src/pcm/pcm_dmix_i386.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_dmix_i386.h Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -29,10 +29,10 @@
|
|
/*
|
|
* for plain i386
|
|
*/
|
|
-static void MIX_AREAS1(unsigned int size,
|
|
- volatile signed short *dst, signed short *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void MIX_AREAS_16(unsigned int size,
|
|
+ volatile signed short *dst, signed short *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
unsigned int old_ebx;
|
|
|
|
@@ -153,10 +153,10 @@ static void MIX_AREAS1(unsigned int size
|
|
/*
|
|
* MMX optimized
|
|
*/
|
|
-static void MIX_AREAS1_MMX(unsigned int size,
|
|
- volatile signed short *dst, signed short *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void MIX_AREAS_16_MMX(unsigned int size,
|
|
+ volatile signed short *dst, signed short *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
unsigned int old_ebx;
|
|
|
|
@@ -243,10 +243,10 @@ static void MIX_AREAS1_MMX(unsigned int
|
|
/*
|
|
* for plain i386, 32-bit version (24-bit resolution)
|
|
*/
|
|
-static void MIX_AREAS2(unsigned int size,
|
|
- volatile signed int *dst, signed int *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void MIX_AREAS_32(unsigned int size,
|
|
+ volatile signed int *dst, signed int *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
unsigned int old_ebx;
|
|
|
|
@@ -356,10 +356,10 @@ static void MIX_AREAS2(unsigned int size
|
|
/*
|
|
* 24-bit version for plain i386
|
|
*/
|
|
-static void MIX_AREAS3(unsigned int size,
|
|
- volatile unsigned char *dst, unsigned char *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void MIX_AREAS_24(unsigned int size,
|
|
+ volatile unsigned char *dst, unsigned char *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
unsigned int old_ebx;
|
|
|
|
@@ -462,10 +462,10 @@ static void MIX_AREAS3(unsigned int size
|
|
/*
|
|
* 24-bit version for Pentium Pro/II
|
|
*/
|
|
-static void MIX_AREAS3_CMOV(unsigned int size,
|
|
- volatile unsigned char *dst, unsigned char *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void MIX_AREAS_24_CMOV(unsigned int size,
|
|
+ volatile unsigned char *dst, unsigned char *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
unsigned int old_ebx;
|
|
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_dmix_x86_64.c
|
|
--- a/src/pcm/pcm_dmix_x86_64.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_dmix_x86_64.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -2,24 +2,24 @@
|
|
* optimized mixing code for x86-64
|
|
*/
|
|
|
|
-#define MIX_AREAS1 mix_areas1
|
|
-#define MIX_AREAS2 mix_areas2
|
|
-#define MIX_AREAS3 mix_areas3
|
|
+#define MIX_AREAS_16 mix_areas_16
|
|
+#define MIX_AREAS_32 mix_areas_32
|
|
+#define MIX_AREAS_24 mix_areas_24
|
|
#define LOCK_PREFIX ""
|
|
#include "pcm_dmix_x86_64.h"
|
|
-#undef MIX_AREAS1
|
|
-#undef MIX_AREAS2
|
|
-#undef MIX_AREAS3
|
|
+#undef MIX_AREAS_16
|
|
+#undef MIX_AREAS_32
|
|
+#undef MIX_AREAS_24
|
|
#undef LOCK_PREFIX
|
|
|
|
-#define MIX_AREAS1 mix_areas1_smp
|
|
-#define MIX_AREAS2 mix_areas2_smp
|
|
-#define MIX_AREAS3 mix_areas3_smp
|
|
+#define MIX_AREAS_16 mix_areas_16_smp
|
|
+#define MIX_AREAS_32 mix_areas_32_smp
|
|
+#define MIX_AREAS_24 mix_areas_24_smp
|
|
#define LOCK_PREFIX "lock ; "
|
|
#include "pcm_dmix_x86_64.h"
|
|
-#undef MIX_AREAS1
|
|
-#undef MIX_AREAS2
|
|
-#undef MIX_AREAS3
|
|
+#undef MIX_AREAS_16
|
|
+#undef MIX_AREAS_32
|
|
+#undef MIX_AREAS_24
|
|
#undef LOCK_PREFIX
|
|
|
|
#define x86_64_dmix_supported_format \
|
|
@@ -55,7 +55,7 @@ static void mix_select_callbacks(snd_pcm
|
|
}
|
|
}
|
|
// printf("SMP: %i\n", smp);
|
|
- dmix->u.dmix.mix_areas1 = smp > 1 ? mix_areas1_smp : mix_areas1;
|
|
- dmix->u.dmix.mix_areas2 = smp > 1 ? mix_areas2_smp : mix_areas2;
|
|
- dmix->u.dmix.mix_areas3 = smp > 1 ? mix_areas3_smp : mix_areas3;
|
|
+ dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp : mix_areas_16;
|
|
+ dmix->u.dmix.mix_areas_32 = smp > 1 ? mix_areas_32_smp : mix_areas_32;
|
|
+ dmix->u.dmix.mix_areas_24 = smp > 1 ? mix_areas_24_smp : mix_areas_24;
|
|
}
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_dmix_x86_64.h
|
|
--- a/src/pcm/pcm_dmix_x86_64.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_dmix_x86_64.h Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -30,10 +30,10 @@
|
|
/*
|
|
* MMX optimized
|
|
*/
|
|
-static void MIX_AREAS1(unsigned int size,
|
|
- volatile signed short *dst, signed short *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void MIX_AREAS_16(unsigned int size,
|
|
+ volatile signed short *dst, signed short *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
unsigned long long old_rbx;
|
|
|
|
@@ -125,10 +125,10 @@ static void MIX_AREAS1(unsigned int size
|
|
/*
|
|
* 32-bit version (24-bit resolution)
|
|
*/
|
|
-static void MIX_AREAS2(unsigned int size,
|
|
- volatile signed int *dst, signed int *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void MIX_AREAS_32(unsigned int size,
|
|
+ volatile signed int *dst, signed int *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
unsigned long long old_rbx;
|
|
|
|
@@ -240,10 +240,10 @@ static void MIX_AREAS2(unsigned int size
|
|
/*
|
|
* 24-bit version
|
|
*/
|
|
-static void MIX_AREAS3(unsigned int size,
|
|
- volatile unsigned char *dst, unsigned char *src,
|
|
- volatile signed int *sum, size_t dst_step,
|
|
- size_t src_step, size_t sum_step)
|
|
+static void MIX_AREAS_24(unsigned int size,
|
|
+ volatile unsigned char *dst, unsigned char *src,
|
|
+ volatile signed int *sum, size_t dst_step,
|
|
+ size_t src_step, size_t sum_step)
|
|
{
|
|
unsigned long long old_rbx;
|
|
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_dshare.c
|
|
--- a/src/pcm/pcm_dshare.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_dshare.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -194,11 +194,8 @@ static int snd_pcm_dshare_sync_ptr(snd_p
|
|
if (avail > dshare->avail_max)
|
|
dshare->avail_max = avail;
|
|
if (avail >= pcm->stop_threshold) {
|
|
- struct timeval tv;
|
|
snd_timer_stop(dshare->timer);
|
|
- gettimeofday(&tv, 0);
|
|
- dshare->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- dshare->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&dshare->trigger_tstamp);
|
|
if (dshare->state == SND_PCM_STATE_RUNNING) {
|
|
dshare->state = SND_PCM_STATE_XRUN;
|
|
return -EPIPE;
|
|
@@ -229,7 +226,10 @@ static int snd_pcm_dshare_status(snd_pcm
|
|
memset(status, 0, sizeof(*status));
|
|
status->state = snd_pcm_state(dshare->spcm);
|
|
status->trigger_tstamp = dshare->trigger_tstamp;
|
|
- status->tstamp = snd_pcm_hw_fast_tstamp(dshare->spcm);
|
|
+ if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
|
|
+ status->tstamp = snd_pcm_hw_fast_tstamp(dshare->spcm);
|
|
+ else
|
|
+ gettimestamp(&status->tstamp);
|
|
status->avail = snd_pcm_mmap_playback_avail(pcm);
|
|
status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
|
|
dshare->avail_max = 0;
|
|
@@ -335,7 +335,6 @@ static int snd_pcm_dshare_start(snd_pcm_
|
|
{
|
|
snd_pcm_direct_t *dshare = pcm->private_data;
|
|
snd_pcm_sframes_t avail;
|
|
- struct timeval tv;
|
|
int err;
|
|
|
|
if (dshare->state != SND_PCM_STATE_PREPARED)
|
|
@@ -350,9 +349,7 @@ static int snd_pcm_dshare_start(snd_pcm_
|
|
return err;
|
|
snd_pcm_dshare_sync_area(pcm);
|
|
}
|
|
- gettimeofday(&tv, 0);
|
|
- dshare->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- dshare->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&dshare->trigger_tstamp);
|
|
return 0;
|
|
}
|
|
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_dsnoop.c
|
|
--- a/src/pcm/pcm_dsnoop.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_dsnoop.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -141,10 +141,7 @@ static int snd_pcm_dsnoop_sync_ptr(snd_p
|
|
if (pcm->stop_threshold >= pcm->boundary) /* don't care */
|
|
return 0;
|
|
if ((avail = snd_pcm_mmap_capture_hw_avail(pcm)) >= pcm->stop_threshold) {
|
|
- struct timeval tv;
|
|
- gettimeofday(&tv, 0);
|
|
- dsnoop->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- dsnoop->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&dsnoop->trigger_tstamp);
|
|
dsnoop->state = SND_PCM_STATE_XRUN;
|
|
dsnoop->avail_max = avail;
|
|
return -EPIPE;
|
|
@@ -175,7 +172,10 @@ static int snd_pcm_dsnoop_status(snd_pcm
|
|
state = snd_pcm_state(dsnoop->spcm);
|
|
status->state = state == SND_PCM_STATE_RUNNING ? dsnoop->state : state;
|
|
status->trigger_tstamp = dsnoop->trigger_tstamp;
|
|
- status->tstamp = snd_pcm_hw_fast_tstamp(dsnoop->spcm);
|
|
+ if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
|
|
+ status->tstamp = snd_pcm_hw_fast_tstamp(dsnoop->spcm);
|
|
+ else
|
|
+ gettimestamp(&status->tstamp);
|
|
status->avail = snd_pcm_mmap_capture_avail(pcm);
|
|
status->avail_max = status->avail > dsnoop->avail_max ? status->avail : dsnoop->avail_max;
|
|
dsnoop->avail_max = 0;
|
|
@@ -264,7 +264,6 @@ static int snd_pcm_dsnoop_start(snd_pcm_
|
|
static int snd_pcm_dsnoop_start(snd_pcm_t *pcm)
|
|
{
|
|
snd_pcm_direct_t *dsnoop = pcm->private_data;
|
|
- struct timeval tv;
|
|
int err;
|
|
|
|
if (dsnoop->state != SND_PCM_STATE_PREPARED)
|
|
@@ -275,9 +274,7 @@ static int snd_pcm_dsnoop_start(snd_pcm_
|
|
if (err < 0)
|
|
return err;
|
|
dsnoop->state = SND_PCM_STATE_RUNNING;
|
|
- gettimeofday(&tv, 0);
|
|
- dsnoop->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- dsnoop->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&dsnoop->trigger_tstamp);
|
|
return 0;
|
|
}
|
|
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_empty.c
|
|
--- a/src/pcm/pcm_empty.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_empty.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -100,7 +100,8 @@ int _snd_pcm_empty_open(snd_pcm_t **pcmp
|
|
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
|
if (err < 0)
|
|
return err;
|
|
- err = snd_pcm_open_slave(pcmp, root, sconf, stream, mode, conf);
|
|
+ err = snd_pcm_open_named_slave(pcmp, name, root, sconf, stream,
|
|
+ mode, conf);
|
|
snd_config_delete(sconf);
|
|
return err;
|
|
}
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_ext_parm.h
|
|
--- a/src/pcm/pcm_ext_parm.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_ext_parm.h Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -19,6 +19,20 @@ static inline snd_interval_t *hw_param_i
|
|
return ¶ms->intervals[var - SND_PCM_HW_PARAM_FIRST_INTERVAL];
|
|
}
|
|
|
|
+/* make local functions really local */
|
|
+#define snd_ext_parm_set_minmax \
|
|
+ snd1_ext_parm_set_minmax
|
|
+#define snd_ext_parm_set_list \
|
|
+ snd1_ext_parm_set_list
|
|
+#define snd_ext_parm_clear \
|
|
+ snd1_ext_parm_clear
|
|
+#define snd_interval_list \
|
|
+ snd1_interval_list
|
|
+#define snd_ext_parm_interval_refine \
|
|
+ snd1_ext_parm_interval_refine
|
|
+#define snd_ext_parm_mask_refine \
|
|
+ snd1_ext_parm_mask_refine
|
|
+
|
|
int snd_ext_parm_set_minmax(struct snd_ext_parm *parm, unsigned int min, unsigned int max);
|
|
int snd_ext_parm_set_list(struct snd_ext_parm *parm, unsigned int num_list, const unsigned int *list);
|
|
void snd_ext_parm_clear(struct snd_ext_parm *parm);
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_generic.h
|
|
--- a/src/pcm/pcm_generic.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_generic.h Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -23,6 +23,82 @@ typedef struct {
|
|
snd_pcm_t *slave;
|
|
int close_slave;
|
|
} snd_pcm_generic_t;
|
|
+
|
|
+/* make local functions really local */
|
|
+#define snd_pcm_generic_close \
|
|
+ snd1_pcm_generic_close
|
|
+#define snd_pcm_generic_nonblock \
|
|
+ snd1_pcm_generic_nonblock
|
|
+#define snd_pcm_generic_async \
|
|
+ snd1_pcm_generic_async
|
|
+#define snd_pcm_generic_poll_descriptors_count \
|
|
+ snd1_pcm_generic_poll_descriptors_count
|
|
+#define snd_pcm_generic_poll_descriptors \
|
|
+ snd1_pcm_generic_poll_descriptors
|
|
+#define snd_pcm_generic_poll_revents \
|
|
+ snd1_pcm_generic_poll_revents
|
|
+#define snd_pcm_generic_info \
|
|
+ snd1_pcm_generic_info
|
|
+#define snd_pcm_generic_hw_free \
|
|
+ snd1_pcm_generic_hw_free
|
|
+#define snd_pcm_generic_sw_params \
|
|
+ snd1_pcm_generic_sw_params
|
|
+#define snd_pcm_generic_hw_refine \
|
|
+ snd1_pcm_generic_hw_refine
|
|
+#define snd_pcm_generic_hw_params \
|
|
+ snd1_pcm_generic_hw_params
|
|
+#define snd_pcm_generic_channel_info \
|
|
+ snd1_pcm_generic_channel_info
|
|
+#define snd_pcm_generic_channel_info_no_buffer \
|
|
+ snd1_pcm_generic_channel_info_no_buffer
|
|
+#define snd_pcm_generic_status \
|
|
+ snd1_pcm_generic_status
|
|
+#define snd_pcm_generic_state \
|
|
+ snd1_pcm_generic_state
|
|
+#define snd_pcm_generic_prepare \
|
|
+ snd1_pcm_generic_prepare
|
|
+#define snd_pcm_generic_hwsync \
|
|
+ snd1_pcm_generic_hwsync
|
|
+#define snd_pcm_generic_reset \
|
|
+ snd1_pcm_generic_reset
|
|
+#define snd_pcm_generic_start \
|
|
+ snd1_pcm_generic_start
|
|
+#define snd_pcm_generic_drop \
|
|
+ snd1_pcm_generic_drop
|
|
+#define snd_pcm_generic_drain \
|
|
+ snd1_pcm_generic_drain
|
|
+#define snd_pcm_generic_pause \
|
|
+ snd1_pcm_generic_pause
|
|
+#define snd_pcm_generic_resume \
|
|
+ snd1_pcm_generic_resume
|
|
+#define snd_pcm_generic_delay \
|
|
+ snd1_pcm_generic_delay
|
|
+#define snd_pcm_generic_forward \
|
|
+ snd1_pcm_generic_forward
|
|
+#define snd_pcm_generic_rewind \
|
|
+ snd1_pcm_generic_rewind
|
|
+#define snd_pcm_generic_link \
|
|
+ snd1_pcm_generic_link
|
|
+#define snd_pcm_generic_link_slaves \
|
|
+ snd1_pcm_generic_link_slaves
|
|
+#define snd_pcm_generic_unlink \
|
|
+ snd1_pcm_generic_unlink
|
|
+#define snd_pcm_generic_writei \
|
|
+ snd1_pcm_generic_writei
|
|
+#define snd_pcm_generic_writen \
|
|
+ snd1_pcm_generic_writen
|
|
+#define snd_pcm_generic_readi \
|
|
+ snd1_pcm_generic_readi
|
|
+#define snd_pcm_generic_readn \
|
|
+ snd1_pcm_generic_readn
|
|
+#define snd_pcm_generic_mmap_commit \
|
|
+ snd1_pcm_generic_mmap_commit
|
|
+#define snd_pcm_generic_avail_update \
|
|
+ snd1_pcm_generic_avail_update
|
|
+#define snd_pcm_generic_mmap \
|
|
+ snd1_pcm_generic_mmap
|
|
+#define snd_pcm_generic_munmap \
|
|
+ snd1_pcm_generic_munmap
|
|
|
|
int snd_pcm_generic_close(snd_pcm_t *pcm);
|
|
int snd_pcm_generic_nonblock(snd_pcm_t *pcm, int nonblock);
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_ioplug.c
|
|
--- a/src/pcm/pcm_ioplug.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_ioplug.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -313,7 +313,7 @@ static int snd_pcm_ioplug_hw_refine(snd_
|
|
if (err < 0)
|
|
return err;
|
|
change2 |= err;
|
|
- /* periods = buffer_bytes / periods */
|
|
+ /* periods = buffer_bytes / period_bytes */
|
|
err = rule_div(params, SND_PCM_HW_PARAM_PERIODS,
|
|
SND_PCM_HW_PARAM_BUFFER_BYTES,
|
|
SND_PCM_HW_PARAM_PERIOD_BYTES);
|
|
@@ -340,6 +340,26 @@ static int snd_pcm_ioplug_hw_refine(snd_
|
|
err = refine_back_time_and_size(params, SND_PCM_HW_PARAM_BUFFER_TIME,
|
|
SND_PCM_HW_PARAM_BUFFER_SIZE,
|
|
SND_PCM_HW_PARAM_BUFFER_BYTES);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ }
|
|
+
|
|
+ /* period_bytes = buffer_bytes / periods */
|
|
+ err = rule_div(params, SND_PCM_HW_PARAM_PERIOD_BYTES,
|
|
+ SND_PCM_HW_PARAM_BUFFER_BYTES,
|
|
+ SND_PCM_HW_PARAM_PERIODS);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ if (err) {
|
|
+ /* update period_size and period_time */
|
|
+ change |= err;
|
|
+ err = snd_ext_parm_interval_refine(hw_param_interval(params, SND_PCM_HW_PARAM_PERIOD_BYTES),
|
|
+ io->params, SND_PCM_IOPLUG_HW_PERIOD_BYTES);
|
|
+ if (err < 0)
|
|
+ return err;
|
|
+ err = refine_back_time_and_size(params, SND_PCM_HW_PARAM_PERIOD_TIME,
|
|
+ SND_PCM_HW_PARAM_PERIOD_SIZE,
|
|
+ SND_PCM_HW_PARAM_PERIOD_BYTES);
|
|
if (err < 0)
|
|
return err;
|
|
}
|
|
@@ -418,7 +438,6 @@ static int snd_pcm_ioplug_start(snd_pcm_
|
|
static int snd_pcm_ioplug_start(snd_pcm_t *pcm)
|
|
{
|
|
ioplug_priv_t *io = pcm->private_data;
|
|
- struct timeval tv;
|
|
int err;
|
|
|
|
if (io->data->state != SND_PCM_STATE_PREPARED)
|
|
@@ -428,9 +447,7 @@ static int snd_pcm_ioplug_start(snd_pcm_
|
|
if (err < 0)
|
|
return err;
|
|
|
|
- gettimeofday(&tv, 0);
|
|
- io->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- io->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&io->trigger_tstamp);
|
|
io->data->state = SND_PCM_STATE_RUNNING;
|
|
|
|
return 0;
|
|
@@ -439,16 +456,13 @@ static int snd_pcm_ioplug_drop(snd_pcm_t
|
|
static int snd_pcm_ioplug_drop(snd_pcm_t *pcm)
|
|
{
|
|
ioplug_priv_t *io = pcm->private_data;
|
|
- struct timeval tv;
|
|
|
|
if (io->data->state == SND_PCM_STATE_OPEN)
|
|
return -EBADFD;
|
|
|
|
io->data->callback->stop(io->data);
|
|
|
|
- gettimeofday(&tv, 0);
|
|
- io->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- io->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&io->trigger_tstamp);
|
|
io->data->state = SND_PCM_STATE_SETUP;
|
|
|
|
return 0;
|
|
@@ -600,6 +614,8 @@ static snd_pcm_sframes_t snd_pcm_ioplug_
|
|
snd_pcm_uframes_t avail;
|
|
|
|
snd_pcm_ioplug_hw_ptr_update(pcm);
|
|
+ if (io->data->state == SNDRV_PCM_STATE_XRUN)
|
|
+ return -EPIPE;
|
|
if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
|
|
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
|
|
pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
|
|
@@ -1023,3 +1039,19 @@ const snd_pcm_channel_area_t *snd_pcm_io
|
|
return snd_pcm_mmap_areas(ioplug->pcm);
|
|
return NULL;
|
|
}
|
|
+
|
|
+/**
|
|
+ * \brief Change the ioplug PCM status
|
|
+ * \param ioplug the ioplug handle
|
|
+ * \param state the PCM status
|
|
+ * \return zero if successful or a negative error code
|
|
+ *
|
|
+ * Changes the PCM status of the ioplug to the given value.
|
|
+ * This function can be used for external plugins to notify the status
|
|
+ * change, e.g. XRUN.
|
|
+ */
|
|
+int snd_pcm_ioplug_set_state(snd_pcm_ioplug_t *ioplug, snd_pcm_state_t state)
|
|
+{
|
|
+ ioplug->state = state;
|
|
+ return 0;
|
|
+}
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_local.h
|
|
--- a/src/pcm/pcm_local.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_local.h Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -226,6 +226,116 @@ struct _snd_pcm {
|
|
void *private_data;
|
|
struct list_head async_handlers;
|
|
};
|
|
+
|
|
+/* make local functions really local */
|
|
+/* Grrr, these cannot be local - a bad aserver uses them!
|
|
+#define snd_pcm_async \
|
|
+ snd1_pcm_async
|
|
+#define snd_pcm_mmap \
|
|
+ snd1_pcm_mmap
|
|
+#define snd_pcm_munmap \
|
|
+ snd1_pcm_munmap
|
|
+#define snd_pcm_hw_refine \
|
|
+ snd1_pcm_hw_refine
|
|
+*/
|
|
+#define snd_pcm_new \
|
|
+ snd1_pcm_new
|
|
+#define snd_pcm_free \
|
|
+ snd1_pcm_free
|
|
+#define snd_pcm_areas_from_buf \
|
|
+ snd1_pcm_areas_from_buf
|
|
+#define snd_pcm_areas_from_bufs \
|
|
+ snd1_pcm_areas_from_bufs
|
|
+#define snd_pcm_open_named_slave \
|
|
+ snd1_pcm_open_named_slave
|
|
+#define snd_pcm_conf_generic_id \
|
|
+ snd1_pcm_conf_generic_id
|
|
+#define snd_pcm_hw_open_fd \
|
|
+ snd1_pcm_hw_open_fd
|
|
+#define snd_pcm_wait_nocheck \
|
|
+ snd1_pcm_wait_nocheck
|
|
+#define snd_pcm_rate_get_default_converter \
|
|
+ snd1_pcm_rate_get_default_converter
|
|
+#define snd_pcm_set_hw_ptr \
|
|
+ snd1_pcm_set_hw_ptr
|
|
+#define snd_pcm_set_appl_ptr \
|
|
+ snd1_pcm_set_appl_ptr
|
|
+#define snd_pcm_link_hw_ptr \
|
|
+ snd1_pcm_link_hw_ptr
|
|
+#define snd_pcm_link_appl_ptr \
|
|
+ snd1_pcm_link_appl_ptr
|
|
+#define snd_pcm_unlink_hw_ptr \
|
|
+ snd1_pcm_unlink_hw_ptr
|
|
+#define snd_pcm_unlink_appl_ptr \
|
|
+ snd1_pcm_unlink_appl_ptr
|
|
+#define snd_pcm_mmap_appl_ptr \
|
|
+ snd1_pcm_mmap_appl_ptr
|
|
+#define snd_pcm_mmap_appl_backward \
|
|
+ snd1_pcm_mmap_appl_backward
|
|
+#define snd_pcm_mmap_appl_forward \
|
|
+ snd1_pcm_mmap_appl_forward
|
|
+#define snd_pcm_mmap_hw_backward \
|
|
+ snd1_pcm_mmap_hw_backward
|
|
+#define snd_pcm_mmap_hw_forward \
|
|
+ snd1_pcm_mmap_hw_forward
|
|
+#define snd_pcm_read_areas \
|
|
+ snd1_pcm_read_areas
|
|
+#define snd_pcm_write_areas \
|
|
+ snd1_pcm_write_areas
|
|
+#define snd_pcm_read_mmap \
|
|
+ snd1_pcm_read_mmap
|
|
+#define snd_pcm_write_mmap \
|
|
+ snd1_pcm_write_mmap
|
|
+#define snd_pcm_channel_info_shm \
|
|
+ snd1_pcm_channel_info_shm
|
|
+#define snd_pcm_hw_refine_soft \
|
|
+ snd1_pcm_hw_refine_soft
|
|
+#define snd_pcm_hw_refine_slave \
|
|
+ snd1_pcm_hw_refine_slave
|
|
+#define snd_pcm_hw_params_slave \
|
|
+ snd1_pcm_hw_params_slave
|
|
+#define snd_pcm_hw_param_refine_near \
|
|
+ snd1_pcm_hw_param_refine_near
|
|
+#define snd_pcm_hw_param_refine_multiple \
|
|
+ snd1_pcm_hw_param_refine_multiple
|
|
+#define snd_pcm_hw_param_empty \
|
|
+ snd1_pcm_hw_param_empty
|
|
+#define snd_pcm_hw_param_always_eq \
|
|
+ snd1_pcm_hw_param_always_eq
|
|
+#define snd_pcm_hw_param_never_eq \
|
|
+ snd1_pcm_hw_param_never_eq
|
|
+#define snd_pcm_hw_param_get_mask \
|
|
+ snd1_pcm_hw_param_get_mask
|
|
+#define snd_pcm_hw_param_get_interval \
|
|
+ snd1_pcm_hw_param_get_interval
|
|
+#define snd_pcm_hw_param_any \
|
|
+ snd1_pcm_hw_param_any
|
|
+#define snd_pcm_hw_param_set_integer \
|
|
+ snd1_pcm_hw_param_set_integer
|
|
+#define snd_pcm_hw_param_set_first \
|
|
+ snd1_pcm_hw_param_set_first
|
|
+#define snd_pcm_hw_param_set_last \
|
|
+ snd1_pcm_hw_param_set_last
|
|
+#define snd_pcm_hw_param_set_near \
|
|
+ snd1_pcm_hw_param_set_near
|
|
+#define snd_pcm_hw_param_set_min \
|
|
+ snd1_pcm_hw_param_set_min
|
|
+#define snd_pcm_hw_param_set_max \
|
|
+ snd1_pcm_hw_param_set_max
|
|
+#define snd_pcm_hw_param_set_minmax \
|
|
+ snd1_pcm_hw_param_set_minmax
|
|
+#define snd_pcm_hw_param_set \
|
|
+ snd1_pcm_hw_param_set
|
|
+#define snd_pcm_hw_param_set_mask \
|
|
+ snd1_pcm_hw_param_set_mask
|
|
+#define snd_pcm_hw_param_get \
|
|
+ snd1_pcm_hw_param_get
|
|
+#define snd_pcm_hw_param_get_min \
|
|
+ snd1_pcm_hw_param_get_min
|
|
+#define snd_pcm_hw_param_get_max \
|
|
+ snd1_pcm_hw_param_get_max
|
|
+#define snd_pcm_hw_param_name \
|
|
+ snd1_pcm_hw_param_name
|
|
|
|
int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name,
|
|
snd_pcm_stream_t stream, int mode);
|
|
@@ -749,9 +859,18 @@ int snd_pcm_slave_conf(snd_config_t *roo
|
|
|
|
#define SND_PCM_APPEND (1<<8)
|
|
|
|
-int snd_pcm_open_slave(snd_pcm_t **pcmp, snd_config_t *root,
|
|
- snd_config_t *conf, snd_pcm_stream_t stream,
|
|
- int mode, snd_config_t *parent_conf);
|
|
+int snd_pcm_open_named_slave(snd_pcm_t **pcmp, const char *name,
|
|
+ snd_config_t *root,
|
|
+ snd_config_t *conf, snd_pcm_stream_t stream,
|
|
+ int mode, snd_config_t *parent_conf);
|
|
+static inline int
|
|
+snd_pcm_open_slave(snd_pcm_t **pcmp, snd_config_t *root,
|
|
+ snd_config_t *conf, snd_pcm_stream_t stream,
|
|
+ int mode, snd_config_t *parent_conf)
|
|
+{
|
|
+ return snd_pcm_open_named_slave(pcmp, NULL, root, conf, stream,
|
|
+ mode, parent_conf);
|
|
+}
|
|
int snd_pcm_conf_generic_id(const char *id);
|
|
|
|
int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd, int mmap_emulation, int sync_ptr_ioctl);
|
|
@@ -838,3 +957,13 @@ typedef union snd_tmp_double {
|
|
double d;
|
|
int64_t l;
|
|
} snd_tmp_double_t;
|
|
+
|
|
+/* get the current timestamp */
|
|
+static inline void gettimestamp(snd_htimestamp_t *tstamp)
|
|
+{
|
|
+ struct timeval tv;
|
|
+
|
|
+ gettimeofday(&tv, 0);
|
|
+ tstamp->tv_sec = tv.tv_sec;
|
|
+ tstamp->tv_nsec = tv.tv_usec * 1000L;
|
|
+}
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_multi.c
|
|
--- a/src/pcm/pcm_multi.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_multi.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -690,13 +690,44 @@ static snd_pcm_sframes_t snd_pcm_multi_m
|
|
return size;
|
|
}
|
|
|
|
-static int snd_pcm_multi_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|
+static int snd_pcm_multi_munmap(snd_pcm_t *pcm)
|
|
{
|
|
+ free(pcm->mmap_channels);
|
|
+ free(pcm->running_areas);
|
|
+ pcm->mmap_channels = NULL;
|
|
+ pcm->running_areas = NULL;
|
|
return 0;
|
|
}
|
|
|
|
-static int snd_pcm_multi_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|
+static int snd_pcm_multi_mmap(snd_pcm_t *pcm)
|
|
{
|
|
+ snd_pcm_multi_t *multi = pcm->private_data;
|
|
+ unsigned int c;
|
|
+
|
|
+ pcm->mmap_channels = calloc(pcm->channels,
|
|
+ sizeof(pcm->mmap_channels[0]));
|
|
+ pcm->running_areas = calloc(pcm->channels,
|
|
+ sizeof(pcm->running_areas[0]));
|
|
+ if (!pcm->mmap_channels || !pcm->running_areas) {
|
|
+ snd_pcm_multi_munmap(pcm);
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
+ /* Copy the slave mmapped buffer data */
|
|
+ for (c = 0; c < pcm->channels; c++) {
|
|
+ snd_pcm_multi_channel_t *chan = &multi->channels[c];
|
|
+ snd_pcm_t *slave;
|
|
+ if (chan->slave_idx < 0) {
|
|
+ snd_pcm_multi_munmap(pcm);
|
|
+ return -ENXIO;
|
|
+ }
|
|
+ slave = multi->slaves[chan->slave_idx].pcm;
|
|
+ pcm->mmap_channels[c] =
|
|
+ slave->mmap_channels[chan->slave_channel];
|
|
+ pcm->mmap_channels[c].channel = c;
|
|
+ pcm->running_areas[c] =
|
|
+ slave->running_areas[chan->slave_channel];
|
|
+ }
|
|
return 0;
|
|
}
|
|
|
|
@@ -850,6 +881,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp,
|
|
return err;
|
|
}
|
|
pcm->mmap_rw = 1;
|
|
+ pcm->mmap_shadow = 1; /* has own mmap method */
|
|
pcm->ops = &snd_pcm_multi_ops;
|
|
pcm->fast_ops = &snd_pcm_multi_fast_ops;
|
|
pcm->private_data = multi;
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_null.c
|
|
--- a/src/pcm/pcm_null.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_null.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -82,13 +82,10 @@ static int snd_pcm_null_status(snd_pcm_t
|
|
static int snd_pcm_null_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|
{
|
|
snd_pcm_null_t *null = pcm->private_data;
|
|
- struct timeval tv;
|
|
memset(status, 0, sizeof(*status));
|
|
status->state = null->state;
|
|
status->trigger_tstamp = null->trigger_tstamp;
|
|
- gettimeofday(&tv, 0);
|
|
- status->tstamp.tv_sec = tv.tv_sec;
|
|
- status->tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&status->tstamp);
|
|
status->avail = pcm->buffer_size;
|
|
status->avail_max = status->avail;
|
|
return 0;
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_params.c
|
|
--- a/src/pcm/pcm_params.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_params.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -78,31 +78,14 @@ static inline int hw_is_interval(snd_pcm
|
|
var <= SND_PCM_HW_PARAM_LAST_INTERVAL;
|
|
}
|
|
|
|
-static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params,
|
|
- snd_pcm_hw_param_t var)
|
|
-{
|
|
- assert(hw_is_mask(var));
|
|
- return (snd_mask_t*)¶ms->masks[var - SND_PCM_HW_PARAM_FIRST_MASK];
|
|
-}
|
|
+#define hw_param_mask(params,var) \
|
|
+ &((params)->masks[(var) - SND_PCM_HW_PARAM_FIRST_MASK])
|
|
|
|
-static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params,
|
|
- snd_pcm_hw_param_t var)
|
|
-{
|
|
- assert(hw_is_interval(var));
|
|
- return ¶ms->intervals[var - SND_PCM_HW_PARAM_FIRST_INTERVAL];
|
|
-}
|
|
+#define hw_param_interval(params,var) \
|
|
+ &((params)->intervals[(var) - SND_PCM_HW_PARAM_FIRST_INTERVAL])
|
|
|
|
-static inline const snd_mask_t *hw_param_mask_c(const snd_pcm_hw_params_t *params,
|
|
- snd_pcm_hw_param_t var)
|
|
-{
|
|
- return (const snd_mask_t *)hw_param_mask((snd_pcm_hw_params_t*) params, var);
|
|
-}
|
|
-
|
|
-static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_t *params,
|
|
- snd_pcm_hw_param_t var)
|
|
-{
|
|
- return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var);
|
|
-}
|
|
+#define hw_param_mask_c hw_param_mask
|
|
+#define hw_param_interval_c hw_param_interval
|
|
|
|
static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var)
|
|
{
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_plugin.h
|
|
--- a/src/pcm/pcm_plugin.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_plugin.h Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -51,6 +51,16 @@ typedef struct {
|
|
snd_atomic_write_t watom;
|
|
} snd_pcm_plugin_t;
|
|
|
|
+/* make local functions really local */
|
|
+#define snd_pcm_plugin_init \
|
|
+ snd1_pcm_plugin_init
|
|
+#define snd_pcm_plugin_fast_ops \
|
|
+ snd1_pcm_plugin_fast_ops
|
|
+#define snd_pcm_plugin_undo_read_generic \
|
|
+ snd1_pcm_plugin_undo_read_generic
|
|
+#define snd_pcm_plugin_undo_write_generic \
|
|
+ snd1_pcm_plugin_undo_write_generic
|
|
+
|
|
void snd_pcm_plugin_init(snd_pcm_plugin_t *plugin);
|
|
|
|
extern snd_pcm_fast_ops_t snd_pcm_plugin_fast_ops;
|
|
@@ -68,6 +78,21 @@ snd_pcm_sframes_t snd_pcm_plugin_undo_wr
|
|
snd_pcm_uframes_t res_offset, /* offset of result areas */
|
|
snd_pcm_uframes_t res_size, /* size of result areas */
|
|
snd_pcm_uframes_t slave_undo_size);
|
|
+
|
|
+/* make local functions really local */
|
|
+#define snd_pcm_linear_get_index snd1_pcm_linear_get_index
|
|
+#define snd_pcm_linear_put_index snd1_pcm_linear_put_index
|
|
+#define snd_pcm_linear_get32_index snd1_pcm_linear_get32_index
|
|
+#define snd_pcm_linear_put32_index snd1_pcm_linear_put32_index
|
|
+#define snd_pcm_linear_convert_index snd1_pcm_linear_convert_index
|
|
+#define snd_pcm_linear_convert snd1_pcm_linear_convert
|
|
+#define snd_pcm_linear_getput snd1_pcm_linear_getput
|
|
+#define snd_pcm_alaw_decode snd1_pcm_alaw_decode
|
|
+#define snd_pcm_alaw_encode snd1_pcm_alaw_encode
|
|
+#define snd_pcm_mulaw_decode snd1_pcm_mulaw_decode
|
|
+#define snd_pcm_mulaw_encode snd1_pcm_mulaw_encode
|
|
+#define snd_pcm_adpcm_decode snd1_pcm_adpcm_decode
|
|
+#define snd_pcm_adpcm_encode snd1_pcm_adpcm_encode
|
|
|
|
int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
|
int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_rate.c
|
|
--- a/src/pcm/pcm_rate.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_rate.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -715,38 +715,6 @@ static snd_pcm_sframes_t snd_pcm_rate_fo
|
|
return n;
|
|
}
|
|
|
|
-static int snd_pcm_rate_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
|
|
-{
|
|
- snd_pcm_rate_t *rate = pcm->private_data;
|
|
- snd_pcm_uframes_t avail_min;
|
|
- int ret, err;
|
|
-
|
|
- ret = snd_pcm_generic_poll_descriptors(pcm, pfds, space);
|
|
- if (ret < 0)
|
|
- return ret;
|
|
-
|
|
- avail_min = rate->appl_ptr % pcm->period_size;
|
|
- if (avail_min > 0) {
|
|
- recalc(pcm, &avail_min);
|
|
- if (avail_min < rate->gen.slave->buffer_size &&
|
|
- avail_min != rate->gen.slave->period_size)
|
|
- avail_min++; /* 1st small little rounding correction */
|
|
- if (avail_min < rate->gen.slave->buffer_size &&
|
|
- avail_min != rate->gen.slave->period_size)
|
|
- avail_min++; /* 2nd small little rounding correction */
|
|
- avail_min += rate->orig_avail_min;
|
|
- } else {
|
|
- avail_min = rate->orig_avail_min;
|
|
- }
|
|
- if (rate->sw_params.avail_min == avail_min)
|
|
- return ret;
|
|
- rate->sw_params.avail_min = avail_min;
|
|
- err = snd_pcm_sw_params(rate->gen.slave, &rate->sw_params);
|
|
- if (err < 0)
|
|
- return err;
|
|
- return ret;
|
|
-}
|
|
-
|
|
static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
|
|
snd_pcm_uframes_t appl_offset,
|
|
snd_pcm_uframes_t size,
|
|
@@ -1122,7 +1090,6 @@ static int snd_pcm_rate_start(snd_pcm_t
|
|
{
|
|
snd_pcm_rate_t *rate = pcm->private_data;
|
|
snd_pcm_uframes_t avail;
|
|
- struct timeval tv;
|
|
|
|
if (pcm->stream == SND_PCM_STREAM_CAPTURE)
|
|
return snd_pcm_start(rate->gen.slave);
|
|
@@ -1130,9 +1097,7 @@ static int snd_pcm_rate_start(snd_pcm_t
|
|
if (snd_pcm_state(rate->gen.slave) != SND_PCM_STATE_PREPARED)
|
|
return -EBADFD;
|
|
|
|
- gettimeofday(&tv, 0);
|
|
- rate->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- rate->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&rate->trigger_tstamp);
|
|
|
|
avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave);
|
|
if (avail == 0) {
|
|
@@ -1229,7 +1194,7 @@ static snd_pcm_fast_ops_t snd_pcm_rate_f
|
|
.avail_update = snd_pcm_rate_avail_update,
|
|
.mmap_commit = snd_pcm_rate_mmap_commit,
|
|
.poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
|
|
- .poll_descriptors = snd_pcm_rate_poll_descriptors,
|
|
+ .poll_descriptors = snd_pcm_generic_poll_descriptors,
|
|
.poll_revents = snd_pcm_rate_poll_revents,
|
|
};
|
|
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_share.c
|
|
--- a/src/pcm/pcm_share.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_share.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -914,7 +914,6 @@ static int snd_pcm_share_start(snd_pcm_t
|
|
snd_pcm_share_t *share = pcm->private_data;
|
|
snd_pcm_share_slave_t *slave = share->slave;
|
|
snd_pcm_t *spcm = slave->pcm;
|
|
- struct timeval tv;
|
|
int err = 0;
|
|
if (share->state != SND_PCM_STATE_PREPARED)
|
|
return -EBADFD;
|
|
@@ -970,9 +969,7 @@ static int snd_pcm_share_start(snd_pcm_t
|
|
}
|
|
slave->running_count++;
|
|
_snd_pcm_share_update(pcm);
|
|
- gettimeofday(&tv, 0);
|
|
- share->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- share->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&share->trigger_tstamp);
|
|
_end:
|
|
Pthread_mutex_unlock(&slave->mutex);
|
|
return err;
|
|
@@ -1099,16 +1096,13 @@ static void _snd_pcm_share_stop(snd_pcm_
|
|
{
|
|
snd_pcm_share_t *share = pcm->private_data;
|
|
snd_pcm_share_slave_t *slave = share->slave;
|
|
- struct timeval tv;
|
|
#if 0
|
|
if (!pcm->mmap_channels) {
|
|
/* PCM closing already begun in the main thread */
|
|
return;
|
|
}
|
|
#endif
|
|
- gettimeofday(&tv, 0);
|
|
- share->trigger_tstamp.tv_sec = tv.tv_sec;
|
|
- share->trigger_tstamp.tv_nsec = tv.tv_usec * 1000L;
|
|
+ gettimestamp(&share->trigger_tstamp);
|
|
if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
|
|
snd_pcm_areas_copy(pcm->stopped_areas, 0,
|
|
pcm->running_areas, 0,
|
|
diff -r 9e2f117f24b9 src/pcm/pcm_softvol.c
|
|
--- a/src/pcm/pcm_softvol.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/pcm_softvol.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -782,6 +782,8 @@ int snd_pcm_softvol_open(snd_pcm_t **pcm
|
|
if (err > 0) { /* hardware control - no need for softvol! */
|
|
softvol_free(svol);
|
|
*pcmp = slave; /* just pass the slave */
|
|
+ if (!slave->name && name)
|
|
+ slave->name = strdup(name);
|
|
return 0;
|
|
}
|
|
|
|
diff -r 9e2f117f24b9 src/pcm/plugin_ops.h
|
|
--- a/src/pcm/plugin_ops.h Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/pcm/plugin_ops.h Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -85,8 +85,6 @@ static inline u_int32_t sx24s(u_int32_t
|
|
#define _put_triple(ptr,val) _put_triple_be(ptr,val)
|
|
#define _put_triple_s(ptr,val) _put_triple_le(ptr,val)
|
|
#endif
|
|
-
|
|
-#define shift_down(val, bits) (((val) + (1 << ((bits) - 1))) >> (bits))
|
|
|
|
#ifdef COPY_LABELS
|
|
static void *copy_labels[5] = {
|
|
@@ -258,14 +256,14 @@ conv_xxx1_009x: as_u32(dst) = sx24s((u_i
|
|
conv_xxx1_009x: as_u32(dst) = sx24s((u_int32_t)(as_u8c(src) ^ 0x80) << 8); goto CONV_END;
|
|
conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END;
|
|
conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80); goto CONV_END;
|
|
-conv_xx12_xxx1: as_u8(dst) = shift_down(as_u16c(src), 8); goto CONV_END;
|
|
+conv_xx12_xxx1: as_u8(dst) = as_u16c(src) >> 8; goto CONV_END;
|
|
conv_xx12_xx12: as_u16(dst) = as_u16c(src); goto CONV_END;
|
|
conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16c(src)); goto CONV_END;
|
|
conv_xx12_x120: as_u32(dst) = sx24((u_int32_t)as_u16c(src) << 8); goto CONV_END;
|
|
conv_xx12_021x: as_u32(dst) = sx24s((u_int32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END;
|
|
conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16c(src) << 16; goto CONV_END;
|
|
conv_xx12_0021: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)); goto CONV_END;
|
|
-conv_xx12_xxx9: as_u8(dst) = shift_down(as_u16c(src), 8) ^ 0x80; goto CONV_END;
|
|
+conv_xx12_xxx9: as_u8(dst) = (as_u16c(src) >> 8) ^ 0x80; goto CONV_END;
|
|
conv_xx12_xx92: as_u16(dst) = as_u16c(src) ^ 0x8000; goto CONV_END;
|
|
conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16c(src)) ^ 0x80; goto CONV_END;
|
|
conv_xx12_x920: as_u32(dst) = sx24((u_int32_t)(as_u16c(src) ^ 0x8000) << 8); goto CONV_END;
|
|
@@ -284,57 +282,57 @@ conv_xx12_01Ax: as_u32(dst) = sx24s((u_i
|
|
conv_xx12_01Ax: as_u32(dst) = sx24s((u_int32_t)(as_u16c(src) ^ 0x80) << 8); goto CONV_END;
|
|
conv_xx12_A100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END;
|
|
conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80); goto CONV_END;
|
|
-conv_x123_xxx1: as_u8(dst) = shift_down(as_u32c(src), 16); goto CONV_END;
|
|
-conv_x123_xx12: as_u16(dst) = shift_down(as_u32c(src), 8); goto CONV_END;
|
|
-conv_x123_xx21: as_u16(dst) = bswap_16(shift_down(as_u32c(src), 8)); goto CONV_END;
|
|
+conv_x123_xxx1: as_u8(dst) = as_u32c(src) >> 16; goto CONV_END;
|
|
+conv_x123_xx12: as_u16(dst) = as_u32c(src) >> 8; goto CONV_END;
|
|
+conv_x123_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
|
|
conv_x123_x123: as_u32(dst) = sx24(as_u32c(src)); goto CONV_END;
|
|
conv_x123_321x: as_u32(dst) = sx24s(bswap_32(as_u32c(src))); goto CONV_END;
|
|
conv_x123_1230: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
|
|
-conv_x123_0321: as_u32(dst) = shift_down(bswap_32(as_u32c(src)), 8); goto CONV_END;
|
|
- conv_x123_xxx9: as_u8(dst) = shift_down(as_u32c(src), 16) ^ 0x80; goto CONV_END;
|
|
-conv_x123_xx92: as_u16(dst) = shift_down(as_u32c(src), 8) ^ 0x8000; goto CONV_END;
|
|
-conv_x123_xx29: as_u16(dst) = bswap_16(shift_down(as_u32c(src), 8)) ^ 0x80; goto CONV_END;
|
|
+conv_x123_0321: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
|
|
+conv_x123_xxx9: as_u8(dst) = (as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
|
|
+conv_x123_xx92: as_u16(dst) = (as_u32c(src) >> 8) ^ 0x8000; goto CONV_END;
|
|
+conv_x123_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
|
|
conv_x123_x923: as_u32(dst) = sx24(as_u32c(src) ^ 0x800000); goto CONV_END;
|
|
conv_x123_329x: as_u32(dst) = sx24s(bswap_32(as_u32c(src)) ^ 0x8000); goto CONV_END;
|
|
conv_x123_9230: as_u32(dst) = (as_u32c(src) ^ 0x800000) << 8; goto CONV_END;
|
|
-conv_x123_0329: as_u32(dst) = shift_down(bswap_32(as_u32c(src)), 8) ^ 0x80; goto CONV_END;
|
|
-conv_123x_xxx3: as_u8(dst) = shift_down(as_u32c(src), 8) & 0xff; goto CONV_END;
|
|
-conv_123x_xx32: as_u16(dst) = bswap_16(shift_down(as_u32c(src), 8)); goto CONV_END;
|
|
-conv_123x_xx23: as_u16(dst) = shift_down(as_u32c(src), 8) & 0xffff; goto CONV_END;
|
|
+conv_x123_0329: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x80; goto CONV_END;
|
|
+conv_123x_xxx3: as_u8(dst) = (as_u32c(src) >> 8) & 0xff; goto CONV_END;
|
|
+conv_123x_xx32: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
|
|
+conv_123x_xx23: as_u16(dst) = (as_u32c(src) >> 8) & 0xffff; goto CONV_END;
|
|
conv_123x_x321: as_u32(dst) = sx24(bswap_32(as_u32c(src))); goto CONV_END;
|
|
conv_123x_123x: as_u32(dst) = sx24s(as_u32c(src)); goto CONV_END;
|
|
conv_123x_3210: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
|
|
-conv_123x_0123: as_u32(dst) = shift_down(as_u32c(src), 8); goto CONV_END;
|
|
-conv_123x_xxxB: as_u8(dst) = (shift_down(as_u32c(src), 8) & 0xff) ^ 0x80; goto CONV_END;
|
|
-conv_123x_xxB2: as_u16(dst) = bswap_16(shift_down(as_u32c(src), 8) ^ 0x80); goto CONV_END;
|
|
-conv_123x_xx2B: as_u16(dst) = (shift_down(as_u32c(src), 8) & 0xffff) ^ 0x80; goto CONV_END;
|
|
+conv_123x_0123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
|
|
+conv_123x_xxxB: as_u8(dst) = ((as_u32c(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
|
|
+conv_123x_xxB2: as_u16(dst) = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto CONV_END;
|
|
+conv_123x_xx2B: as_u16(dst) = ((as_u32c(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
|
|
conv_123x_xB21: as_u32(dst) = sx24(bswap_32(as_u32c(src)) ^ 0x800000); goto CONV_END;
|
|
conv_123x_12Bx: as_u32(dst) = sx24s(as_u32c(src) ^ 0x8000); goto CONV_END;
|
|
conv_123x_B210: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x8000) << 8; goto CONV_END;
|
|
-conv_123x_012B: as_u32(dst) = shift_down(as_u32c(src), 8) ^ 0x80; goto CONV_END;
|
|
-conv_1234_xxx1: as_u8(dst) = shift_down(as_u32c(src), 24); goto CONV_END;
|
|
-conv_1234_xx12: as_u16(dst) = shift_down(as_u32c(src), 16); goto CONV_END;
|
|
-conv_1234_xx21: as_u16(dst) = bswap_16(shift_down(as_u32c(src), 16)); goto CONV_END;
|
|
-conv_1234_x123: as_u32(dst) = sx24(shift_down(as_u32c(src), 8)); goto CONV_END;
|
|
+conv_123x_012B: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
|
|
+conv_1234_xxx1: as_u8(dst) = as_u32c(src) >> 24; goto CONV_END;
|
|
+conv_1234_xx12: as_u16(dst) = as_u32c(src) >> 16; goto CONV_END;
|
|
+conv_1234_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 16); goto CONV_END;
|
|
+conv_1234_x123: as_u32(dst) = sx24(as_u32c(src) >> 8); goto CONV_END;
|
|
conv_1234_321x: as_u32(dst) = sx24s(bswap_32(as_u32c(src)) << 8); goto CONV_END;
|
|
conv_1234_1234: as_u32(dst) = as_u32c(src); goto CONV_END;
|
|
conv_1234_4321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
|
|
-conv_1234_xxx9: as_u8(dst) = shift_down(as_u32c(src), 24) ^ 0x80; goto CONV_END;
|
|
-conv_1234_xx92: as_u16(dst) = shift_down(as_u32c(src), 16) ^ 0x8000; goto CONV_END;
|
|
-conv_1234_xx29: as_u16(dst) = bswap_16(shift_down(as_u32c(src), 16)) ^ 0x80; goto CONV_END;
|
|
-conv_1234_x923: as_u32(dst) = sx24(shift_down(as_u32c(src), 8) ^ 0x800000); goto CONV_END;
|
|
+conv_1234_xxx9: as_u8(dst) = (as_u32c(src) >> 24) ^ 0x80; goto CONV_END;
|
|
+conv_1234_xx92: as_u16(dst) = (as_u32c(src) >> 16) ^ 0x8000; goto CONV_END;
|
|
+conv_1234_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
|
|
+conv_1234_x923: as_u32(dst) = sx24((as_u32c(src) >> 8) ^ 0x800000); goto CONV_END;
|
|
conv_1234_329x: as_u32(dst) = sx24s((bswap_32(as_u32c(src)) ^ 0x80) << 8); goto CONV_END;
|
|
conv_1234_9234: as_u32(dst) = as_u32c(src) ^ 0x80000000; goto CONV_END;
|
|
conv_1234_4329: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x80; goto CONV_END;
|
|
conv_1234_xxx4: as_u8(dst) = as_u32c(src) & 0xff; goto CONV_END;
|
|
conv_1234_xx43: as_u16(dst) = bswap_16(as_u32c(src)); goto CONV_END;
|
|
conv_1234_xx34: as_u16(dst) = as_u32c(src) & 0xffff; goto CONV_END;
|
|
-conv_1234_x432: as_u32(dst) = sx24(shift_down(bswap_32(as_u32c(src)), 8)); goto CONV_END;
|
|
+conv_1234_x432: as_u32(dst) = sx24(bswap_32(as_u32c(src)) >> 8); goto CONV_END;
|
|
conv_1234_234x: as_u32(dst) = sx24s(as_u32c(src) << 8); goto CONV_END;
|
|
conv_1234_xxxC: as_u8(dst) = (as_u32c(src) & 0xff) ^ 0x80; goto CONV_END;
|
|
conv_1234_xxC3: as_u16(dst) = bswap_16(as_u32c(src) ^ 0x80); goto CONV_END;
|
|
conv_1234_xx3C: as_u16(dst) = (as_u32c(src) & 0xffff) ^ 0x80; goto CONV_END;
|
|
-conv_1234_xC32: as_u32(dst) = sx24(shift_down(bswap_32(as_u32c(src)), 8) ^ 0x800000); goto CONV_END;
|
|
+conv_1234_xC32: as_u32(dst) = sx24((bswap_32(as_u32c(src)) >> 8) ^ 0x800000); goto CONV_END;
|
|
conv_1234_23Cx: as_u32(dst) = sx24s((as_u32c(src) ^ 0x80) << 8); goto CONV_END;
|
|
conv_1234_C321: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x80); goto CONV_END;
|
|
conv_1234_123C: as_u32(dst) = as_u32c(src) ^ 0x80; goto CONV_END;
|
|
@@ -384,26 +382,26 @@ get16_12_92: sample = as_u16c(src) ^ 0x8
|
|
get16_12_92: sample = as_u16c(src) ^ 0x8000; goto GET16_END;
|
|
get16_12_21: sample = bswap_16(as_u16c(src)); goto GET16_END;
|
|
get16_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GET16_END;
|
|
-get16_0123_12: sample = shift_down(as_u32c(src), 8); goto GET16_END;
|
|
-get16_0123_92: sample = shift_down(as_u32c(src), 8) ^ 0x8000; goto GET16_END;
|
|
-get16_1230_32: sample = bswap_16(shift_down(as_u32c(src), 8)); goto GET16_END;
|
|
-get16_1230_B2: sample = bswap_16(shift_down(as_u32c(src), 8) ^ 0x80); goto GET16_END;
|
|
-get16_1234_12: sample = shift_down(as_u32c(src), 16); goto GET16_END;
|
|
-get16_1234_92: sample = shift_down(as_u32c(src), 16) ^ 0x8000; goto GET16_END;
|
|
+get16_0123_12: sample = as_u32c(src) >> 8; goto GET16_END;
|
|
+get16_0123_92: sample = (as_u32c(src) >> 8) ^ 0x8000; goto GET16_END;
|
|
+get16_1230_32: sample = bswap_16(as_u32c(src) >> 8); goto GET16_END;
|
|
+get16_1230_B2: sample = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto GET16_END;
|
|
+get16_1234_12: sample = as_u32c(src) >> 16; goto GET16_END;
|
|
+get16_1234_92: sample = (as_u32c(src) >> 16) ^ 0x8000; goto GET16_END;
|
|
get16_1234_43: sample = bswap_16(as_u32c(src)); goto GET16_END;
|
|
get16_1234_C3: sample = bswap_16(as_u32c(src) ^ 0x80); goto GET16_END;
|
|
-get16_123_12: sample = shift_down(_get_triple(src), 8); goto GET16_END;
|
|
-get16_123_92: sample = shift_down(_get_triple(src), 8) ^ 0x8000; goto GET16_END;
|
|
-get16_123_32: sample = shift_down(_get_triple_s(src), 8); goto GET16_END;
|
|
-get16_123_B2: sample = shift_down(_get_triple_s(src), 8) ^ 0x8000; goto GET16_END;
|
|
-get16_123_12_20: sample = shift_down(_get_triple(src), 4); goto GET16_END;
|
|
-get16_123_92_20: sample = shift_down(_get_triple(src), 4) ^ 0x8000; goto GET16_END;
|
|
-get16_123_32_20: sample = shift_down(_get_triple_s(src), 4); goto GET16_END;
|
|
-get16_123_B2_20: sample = shift_down(_get_triple_s(src), 4) ^ 0x8000; goto GET16_END;
|
|
-get16_123_12_18: sample = shift_down(_get_triple(src), 2); goto GET16_END;
|
|
-get16_123_92_18: sample = shift_down(_get_triple(src), 2) ^ 0x8000; goto GET16_END;
|
|
-get16_123_32_18: sample = shift_down(_get_triple_s(src), 2); goto GET16_END;
|
|
-get16_123_B2_18: sample = shift_down(_get_triple_s(src), 2) ^ 0x8000; goto GET16_END;
|
|
+get16_123_12: sample = _get_triple(src) >> 8; goto GET16_END;
|
|
+get16_123_92: sample = (_get_triple(src) >> 8) ^ 0x8000; goto GET16_END;
|
|
+get16_123_32: sample = _get_triple_s(src) >> 8; goto GET16_END;
|
|
+get16_123_B2: sample = (_get_triple_s(src) >> 8) ^ 0x8000; goto GET16_END;
|
|
+get16_123_12_20: sample = _get_triple(src) >> 4; goto GET16_END;
|
|
+get16_123_92_20: sample = (_get_triple(src) >> 4) ^ 0x8000; goto GET16_END;
|
|
+get16_123_32_20: sample = _get_triple_s(src) >> 4; goto GET16_END;
|
|
+get16_123_B2_20: sample = (_get_triple_s(src) >> 4) ^ 0x8000; goto GET16_END;
|
|
+get16_123_12_18: sample = _get_triple(src) >> 2; goto GET16_END;
|
|
+get16_123_92_18: sample = (_get_triple(src) >> 2) ^ 0x8000; goto GET16_END;
|
|
+get16_123_32_18: sample = _get_triple_s(src) >> 2; goto GET16_END;
|
|
+get16_123_B2_18: sample = (_get_triple_s(src) >> 2) ^ 0x8000; goto GET16_END;
|
|
}
|
|
#endif
|
|
|
|
@@ -431,8 +429,8 @@ static void *put16_labels[4 * 2 * 2] = {
|
|
|
|
#ifdef PUT16_END
|
|
while (0) {
|
|
-put16_12_1: as_u8(dst) = shift_down(sample, 8); goto PUT16_END;
|
|
-put16_12_9: as_u8(dst) = shift_down(sample, 8) ^ 0x80; goto PUT16_END;
|
|
+put16_12_1: as_u8(dst) = sample >> 8; goto PUT16_END;
|
|
+put16_12_9: as_u8(dst) = (sample >> 8) ^ 0x80; goto PUT16_END;
|
|
put16_12_12: as_u16(dst) = sample; goto PUT16_END;
|
|
put16_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT16_END;
|
|
put16_12_21: as_u16(dst) = bswap_16(sample); goto PUT16_END;
|
|
@@ -502,8 +500,8 @@ get32_12_A100: sample = (u_int32_t)bswap
|
|
get32_12_A100: sample = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END;
|
|
get32_0123_1230: sample = as_u32c(src) << 8; goto GET32_END;
|
|
get32_0123_9230: sample = (as_u32c(src) << 8) ^ 0x80000000; goto GET32_END;
|
|
-get32_1230_3210: sample = bswap_32(shift_down(as_u32c(src), 8)); goto GET32_END;
|
|
-get32_1230_B210: sample = bswap_32(shift_down(as_u32c(src), 8) ^ 0x80); goto GET32_END;
|
|
+get32_1230_3210: sample = bswap_32(as_u32c(src) >> 8); goto GET32_END;
|
|
+get32_1230_B210: sample = bswap_32((as_u32c(src) >> 8) ^ 0x80); goto GET32_END;
|
|
get32_1234_1234: sample = as_u32c(src); goto GET32_END;
|
|
get32_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GET32_END;
|
|
get32_1234_4321: sample = bswap_32(as_u32c(src)); goto GET32_END;
|
|
@@ -570,32 +568,32 @@ static void *put32_labels[4 * 2 * 2 + 4
|
|
|
|
#ifdef PUT32_END
|
|
while (0) {
|
|
-put32_1234_1: as_u8(dst) = shift_down(sample, 24); goto PUT32_END;
|
|
-put32_1234_9: as_u8(dst) = shift_down(sample, 24) ^ 0x80; goto PUT32_END;
|
|
-put32_1234_12: as_u16(dst) = shift_down(sample, 16); goto PUT32_END;
|
|
-put32_1234_92: as_u16(dst) = shift_down(sample, 16) ^ 0x8000; goto PUT32_END;
|
|
-put32_1234_21: as_u16(dst) = bswap_16(shift_down(sample, 16)); goto PUT32_END;
|
|
-put32_1234_29: as_u16(dst) = bswap_16(shift_down(sample, 16)) ^ 0x80; goto PUT32_END;
|
|
-put32_1234_0123: as_u32(dst) = sx24(shift_down(sample, 8)); goto PUT32_END;
|
|
-put32_1234_0923: as_u32(dst) = sx24(shift_down(sample, 8) ^ 0x800000); goto PUT32_END;
|
|
+put32_1234_1: as_u8(dst) = sample >> 24; goto PUT32_END;
|
|
+put32_1234_9: as_u8(dst) = (sample >> 24) ^ 0x80; goto PUT32_END;
|
|
+put32_1234_12: as_u16(dst) = sample >> 16; goto PUT32_END;
|
|
+put32_1234_92: as_u16(dst) = (sample >> 16) ^ 0x8000; goto PUT32_END;
|
|
+put32_1234_21: as_u16(dst) = bswap_16(sample >> 16); goto PUT32_END;
|
|
+put32_1234_29: as_u16(dst) = bswap_16(sample >> 16) ^ 0x80; goto PUT32_END;
|
|
+put32_1234_0123: as_u32(dst) = sx24(sample >> 8); goto PUT32_END;
|
|
+put32_1234_0923: as_u32(dst) = sx24((sample >> 8) ^ 0x800000); goto PUT32_END;
|
|
put32_1234_3210: as_u32(dst) = sx24s(bswap_32(sample) << 8); goto PUT32_END;
|
|
put32_1234_3290: as_u32(dst) = sx24s((bswap_32(sample) ^ 0x80) << 8); goto PUT32_END;
|
|
put32_1234_1234: as_u32(dst) = sample; goto PUT32_END;
|
|
put32_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT32_END;
|
|
put32_1234_4321: as_u32(dst) = bswap_32(sample); goto PUT32_END;
|
|
put32_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT32_END;
|
|
-put32_1234_123: _put_triple(dst, shift_down(sample, 8)); goto PUT32_END;
|
|
-put32_1234_923: _put_triple(dst, shift_down(sample ^ 0x80000000, 8)); goto PUT32_END;
|
|
-put32_1234_321: _put_triple_s(dst, shift_down(sample, 8)); goto PUT32_END;
|
|
-put32_1234_329: _put_triple_s(dst, shift_down(sample ^ 0x80000000, 8)); goto PUT32_END;
|
|
-put32_1234_123_20: _put_triple(dst, shift_down(sample, 12)); goto PUT32_END;
|
|
-put32_1234_923_20: _put_triple(dst, shift_down(sample ^ 0x80000000, 12)); goto PUT32_END;
|
|
-put32_1234_321_20: _put_triple_s(dst, shift_down(sample, 12)); goto PUT32_END;
|
|
-put32_1234_329_20: _put_triple_s(dst, shift_down(sample ^ 0x80000000, 12)); goto PUT32_END;
|
|
-put32_1234_123_18: _put_triple(dst, shift_down(sample, 14)); goto PUT32_END;
|
|
-put32_1234_923_18: _put_triple(dst, shift_down(sample ^ 0x80000000, 14)); goto PUT32_END;
|
|
-put32_1234_321_18: _put_triple_s(dst, shift_down(sample, 14)); goto PUT32_END;
|
|
-put32_1234_329_18: _put_triple_s(dst, shift_down(sample ^ 0x80000000, 14)); goto PUT32_END;
|
|
+put32_1234_123: _put_triple(dst, sample >> 8); goto PUT32_END;
|
|
+put32_1234_923: _put_triple(dst, (sample ^ 0x80000000) >> 8); goto PUT32_END;
|
|
+put32_1234_321: _put_triple_s(dst, sample >> 8); goto PUT32_END;
|
|
+put32_1234_329: _put_triple_s(dst, (sample ^ 0x80000000) >> 8); goto PUT32_END;
|
|
+put32_1234_123_20: _put_triple(dst, sample >> 12); goto PUT32_END;
|
|
+put32_1234_923_20: _put_triple(dst, (sample ^ 0x80000000) >> 12); goto PUT32_END;
|
|
+put32_1234_321_20: _put_triple_s(dst, sample >> 12); goto PUT32_END;
|
|
+put32_1234_329_20: _put_triple_s(dst, (sample ^ 0x80000000) >> 12); goto PUT32_END;
|
|
+put32_1234_123_18: _put_triple(dst, sample >> 14); goto PUT32_END;
|
|
+put32_1234_923_18: _put_triple(dst, (sample ^ 0x80000000) >> 14); goto PUT32_END;
|
|
+put32_1234_321_18: _put_triple_s(dst, sample >> 14); goto PUT32_END;
|
|
+put32_1234_329_18: _put_triple_s(dst, (sample ^ 0x80000000) >> 14); goto PUT32_END;
|
|
}
|
|
#endif
|
|
|
|
@@ -1081,4 +1079,3 @@ norms_32_s32s: _norms(src, dst, 32, 1,
|
|
#undef _put_triple_le
|
|
#undef _put_triple_be
|
|
|
|
-#undef shift_down
|
|
diff -r 9e2f117f24b9 src/seq/Makefile.am
|
|
--- a/src/seq/Makefile.am Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/seq/Makefile.am Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -2,6 +2,9 @@ EXTRA_LTLIBRARIES=libseq.la
|
|
|
|
libseq_la_SOURCES = seq_hw.c seq.c seq_event.c seqmid.c seq_midi_event.c \
|
|
seq_symbols.c
|
|
+if KEEP_OLD_SYMBOLS
|
|
+libseq_la_SOURCES += seq_old.c
|
|
+endif
|
|
noinst_HEADERS = seq_local.h
|
|
|
|
all: libseq.la
|
|
diff -r 9e2f117f24b9 src/seq/seq.c
|
|
--- a/src/seq/seq.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/seq/seq.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -2178,9 +2178,6 @@ void snd_seq_port_info_set_timestamp_que
|
|
* - #SND_SEQ_PORT_TYPE_MIDI_GS GS compatible device
|
|
* - #SND_SEQ_PORT_TYPE_MIDI_XG XG compatible device
|
|
* - #SND_SEQ_PORT_TYPE_MIDI_MT32 MT-32 compatible device
|
|
- * - #SND_SEQ_PORT_TYPE_SYNTH Understands SND_SEQ_EVENT_SAMPLE_xxx messages
|
|
- * - #SND_SEQ_PORT_TYPE_DIRECT_SAMPLE Supports SND_SEQ_EVENT_INSTR_xxx messages sent directly
|
|
- * - #SND_SEQ_PORT_TYPE_SAMPLE Supports SND_SEQ_EVENT_INSTR_xxx messages
|
|
* - #SND_SEQ_PORT_TYPE_HARDWARE Implemented in hardware
|
|
* - #SND_SEQ_PORT_TYPE_SOFTWARE Implemented in software
|
|
* - #SND_SEQ_PORT_TYPE_SYNTHESIZER Generates sound
|
|
@@ -4684,265 +4681,3 @@ int snd_seq_get_bit(int nr, void *array)
|
|
{
|
|
return ((((unsigned int *)array)[nr >> 5]) & (1UL << (nr & 31))) ? 1 : 0;
|
|
}
|
|
-
|
|
-
|
|
-/**
|
|
- * instrument layer
|
|
- */
|
|
-
|
|
-/**
|
|
- * \brief get size of #snd_instr_header_t
|
|
- * \return size in bytes
|
|
- */
|
|
-size_t snd_instr_header_sizeof(void)
|
|
-{
|
|
- return sizeof(snd_instr_header_t);
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief allocate an empty #snd_instr_header_t using standard malloc
|
|
- * \param ptr returned pointer
|
|
- * \param len additional data length
|
|
- * \return 0 on success otherwise negative error code
|
|
- */
|
|
-int snd_instr_header_malloc(snd_instr_header_t **ptr, size_t len)
|
|
-{
|
|
- assert(ptr);
|
|
- *ptr = calloc(1, sizeof(snd_instr_header_t) + len);
|
|
- if (!*ptr)
|
|
- return -ENOMEM;
|
|
- (*ptr)->len = len;
|
|
- return 0;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief frees a previously allocated #snd_instr_header_t
|
|
- * \param obj poitner to object to free
|
|
- */
|
|
-void snd_instr_header_free(snd_instr_header_t *obj)
|
|
-{
|
|
- free(obj);
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief copy one #snd_instr_header_t to another
|
|
- * \param dst pointer to destination
|
|
- * \param src pointer to source
|
|
- */
|
|
-void snd_instr_header_copy(snd_instr_header_t *dst, const snd_instr_header_t *src)
|
|
-{
|
|
- assert(dst && src);
|
|
- *dst = *src;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the instrument id of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return instrument id pointer
|
|
- */
|
|
-const snd_seq_instr_t *snd_instr_header_get_id(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return &info->id.instr;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the cluster id of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return cluster id
|
|
- */
|
|
-snd_seq_instr_cluster_t snd_instr_header_get_cluster(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return info->id.cluster;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the command of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return command type
|
|
- */
|
|
-unsigned int snd_instr_header_get_cmd(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return info->cmd;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the length of extra data of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return the length in bytes
|
|
- */
|
|
-size_t snd_instr_header_get_len(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return info->len;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the data name of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return the name string
|
|
- */
|
|
-const char *snd_instr_header_get_name(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return info->data.name;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the data type of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return the data type
|
|
- */
|
|
-int snd_instr_header_get_type(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return info->data.type;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the data format of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return the data format string
|
|
- */
|
|
-const char *snd_instr_header_get_format(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return info->data.data.format;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the data alias of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return the data alias id
|
|
- */
|
|
-const snd_seq_instr_t *snd_instr_header_get_alias(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return &info->data.data.alias;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the extra data pointer of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return the extra data pointer
|
|
- */
|
|
-void *snd_instr_header_get_data(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return (void*)((char*)info + sizeof(*info));
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Get the flag to follow alias of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \return 1 if follow alias
|
|
- */
|
|
-int snd_instr_header_get_follow_alias(const snd_instr_header_t *info)
|
|
-{
|
|
- assert(info);
|
|
- return (info->flags & SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS) ? 1 : 0;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the instrument id of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param id instrument id pointer
|
|
- */
|
|
-void snd_instr_header_set_id(snd_instr_header_t *info, const snd_seq_instr_t *id)
|
|
-{
|
|
- assert(info && id);
|
|
- info->id.instr = *id;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the cluster id of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param cluster cluster id
|
|
- */
|
|
-void snd_instr_header_set_cluster(snd_instr_header_t *info, snd_seq_instr_cluster_t cluster)
|
|
-{
|
|
- assert(info);
|
|
- info->id.cluster = cluster;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the command of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param cmd command type
|
|
- */
|
|
-void snd_instr_header_set_cmd(snd_instr_header_t *info, unsigned int cmd)
|
|
-{
|
|
- assert(info);
|
|
- info->cmd = cmd;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the length of extra data of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param len size of extra data in bytes
|
|
- */
|
|
-void snd_instr_header_set_len(snd_instr_header_t *info, size_t len)
|
|
-{
|
|
- assert(info);
|
|
- info->len = len;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the data name of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param name the name string
|
|
- */
|
|
-void snd_instr_header_set_name(snd_instr_header_t *info, const char *name)
|
|
-{
|
|
- assert(info && name);
|
|
- strncpy(info->data.name, name, sizeof(info->data.name));
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the data type of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param type the data type
|
|
- */
|
|
-void snd_instr_header_set_type(snd_instr_header_t *info, int type)
|
|
-{
|
|
- assert(info);
|
|
- info->data.type = type;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the data format of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param format the data format string
|
|
- */
|
|
-void snd_instr_header_set_format(snd_instr_header_t *info, const char *format)
|
|
-{
|
|
- assert(info && format);
|
|
- strncpy(info->data.data.format, format, sizeof(info->data.data.format));
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the data alias id of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param instr alias instrument id
|
|
- */
|
|
-void snd_instr_header_set_alias(snd_instr_header_t *info, const snd_seq_instr_t *instr)
|
|
-{
|
|
- assert(info && instr);
|
|
- info->data.data.alias = *instr;
|
|
-}
|
|
-
|
|
-/**
|
|
- * \brief Set the flag to follow alias of an instr_header container
|
|
- * \param info instr_header container
|
|
- * \param val 1 if follow alias
|
|
- */
|
|
-void snd_instr_header_set_follow_alias(snd_instr_header_t *info, int val)
|
|
-{
|
|
- assert(info);
|
|
- if (val)
|
|
- info->flags |= SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS;
|
|
- else
|
|
- info->flags &= ~SNDRV_SEQ_INSTR_QUERY_FOLLOW_ALIAS;
|
|
-}
|
|
diff -r 9e2f117f24b9 src/seq/seq_event.c
|
|
--- a/src/seq/seq_event.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/src/seq/seq_event.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -37,12 +37,8 @@ const unsigned int snd_seq_event_types[2
|
|
= FIXED_EV(SND_SEQ_EVFLG_MESSAGE),
|
|
[SND_SEQ_EVENT_PORT_SUBSCRIBED ... SND_SEQ_EVENT_PORT_UNSUBSCRIBED]
|
|
= FIXED_EV(SND_SEQ_EVFLG_CONNECTION),
|
|
- [SND_SEQ_EVENT_SAMPLE ... SND_SEQ_EVENT_SAMPLE_PRIVATE1]
|
|
- = FIXED_EV(SND_SEQ_EVFLG_SAMPLE),
|
|
[SND_SEQ_EVENT_USR0 ... SND_SEQ_EVENT_USR9]
|
|
= FIXED_EV(SND_SEQ_EVFLG_RAW) | FIXED_EV(SND_SEQ_EVFLG_USERS),
|
|
- [SND_SEQ_EVENT_INSTR_BEGIN ... SND_SEQ_EVENT_INSTR_CHANGE]
|
|
- = _SND_SEQ_TYPE(SND_SEQ_EVFLG_INSTR) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_VARUSR),
|
|
[SND_SEQ_EVENT_SYSEX ... SND_SEQ_EVENT_BOUNCE]
|
|
= _SND_SEQ_TYPE(SND_SEQ_EVFLG_VARIABLE),
|
|
[SND_SEQ_EVENT_USR_VAR0 ... SND_SEQ_EVENT_USR_VAR4]
|
|
diff -r 9e2f117f24b9 src/seq/seq_old.c
|
|
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
+++ b/src/seq/seq_old.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -0,0 +1,222 @@
|
|
+/*
|
|
+ * place-holders to keep libasound linkable to old binaries
|
|
+ */
|
|
+
|
|
+#ifndef DOXYGEN
|
|
+
|
|
+#include "local.h"
|
|
+
|
|
+size_t snd_instr_header_sizeof(void)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+int snd_instr_header_malloc(void **ptr ATTRIBUTE_UNUSED,
|
|
+ size_t len ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENOMEM;
|
|
+}
|
|
+
|
|
+void snd_instr_header_free(void *obj ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_copy(void *dst ATTRIBUTE_UNUSED,
|
|
+ const void *src ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+const void *snd_instr_header_get_id(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
+int snd_instr_header_get_cluster(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+unsigned int snd_instr_header_get_cmd(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+size_t snd_instr_header_get_len(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+const char *snd_instr_header_get_name(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
+int snd_instr_header_get_type(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+const char *snd_instr_header_get_format(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
+const void *snd_instr_header_get_alias(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
+void *snd_instr_header_get_data(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
+int snd_instr_header_get_follow_alias(const void *info ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_id(void *info ATTRIBUTE_UNUSED,
|
|
+ const void *id ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_cluster(void *info ATTRIBUTE_UNUSED,
|
|
+ int cluster ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_cmd(void *info ATTRIBUTE_UNUSED,
|
|
+ unsigned int cmd ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_len(void *info ATTRIBUTE_UNUSED,
|
|
+ size_t len ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_name(void *info ATTRIBUTE_UNUSED,
|
|
+ const char *name ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_type(void *info ATTRIBUTE_UNUSED,
|
|
+ int type ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_format(void *info ATTRIBUTE_UNUSED,
|
|
+ const char *format ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_alias(void *info ATTRIBUTE_UNUSED,
|
|
+ const void *instr ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+void snd_instr_header_set_follow_alias(void *info ATTRIBUTE_UNUSED,
|
|
+ int val ATTRIBUTE_UNUSED)
|
|
+{
|
|
+}
|
|
+
|
|
+int snd_instr_fm_free(void *fm ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+int snd_instr_fm_convert_to_stream(void *fm ATTRIBUTE_UNUSED,
|
|
+ const char *name ATTRIBUTE_UNUSED,
|
|
+ void **__data ATTRIBUTE_UNUSED,
|
|
+ size_t *__size ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+int snd_instr_fm_convert_from_stream(void *__data ATTRIBUTE_UNUSED,
|
|
+ size_t size ATTRIBUTE_UNUSED,
|
|
+ void **simple ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+
|
|
+int snd_instr_iwffff_open(void **handle ATTRIBUTE_UNUSED,
|
|
+ const char *name_fff ATTRIBUTE_UNUSED,
|
|
+ const char *name_dat ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+int snd_instr_iwffff_open_rom(void **handle ATTRIBUTE_UNUSED,
|
|
+ int card ATTRIBUTE_UNUSED,
|
|
+ int bank ATTRIBUTE_UNUSED,
|
|
+ int file ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+int snd_instr_iwffff_open_rom_file(void **handle ATTRIBUTE_UNUSED,
|
|
+ const char *name ATTRIBUTE_UNUSED,
|
|
+ int bank ATTRIBUTE_UNUSED,
|
|
+ int file ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+int snd_instr_iwffff_close(void *handle ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+int snd_instr_iwffff_free(void *__instr ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+int snd_instr_iwffff_load(void *iwf ATTRIBUTE_UNUSED,
|
|
+ int bank ATTRIBUTE_UNUSED,
|
|
+ int prg ATTRIBUTE_UNUSED,
|
|
+ void **__iwffff ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+int snd_instr_iwffff_convert_to_stream(void *iwffff ATTRIBUTE_UNUSED,
|
|
+ const char *name ATTRIBUTE_UNUSED,
|
|
+ void **__data ATTRIBUTE_UNUSED,
|
|
+ size_t *__size ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+int snd_instr_iwffff_convert_from_stream(void *data ATTRIBUTE_UNUSED,
|
|
+ size_t size ATTRIBUTE_UNUSED,
|
|
+ void **iwffff ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+
|
|
+int snd_instr_simple_free(void *simple ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+int snd_instr_simple_convert_to_stream(void *simple ATTRIBUTE_UNUSED,
|
|
+ const char *name ATTRIBUTE_UNUSED,
|
|
+ void **__data ATTRIBUTE_UNUSED,
|
|
+ size_t *__size ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+int snd_instr_simple_convert_from_stream(void *__data ATTRIBUTE_UNUSED,
|
|
+ size_t size ATTRIBUTE_UNUSED,
|
|
+ void **simple ATTRIBUTE_UNUSED)
|
|
+{
|
|
+ return -ENXIO;
|
|
+}
|
|
+
|
|
+#endif /* !DOXYGEN */
|
|
diff -r 9e2f117f24b9 test/midiloop.c
|
|
--- a/test/midiloop.c Mon Oct 15 10:36:46 2007 +0200
|
|
+++ b/test/midiloop.c Fri Dec 14 15:27:53 2007 +0100
|
|
@@ -133,6 +133,8 @@ int main(int argc, char** argv)
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
+ snd_rawmidi_nonblock(handle_in, 0);
|
|
+
|
|
patsize = writepattern(handle_out, obuf);
|
|
gettimeofday(&start, NULL);
|
|
patsize = writepattern(handle_out, obuf);
|