huge correction of tabulators and whitespaces

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-07 14:27:38 +01:00
parent b37ac0982b
commit 66a3d542ac
157 changed files with 2008 additions and 2008 deletions

View file

@ -109,7 +109,7 @@ static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, vo
*
* \see snd_async_add_pcm_handler, snd_async_add_ctl_handler
*/
int snd_async_add_handler(snd_async_handler_t **handler, int fd,
int snd_async_add_handler(snd_async_handler_t **handler, int fd,
snd_async_callback_t callback, void *private_data)
{
snd_async_handler_t *h;

View file

@ -51,7 +51,7 @@ any surplus whitespace is discarded. For example, the two sequences
and
\code
a 1
a 1
b 2
\endcode
@ -255,8 +255,8 @@ name [=] value [,|;]
# Compound assignment (first style)
name [=] {
name1 [=] value [,|;]
...
name1 [=] value [,|;]
...
}
# Compound assignment (second style)
@ -264,9 +264,9 @@ name.name1 [=] value [,|;]
# Array assignment (first style)
name [
value0 [,|;]
value1 [,|;]
...
value0 [,|;]
value1 [,|;]
...
]
# Array assignment (second style)
@ -377,7 +377,7 @@ values in the current compound are used as configuration for the function.
If the compound func.\<function_name\> is defined in the root node, then the
library and function from this compound configuration are used, otherwise
'snd_func_' is prefixed to the string and code from the ALSA library is used.
The definition of a function looks like:</P>
The definition of a function looks like:</P>
\code
func.remove_first_char {
@ -868,10 +868,10 @@ static int get_char_skip_comments(input_t *input)
break;
}
}
return c;
}
static int get_nonwhite(input_t *input)
{
@ -1057,7 +1057,7 @@ static int get_freestring(char **string, int id, input_t *input)
free_local_string(&str);
return c;
}
static int get_delimstring(char **string, int delim, input_t *input)
{
struct local_string str;
@ -1145,7 +1145,7 @@ static int _snd_config_make(snd_config_t **config, char **id, snd_config_type_t
*config = n;
return 0;
}
static int _snd_config_make_add(snd_config_t **config, char **id,
snd_config_type_t type, snd_config_t *parent)
@ -1162,7 +1162,7 @@ static int _snd_config_make_add(snd_config_t **config, char **id,
return 0;
}
static int _snd_config_search(snd_config_t *config,
static int _snd_config_search(snd_config_t *config,
const char *id, int len, snd_config_t **result)
{
snd_config_iterator_t i, next;
@ -1225,16 +1225,16 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input,
return -EINVAL;
}
} else {
if (i <= INT_MAX)
if (i <= INT_MAX)
err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER, parent);
else
err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER64, parent);
if (err < 0)
return err;
}
if (n->type == SND_CONFIG_TYPE_INTEGER)
if (n->type == SND_CONFIG_TYPE_INTEGER)
n->u.integer = (long) i;
else
else
n->u.integer64 = i;
*_n = n;
return 0;
@ -1341,7 +1341,7 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
err = 0;
__end:
free(id);
return err;
return err;
}
static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int override)
@ -1505,7 +1505,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
free(id);
return err;
}
static int parse_defs(snd_config_t *parent, input_t *input, int skip, int override)
{
int c, err;
@ -2774,7 +2774,7 @@ __make:
int snd_config_imake_integer(snd_config_t **config, const char *id, const long value)
{
int err;
err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER);
if (err < 0)
return err;
@ -2804,7 +2804,7 @@ int snd_config_imake_integer(snd_config_t **config, const char *id, const long v
int snd_config_imake_integer64(snd_config_t **config, const char *id, const long long value)
{
int err;
err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER64);
if (err < 0)
return err;
@ -2831,7 +2831,7 @@ int snd_config_imake_integer64(snd_config_t **config, const char *id, const long
int snd_config_imake_real(snd_config_t **config, const char *id, const double value)
{
int err;
err = snd_config_make(config, id, SND_CONFIG_TYPE_REAL);
if (err < 0)
return err;
@ -2862,7 +2862,7 @@ int snd_config_imake_string(snd_config_t **config, const char *id, const char *v
{
int err;
snd_config_t *tmp;
err = snd_config_make(&tmp, id, SND_CONFIG_TYPE_STRING);
if (err < 0)
return err;
@ -2950,7 +2950,7 @@ int snd_config_imake_safe_string(snd_config_t **config, const char *id, const ch
int snd_config_imake_pointer(snd_config_t **config, const char *id, const void *value)
{
int err;
err = snd_config_make(config, id, SND_CONFIG_TYPE_POINTER);
if (err < 0)
return err;
@ -4422,7 +4422,7 @@ static int _snd_config_hook_table(snd_config_t *root, snd_config_t *config, snd_
int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED)
{
int card = -1, err;
do {
err = snd_card_next(&card);
if (err < 0)
@ -4478,7 +4478,7 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config,
SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK);
#endif
/**
/**
* \brief Updates a configuration tree by rereading the configuration files (if needed).
* \param[in,out] _top Address of the handle to the top-level node.
* \param[in,out] _update Address of a pointer to private update information.
@ -4514,7 +4514,7 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
snd_config_update_t *local;
snd_config_update_t *update;
snd_config_t *top;
assert(_top && _update);
top = *_top;
update = *_update;
@ -4608,12 +4608,12 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
return err;
_reread:
*_top = NULL;
*_update = NULL;
if (update) {
snd_config_update_free(update);
update = NULL;
}
*_top = NULL;
*_update = NULL;
if (update) {
snd_config_update_free(update);
update = NULL;
}
if (top) {
snd_config_delete(top);
top = NULL;
@ -4648,7 +4648,7 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
return 1;
}
/**
/**
* \brief Updates #snd_config by rereading the global configuration files (if needed).
* \return 0 if #snd_config was up to date, 1 if #snd_config was
* updated, otherwise a negative error code.
@ -4744,7 +4744,7 @@ void snd_config_unref(snd_config_t *cfg)
snd_config_unlock();
}
/**
/**
* \brief Frees a private update structure.
* \param[in] update The private update structure to free.
* \return Zero if successful, otherwise a negative error code.
@ -4761,7 +4761,7 @@ int snd_config_update_free(snd_config_update_t *update)
return 0;
}
/**
/**
* \brief Frees the global configuration tree in #snd_config.
* \return Zero if successful, otherwise a negative error code.
*
@ -4881,7 +4881,7 @@ typedef int (*snd_config_walk_callback_t)(snd_config_t *src,
static int snd_config_walk(snd_config_t *src,
snd_config_t *root,
snd_config_t **dst,
snd_config_t **dst,
snd_config_walk_callback_t callback,
snd_config_expand_fcn_t fcn,
void *private_data)
@ -5221,7 +5221,7 @@ static int _snd_config_evaluate(snd_config_t *src,
* replaces those nodes with the respective function results.
*/
int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
snd_config_t *private_data, snd_config_t **result)
snd_config_t *private_data, snd_config_t **result)
{
/* FIXME: Only in place evaluation is currently implemented */
assert(result == NULL);
@ -5408,7 +5408,7 @@ static int parse_string(const char **ptr, char **val)
buf[idx++] = c;
}
}
/* Parse var=val or val */
static int parse_arg(const char **ptr, unsigned int *varlen, char **val)
@ -5508,7 +5508,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
}
return 0;
}
while (1) {
char buf[256];
const char *var = buf;
@ -5725,7 +5725,7 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args
*result = res;
err = 1;
_end:
if (subs)
if (subs)
snd_config_delete(subs);
return err;
}

View file

@ -5,7 +5,7 @@
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Jaroslav Kysela <perex@perex.cz>
* \date 2000-2001
*
*
* Configuration helper functions.
*
* See the \ref conffunc page for more details.
@ -176,7 +176,7 @@ int snd_config_get_card(const snd_config_t *conf)
* \brief Gets the control interface index from the given ASCII string.
* \param ascii The string to be parsed.
* \return The control interface index if successful, otherwise a negative error code.
*/
*/
int snd_config_get_ctl_iface_ascii(const char *ascii)
{
long v;
@ -199,7 +199,7 @@ int snd_config_get_ctl_iface_ascii(const char *ascii)
* \brief Gets the control interface index from a configuration node.
* \param conf Handle to the configuration node to be parsed.
* \return The control interface index if successful, otherwise a negative error code.
*/
*/
int snd_config_get_ctl_iface(const snd_config_t *conf)
{
long v;
@ -251,7 +251,7 @@ int snd_config_get_ctl_iface(const snd_config_t *conf)
default 0
}
\endcode
*/
*/
int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data)
{
@ -260,7 +260,7 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
const char *res, *id;
char *def = NULL;
int idx = 0, err, hit;
err = snd_config_search(src, "vars", &n);
if (err < 0) {
snd_error(CORE, "field vars not found");
@ -351,7 +351,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
default 0
}
\endcode
*/
*/
int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data)
{
@ -385,7 +385,7 @@ int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
#ifndef DOC_HIDDEN
SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
#endif
/**
* \brief Merges the given strings.
* \param dst The function puts the handle to the result configuration node
@ -402,7 +402,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
strings [ "a1" "b2" "c3" ]
}
\endcode
*/
*/
int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data)
{
@ -411,7 +411,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
const char *id;
char *res = NULL, *tmp;
int idx = 0, len = 0, len1, err, hit;
err = snd_config_search(src, "strings", &n);
if (err < 0) {
snd_error(CORE, "field strings not found");
@ -490,7 +490,7 @@ static int snd_func_iops(snd_config_t **dst,
char *res = NULL;
long result = 0, val;
int idx = 0, err, hit;
err = snd_config_search(src, "integers", &n);
if (err < 0) {
snd_error(CORE, "field integers not found");
@ -556,9 +556,9 @@ static int snd_func_iops(snd_config_t **dst,
integers [ 2 3 5 ]
}
\endcode
*/
*/
int snd_func_iadd(snd_config_t **dst, snd_config_t *root,
snd_config_t *src, snd_config_t *private_data)
snd_config_t *src, snd_config_t *private_data)
{
return snd_func_iops(dst, root, src, private_data, 0);
}
@ -582,7 +582,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_iadd, SND_CONFIG_DLSYM_VERSION_EVALUATE);
integers [ 2 3 2 ]
}
\endcode
*/
*/
int snd_func_imul(snd_config_t **dst, snd_config_t *root,
snd_config_t *src, snd_config_t *private_data)
{
@ -607,13 +607,13 @@ SND_DLSYM_BUILD_VERSION(snd_func_imul, SND_CONFIG_DLSYM_VERSION_EVALUATE);
@func datadir
}
\endcode
*/
*/
int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *src, snd_config_t *private_data ATTRIBUTE_UNUSED)
{
int err;
const char *id;
err = snd_config_get_id(src, &id);
if (err < 0)
return err;
@ -683,7 +683,7 @@ notfound:
@func private_string
}
\endcode
*/
*/
int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *src, snd_config_t *private_data)
{
@ -797,7 +797,7 @@ int snd_determine_driver(int card, char **driver)
@func private_card_driver
}
\endcode
*/
*/
int snd_func_private_card_driver(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src,
snd_config_t *private_data)
{
@ -834,7 +834,7 @@ static int parse_card(snd_config_t *root, snd_config_t *src,
snd_config_t *n;
char *str;
int card, err;
err = snd_config_search(src, "card", &n);
if (err < 0) {
snd_error(CORE, "field card not found");
@ -873,13 +873,13 @@ static int parse_card(snd_config_t *root, snd_config_t *src,
card '0'
}
\endcode
*/
*/
int snd_func_card_inum(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data)
{
const char *id;
int card, err;
card = parse_card(root, src, private_data);
if (card < 0)
return card;
@ -908,13 +908,13 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_inum, SND_CONFIG_DLSYM_VERSION_EVALUATE);
card 0
}
\endcode
*/
*/
int snd_func_card_driver(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data)
{
snd_config_t *val;
int card, err;
card = parse_card(root, src, private_data);
if (card < 0)
return card;
@ -945,7 +945,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_driver, SND_CONFIG_DLSYM_VERSION_EVALUATE)
card 0
}
\endcode
*/
*/
int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data)
{
@ -953,7 +953,7 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_ctl_card_info_t info = {0};
const char *id;
int card, err;
card = parse_card(root, src, private_data);
if (card < 0)
return card;
@ -972,8 +972,8 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
err = snd_config_imake_string(dst, id,
snd_ctl_card_info_get_id(&info));
__error:
if (ctl)
snd_ctl_close(ctl);
if (ctl)
snd_ctl_close(ctl);
return err;
}
#ifndef DOC_HIDDEN
@ -996,7 +996,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
card 0
}
\endcode
*/
*/
int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
snd_config_t *src, snd_config_t *private_data)
{
@ -1004,7 +1004,7 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
snd_ctl_card_info_t info = {0};
const char *id;
int card, err;
card = parse_card(root, src, private_data);
if (card < 0)
return card;
@ -1023,8 +1023,8 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
err = snd_config_imake_safe_string(dst, id,
snd_ctl_card_info_get_name(&info));
__error:
if (ctl)
snd_ctl_close(ctl);
if (ctl)
snd_ctl_close(ctl);
return err;
}
#ifndef DOC_HIDDEN
@ -1033,7 +1033,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE);
#ifdef DOXYGEN
/* For consistency with the PCM Interface module, include documentation even
* when PCM module is not included in the build. */
* when PCM module is not included in the build. */
#ifndef BUILD_PCM
#define BUILD_PCM
#endif
@ -1060,7 +1060,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE);
subdevice 0 # optional
}
\endcode
*/
*/
int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
@ -1069,7 +1069,7 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
const char *id;
long card, device, subdevice = 0;
int err;
card = parse_card(root, src, private_data);
if (card < 0)
return card;
@ -1117,8 +1117,8 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
err = snd_config_imake_string(dst, id,
snd_pcm_info_get_id(&info));
__error:
if (ctl)
snd_ctl_close(ctl);
if (ctl)
snd_ctl_close(ctl);
return err;
}
#ifndef DOC_HIDDEN
@ -1144,7 +1144,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
index 0
}
\endcode
*/
*/
int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
@ -1217,14 +1217,14 @@ int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_confi
index == idx++)
goto __out;
}
snd_ctl_close(ctl);
snd_ctl_close(ctl);
ctl = NULL;
}
err = -ENODEV;
__out:
if (ctl)
snd_ctl_close(ctl);
if (ctl)
snd_ctl_close(ctl);
if (err < 0)
return err;
if((err = snd_config_get_id(src, &id)) >= 0) {
@ -1254,7 +1254,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_pcm_args_by_class, SND_CONFIG_DLSYM_VERSION_EVA
@func private_pcm_subdevice
}
\endcode
*/
*/
int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *src, snd_config_t *private_data)
{
@ -1314,14 +1314,14 @@ SND_DLSYM_BUILD_VERSION(snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION
name "id1.id2.id3"
}
\endcode
*/
*/
int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
snd_config_t *private_data)
{
snd_config_t *n;
const char *file = NULL, *name = NULL;
int err;
err = snd_config_search(src, "file", &n);
if (err >= 0) {
err = snd_config_evaluate(n, root, private_data, NULL);

View file

@ -108,7 +108,7 @@ int snd_card_load(int card)
int snd_card_next(int *rcard)
{
int card;
if (rcard == NULL)
return -EINVAL;
card = *rcard;
@ -194,7 +194,7 @@ int snd_card_get_name(int card, char **name)
snd_ctl_t *handle;
snd_ctl_card_info_t info;
int err;
if (name == NULL)
return -EINVAL;
if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0)
@ -224,7 +224,7 @@ int snd_card_get_longname(int card, char **name)
snd_ctl_t *handle;
snd_ctl_card_info_t info;
int err;
if (name == NULL)
return -EINVAL;
if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0)

View file

@ -52,7 +52,7 @@ file. The format is:
\verbatim
index [ID ] Driver - name
longname
longname
\endverbatim
Note that the mixername and components are not listed.
@ -279,7 +279,7 @@ int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mod
*ctlp = ctl;
return 0;
}
/**
* \brief set async mode
@ -353,7 +353,7 @@ int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsign
return ctl->ops->poll_revents(ctl, pfds, nfds, revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
return 0;
}
return -EINVAL;
}
@ -1039,7 +1039,7 @@ int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *data)
static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag,
const snd_ctl_elem_id_t *id,
unsigned int *tlv, unsigned int tlv_size)
unsigned int *tlv, unsigned int tlv_size)
{
snd_ctl_elem_info_t *info = NULL;
int err;
@ -1060,8 +1060,8 @@ static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag,
}
err = ctl->ops->element_tlv(ctl, op_flag, id->numid, tlv, tlv_size);
__err:
if (info)
free(info);
if (info)
free(info);
return err;
}
@ -1402,7 +1402,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
* \param private_data Callback private data
* \return 0 otherwise a negative error code on failure
*/
int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl,
snd_async_callback_t callback, void *private_data)
{
int err;
@ -1752,7 +1752,7 @@ int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries
}
obj->space = entries;
return 0;
}
}
/**
* \brief free previously allocated space for CTL element identifiers list

View file

@ -42,7 +42,7 @@ const char *_snd_module_control_ext = "";
static int snd_ctl_ext_close(snd_ctl_t *handle)
{
snd_ctl_ext_t *ext = handle->private_data;
if (ext->callback->close)
ext->callback->close(ext);
return 0;
@ -458,7 +458,7 @@ static int snd_ctl_ext_poll_revents(snd_ctl_t *handle, struct pollfd *pfds, unsi
return ext->callback->poll_revents(ext, pfds, nfds, revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
return 0;
}
return -EINVAL;
}
@ -529,7 +529,7 @@ usually you will call the external plugin API function
#snd_ctl_ext_create().
The control handle must be filled *phandle in return.
Then this function must return either a value 0 when succeeded, or a
negative value as the error code.
negative value as the error code.
Finally, add #SND_CTL_PLUGIN_SYMBOL() with the name of your
plugin as the argument at the end. This defines the proper versioned
@ -625,7 +625,7 @@ PCM.
\section ctl_ext_impl_cb Callback Functions of External Control Plugins
The callback functions in #snd_ctl_ext_callback_t define the real
behavior of the driver. There are many callbacks but many of them are optional.
behavior of the driver. There are many callbacks but many of them are optional.
The close callback is called when the PCM is closed. If the plugin
allocates private resources, this is the place to release them
@ -650,7 +650,7 @@ if you use get, read and write callbacks as follows.
If you need to create a record dynamically (e.g. via malloc) at each find_elem call,
the allocated record can be released with the optional free_key callback.
The get_attribute is a mandatory callback, which returns the attribute of the
The get_attribute is a mandatory callback, which returns the attribute of the
control element given via a key value (converted with find_elem callback).
It must fill the control element type (#snd_ctl_elem_type_t), the access type
(#snd_ctl_ext_access_t), and the count (element array size). The callback returns

View file

@ -225,20 +225,20 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
unsigned int inum;
snd_ctl_hw_t *hw = handle->private_data;
struct snd_ctl_tlv *xtlv;
/* we don't support TLV on protocol ver 2.0.3 or earlier */
if (hw->protocol < SNDRV_PROTOCOL_VERSION(2, 0, 4))
return -ENXIO;
switch (op_flag) {
case -1: inum = SNDRV_CTL_IOCTL_TLV_COMMAND; break;
case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break;
case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break;
case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break;
default: return -EINVAL;
}
xtlv = malloc(sizeof(struct snd_ctl_tlv) + tlv_size);
if (xtlv == NULL)
return -ENOMEM;
return -ENOMEM;
xtlv->numid = numid;
xtlv->length = tlv_size;
memcpy(xtlv->tlv, tlv, tlv_size);
@ -435,7 +435,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
snd_ctl_hw_t *hw;
int err;
*handle = NULL;
*handle = NULL;
if (CHECK_SANITY(card < 0 || card >= SND_MAX_CARDS)) {
snd_check(CONTROL, "Invalid card index %d", card);

View file

@ -85,7 +85,7 @@ struct _snd_hctl_elem {
struct _snd_hctl {
snd_ctl_t *ctl;
struct list_head elems; /* list of all controls */
unsigned int alloc;
unsigned int alloc;
unsigned int count;
snd_hctl_elem_t **pelems;
snd_hctl_compare_t compare;

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@ -420,7 +420,7 @@ static int make_local_socket(const char *filename)
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0)
return -errno;
addr->sun_family = AF_LOCAL;
memcpy(addr->sun_path, filename, l);
@ -492,7 +492,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
result = -errno;
goto _err;
}
shm = calloc(1, sizeof(snd_ctl_shm_t));
if (!shm) {
result = -ENOMEM;

View file

@ -31,7 +31,7 @@ static const char **snd_control_open_objects[] = {
&_snd_module_control_empty,
#include "ctl_symbols_list.c"
};
void *snd_control_open_symbols(void)
{
return snd_control_open_objects;

View file

@ -253,7 +253,7 @@ int __snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str,
if (*str)
goto out;
}
}
}
err = 0;
out:
@ -277,12 +277,12 @@ int snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str)
static int get_ctl_enum_item_index(snd_ctl_t *handle,
snd_ctl_elem_info_t *info,
const char **ptrp)
{
{
char *ptr = (char *)*ptrp;
int items, i, len;
const char *name;
char end;
items = snd_ctl_elem_info_get_items(info);
if (items <= 0)
return -1;
@ -362,7 +362,7 @@ int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
if (count > get_ctl_type_max_elements(type))
count = get_ctl_type_max_elements(type);
for (idx = 0; idx < count && ptr && *ptr; idx++) {
if (*ptr == ',')
goto skip;

View file

@ -71,7 +71,7 @@ int snd_hctl_open(snd_hctl_t **hctlp, const char *name, int mode)
{
snd_ctl_t *ctl;
int err;
if ((err = snd_ctl_open(&ctl, name, mode)) < 0)
return err;
err = snd_hctl_open_ctl(hctlp, ctl);
@ -294,7 +294,7 @@ static int get_compare_weight(const snd_ctl_elem_id_t *id)
};
const char *name = (char *)id->name, *name1;
int res, res1;
if ((res = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names, 1000000)) == NOT_FOUND)
return NOT_FOUND;
if (*name == '\0')
@ -346,7 +346,7 @@ static int _snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id, in
static int snd_hctl_elem_add(snd_hctl_t *hctl, snd_hctl_elem_t *elem)
{
int dir;
int idx;
int idx;
elem->compare_weight = get_compare_weight(&elem->id);
if (hctl->count == hctl->alloc) {
snd_hctl_elem_t **h;
@ -677,7 +677,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
struct pollfd *pfd;
unsigned short *revents;
int i, npfds, pollio, err, err_poll;
npfds = snd_hctl_poll_descriptors_count(hctl);
if (npfds <= 0 || npfds >= 16) {
snd_error(CONTROL, "Invalid poll_fds %d", npfds);
@ -781,7 +781,7 @@ int snd_hctl_handle_events(snd_hctl_t *hctl)
snd_ctl_event_t event;
int res;
unsigned int count = 0;
assert(hctl);
assert(hctl->ctl);
while ((res = snd_ctl_read(hctl->ctl, &event)) != 0 &&

View file

@ -37,7 +37,7 @@ struct hint_list {
const char *siface;
snd_ctl_elem_iface_t iface;
snd_ctl_t *ctl;
snd_ctl_card_info_t *info;
snd_ctl_card_info_t *info;
int card;
int device;
long device_input;
@ -173,7 +173,7 @@ static char *get_dev_name(struct hint_list *list)
{
char *str1, *str2, *res;
int device;
device = list->device_input >= 0 ? list->device_input : list->device;
if (get_dev_name1(list, &str1, device, 1) < 0)
return NULL;
@ -261,7 +261,7 @@ static int try_config(snd_config_t *config,
snd_config_get_string(cfg, &str) >= 0 &&
((strncmp(base, str, strlen(base)) == 0 &&
str[strlen(base)] == '.') || strchr(str, '.') == NULL))
goto __skip_add;
goto __skip_add;
if (list->card >= 0 && list->device >= 0)
sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device);
else if (list->card >= 0)
@ -294,7 +294,7 @@ static int try_config(snd_config_t *config,
cfg1 = res;
level = 0;
__hint:
level++;
level++;
if (snd_config_search(cfg1, "type", &cfg) >= 0 &&
snd_config_get_string(cfg, &str) >= 0 &&
strcmp(str, "hw") == 0) {
@ -306,7 +306,7 @@ static int try_config(snd_config_t *config,
}
}
}
if (snd_config_search(cfg1, "hint", &cfg) >= 0) {
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
snd_error(CONTROL, "hint (%s) must be a compound", buf);
@ -363,7 +363,7 @@ static int try_config(snd_config_t *config,
goto __skip_add;
if (snd_config_search(cfg1, "slave", &cfg) >= 0 &&
snd_config_search(cfg, base, &cfg1) >= 0)
goto __hint;
goto __hint;
snd_config_delete(res);
res = NULL;
cleanup_res = 0;
@ -395,38 +395,38 @@ static int try_config(snd_config_t *config,
__ok:
err = 0;
__cleanup:
if (err >= 0) {
list->device = dev;
str = list->card >= 0 ? get_dev_name(list) : NULL;
if (str != NULL) {
level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str);
buf2 = realloc((char *)str, level + 1);
if (buf2 != NULL) {
if (buf1 != NULL) {
str = strchr(buf2, '|');
if (str != NULL)
if (err >= 0) {
list->device = dev;
str = list->card >= 0 ? get_dev_name(list) : NULL;
if (str != NULL) {
level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str);
buf2 = realloc((char *)str, level + 1);
if (buf2 != NULL) {
if (buf1 != NULL) {
str = strchr(buf2, '|');
if (str != NULL)
memmove(buf2 + (level - strlen(str)), str, strlen(str));
else
str = buf2 + strlen(buf2);
*(char *)str++ = '\n';
memcpy((char *)str, buf1, strlen(buf1));
buf2[level] = '\0';
*(char *)str++ = '\n';
memcpy((char *)str, buf1, strlen(buf1));
buf2[level] = '\0';
free(buf1);
}
buf1 = buf2;
} else {
free((char *)str);
}
} else if (list->device >= 0)
goto __skip_add;
err = hint_list_add(list, buf, buf1);
} else if (list->device >= 0)
goto __skip_add;
err = hint_list_add(list, buf, buf1);
}
__skip_add:
if (res && cleanup_res)
snd_config_delete(res);
snd_config_delete(res);
if (buf1)
free(buf1);
free(buf);
free(buf);
return err;
}
@ -455,7 +455,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l
char ctl_name[16];
snd_ctl_card_info_t info = {0};
int device, max_device = 0;
list->info = &info;
err = snd_config_search(config, list->siface, &conf);
if (err < 0)
@ -471,7 +471,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l
n = snd_config_iterator_entry(i);
if (snd_config_get_id(n, &str) < 0)
continue;
if (next_devices[list->iface] != NULL) {
list->card = card;
device = max_device = -1;
@ -510,7 +510,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l
}
err = 0;
__error:
snd_ctl_close(list->ctl);
snd_ctl_close(list->ctl);
return err;
}
@ -665,9 +665,9 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
if (!err && !list.list)
err = hint_list_add(&list, NULL, NULL);
if (err < 0)
snd_device_name_free_hint((void **)list.list);
snd_device_name_free_hint((void **)list.list);
else
*hints = (void **)list.list;
*hints = (void **)list.list;
free(list.cardname);
if (local_config_rw)
snd_config_delete(local_config_rw);
@ -726,7 +726,7 @@ char *snd_device_name_get_hint(const void *hint, const char *id)
return NULL;
hint1 = delim + 1;
continue;
}
}
if (delim == NULL)
return strdup(hint1 + 4);
size = delim - hint1 - 4;

View file

@ -564,14 +564,14 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
if (err < 0)
goto _err;
}
err = snd_config_get_ctl_elem_value(value, h->ctl, elem->val, elem->mask, elem->info);
if (err < 0)
goto _err;
list_add_tail(&elem->list, &h->elems);
_err:
if (err < 0 && elem) {
if (err < 0 && elem) {
if (elem->id)
snd_ctl_elem_id_free(elem->id);
if (elem->info)

View file

@ -211,7 +211,7 @@ static int snd_dlsym_verify(void *handle, const char *name, const char *version)
#ifdef HAVE_LIBDL
int res;
char *vname;
if (handle == NULL)
return -EINVAL;
vname = alloca(1 + strlen(name) + strlen(version) + 1);
@ -332,8 +332,8 @@ snd_dlobj_cache_get0(const char *lib, const char *name,
errbuf[0] = '\0';
dlobj = INTERNAL(snd_dlopen)(lib, RTLD_NOW,
verbose ? errbuf : 0,
verbose ? sizeof(errbuf) : 0);
verbose ? errbuf : 0,
verbose ? sizeof(errbuf) : 0);
if (dlobj == NULL) {
if (verbose)
snd_error(CORE, "Cannot open shared library %s (%s)",

View file

@ -209,7 +209,7 @@ int snd_hwdep_open_lconf(snd_hwdep_t **hwdep, const char *name,
int snd_hwdep_close(snd_hwdep_t *hwdep)
{
int err;
assert(hwdep);
assert(hwdep);
err = hwdep->ops->close(hwdep);
if (hwdep->dl_handle)
snd_dlclose(hwdep->dl_handle);
@ -296,14 +296,14 @@ int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned
*/
int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{
assert(hwdep && pfds && revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
}
return -EINVAL;
}
assert(hwdep && pfds && revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
}
return -EINVAL;
}
/**
* \brief set nonblock mode
* \param hwdep HwDep handle

View file

@ -111,7 +111,7 @@ int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int devi
assert(handle);
*handle = NULL;
if (card < 0 || card >= SND_MAX_CARDS)
return -EINVAL;
sprintf(filename, SNDRV_FILE_HWDEP, card, device);

View file

@ -25,7 +25,7 @@ extern const char *_snd_module_hwdep_hw;
static const char **snd_hwdep_open_objects[] = {
&_snd_module_hwdep_hw
};
void *snd_hwdep_open_symbols(void)
{
return snd_hwdep_open_objects;

View file

@ -95,7 +95,7 @@ char *snd_input_gets(snd_input_t *input, char *str, size_t size)
{
return (input->ops->gets)(input, str, size);
}
/**
* \brief Reads a character from an input handle (like \c fgetc(3)).
* \param input The input handle.
@ -144,7 +144,7 @@ static char *snd_input_stdio_gets(snd_input_t *input, char *str, size_t size)
snd_input_stdio_t *stdio = input->private_data;
return fgets(str, (int) size, stdio->fp);
}
static int snd_input_stdio_getc(snd_input_t *input)
{
snd_input_stdio_t *stdio = input->private_data;
@ -197,7 +197,7 @@ int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close)
*inputp = input;
return 0;
}
/**
* \brief Creates a new input object reading from a file.
* \param inputp The functions puts the pointer to the new input object
@ -262,7 +262,7 @@ static char *snd_input_buffer_gets(snd_input_t *input, char *str, size_t size)
*str = '\0';
return str;
}
static int snd_input_buffer_getc(snd_input_t *input)
{
snd_input_buffer_t *buffer = input->private_data;
@ -334,4 +334,4 @@ int snd_input_buffer_open(snd_input_t **inputp, const char *buf, ssize_t size)
*inputp = input;
return 0;
}

View file

@ -752,7 +752,7 @@ int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds,
{
unsigned int idx;
unsigned short res;
assert(mixer && pfds && revents);
assert(mixer && pfds && revents);
if (nfds == 0)
return -EINVAL;
res = 0;
@ -781,7 +781,7 @@ int snd_mixer_wait(snd_mixer_t *mixer, int timeout)
pfds = alloca(count * sizeof(*pfds));
if (!pfds)
return -ENOMEM;
err = snd_mixer_poll_descriptors(mixer, pfds,
err = snd_mixer_poll_descriptors(mixer, pfds,
(unsigned int) count);
assert(err == count);
}

View file

@ -46,7 +46,7 @@ struct _snd_mixer_class {
struct list_head list;
snd_mixer_t *mixer;
snd_mixer_event_t event;
void *private_data;
void *private_data;
void (*private_free)(snd_mixer_class_t *class);
snd_mixer_compare_t compare;
};

View file

@ -122,7 +122,7 @@ int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *
return s1->id->index - s2->id->index;
}
#endif
/**
* \brief Find a mixer simple element
* \param mixer Mixer handle
@ -304,7 +304,7 @@ int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem,
* \param min minimum volume value
* \param max maximum volume value
*/
int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem,
long min, long max)
{
CHECK_BASIC(elem);
@ -610,7 +610,7 @@ int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem,
* \param min minimum volume value
* \param max maximum volume value
*/
int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem,
long min, long max)
{
CHECK_BASIC(elem);

View file

@ -243,7 +243,7 @@ static int find_module(snd_mixer_class_t *class, snd_config_t *top)
static void private_free(snd_mixer_class_t *class)
{
class_priv_t *priv = snd_mixer_class_get_private(class);
if (priv->private_free)
priv->private_free(class);
if (priv->dlhandle)
@ -350,7 +350,7 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
__error:
if (top)
snd_config_delete(top);
if (class)
if (class)
snd_mixer_class_free(class);
return err;
}

View file

@ -649,7 +649,7 @@ static int selem_write_main(snd_mixer_elem_t *elem)
static int selem_write(snd_mixer_elem_t *elem)
{
int err;
err = selem_write_main(elem);
if (err < 0)
selem_read(elem);
@ -883,7 +883,7 @@ static int simple_update(snd_mixer_elem_t *melem)
simple->str[SM_CAPT].max = cmax != LONG_MIN ? cmax : 0;
}
return 0;
}
}
#ifndef DOC_HIDDEN
static const struct suf {
@ -961,7 +961,7 @@ static int base_len(const char *name, selem_ctl_type_t *type)
/*
* Simple Mixer Operations
*/
static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value)
{
selem_none_t *s = snd_mixer_elem_get_private(elem);
@ -971,7 +971,7 @@ static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixe
return 0;
if (value < s->str[dir].min || value > s->str[dir].max)
return 0;
if (s->selem.caps &
if (s->selem.caps &
(dir == SM_PLAY ? SM_CAP_PVOLUME_JOIN : SM_CAP_CVOLUME_JOIN))
channel = 0;
if (value != s->str[dir].vol[channel]) {
@ -986,7 +986,7 @@ static int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixe
selem_none_t *s = snd_mixer_elem_get_private(elem);
if ((unsigned int) channel >= s->str[dir].channels)
return 0;
if (s->selem.caps &
if (s->selem.caps &
(dir == SM_PLAY ? SM_CAP_PSWITCH_JOIN : SM_CAP_CSWITCH_JOIN))
channel = 0;
if (value) {
@ -1006,7 +1006,7 @@ static int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixe
static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
{
selem_none_t *s = snd_mixer_elem_get_private(elem);
switch (cmd) {
case SM_OPS_IS_ACTIVE: {
@ -1034,7 +1034,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
if (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM) )
return 1;
return 0;
case SM_OPS_IS_ENUMCNT:
/* Both */
if ( (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM)) == (SM_CAP_CENUM | SM_CAP_PENUM) ) {
@ -1054,7 +1054,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
}
}
return 1;
}
@ -1174,7 +1174,7 @@ static int get_dB_range(snd_hctl_elem_t *ctl, struct selem_str *rec,
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,
long *min, long *max)
{
@ -1215,9 +1215,9 @@ static int ask_vol_dB_ops(snd_mixer_elem_t *elem,
}
static int get_dB_ops(snd_mixer_elem_t *elem,
int dir,
snd_mixer_selem_channel_id_t channel,
long *value)
int dir,
snd_mixer_selem_channel_id_t channel,
long *value)
{
selem_none_t *s = snd_mixer_elem_get_private(elem);
selem_ctl_t *c;
@ -1264,7 +1264,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
}
static int ask_dB_vol_ops(snd_mixer_elem_t *elem, int dir,
long dbValue, long *value, int xdir)
long dbValue, long *value, int xdir)
{
selem_none_t *s = snd_mixer_elem_get_private(elem);
selem_ctl_t *c;
@ -1446,7 +1446,7 @@ static int simple_add1(snd_mixer_class_t *class, const char *name,
if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED)
type = CTL_GLOBAL_ENUM;
else if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN &&
ctype != SND_CTL_ELEM_TYPE_INTEGER)
ctype != SND_CTL_ELEM_TYPE_INTEGER)
return 0;
break;
case CTL_GLOBAL_ROUTE:

View file

@ -35,7 +35,7 @@
#include <limits.h>
#include <sys/stat.h>
/**
/**
* \brief This function is unimplemented.
* \deprecated Since 1.0.14
*/

View file

@ -100,7 +100,7 @@ int snd_output_puts(snd_output_t *output, const char *str)
{
return output->ops->puts(output, str);
}
/**
* \brief Writes a character to an output handle (like \c putc(3)).
* \param output The output handle.
@ -152,7 +152,7 @@ static int snd_output_stdio_puts(snd_output_t *output, const char *str)
snd_output_stdio_t *stdio = output->private_data;
return fputs(str, stdio->fp);
}
static int snd_output_stdio_putc(snd_output_t *output, int c)
{
snd_output_stdio_t *stdio = output->private_data;
@ -206,7 +206,7 @@ int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close)
*outputp = output;
return 0;
}
/**
* \brief Creates a new output object writing to a file.
* \param outputp The function puts the pointer to the new output object
@ -307,7 +307,7 @@ static int snd_output_buffer_puts(snd_output_t *output, const char *str)
buffer->size += size;
return size;
}
static int snd_output_buffer_putc(snd_output_t *output, int c)
{
snd_output_buffer_t *buffer = output->private_data;

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#define SND_INTERVAL_C
#define SND_INTERVAL_INLINE
@ -32,7 +32,7 @@ static inline void div64_32(uint64_t *n, uint32_t d, uint32_t *rem)
*n /= d;
}
static inline unsigned int div32(unsigned int a, unsigned int b,
static inline unsigned int div32(unsigned int a, unsigned int b,
unsigned int *r)
{
if (b == 0) {
@ -378,7 +378,7 @@ void snd_interval_print(const snd_interval_t *i, snd_output_t *out)
{
if (snd_interval_empty(i))
snd_output_printf(out, "NONE");
else if (i->min == 0 && i->openmin == 0 &&
else if (i->min == 0 && i->openmin == 0 &&
i->max == UINT_MAX && i->openmax == 0)
snd_output_printf(out, "ALL");
else if (snd_interval_single(i) && i->integer)

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
typedef struct _snd_interval snd_interval_t;
#ifdef SND_INTERVAL_INLINE
@ -62,9 +62,9 @@ void snd_interval_add(const snd_interval_t *a, const snd_interval_t *b, snd_inte
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);
void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b,
void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b,
const snd_interval_t *c, snd_interval_t *d);
void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b,
void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b,
unsigned int k, snd_interval_t *c);
void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
const snd_interval_t *b, snd_interval_t *c);

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#define INTERVAL_INLINE static inline
INTERVAL_INLINE void snd_interval_any(snd_interval_t *i)
@ -50,7 +50,7 @@ INTERVAL_INLINE int snd_interval_empty(const snd_interval_t *i)
INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i)
{
assert(!snd_interval_empty(i));
return (i->min == i->max ||
return (i->min == i->max ||
(i->min + 1 == i->max && (i->openmin || i->openmax)));
}
@ -146,8 +146,8 @@ INTERVAL_INLINE int snd_interval_always_eq(const snd_interval_t *i1, const snd_i
INTERVAL_INLINE int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2)
{
return (i1->max < i2->min ||
return (i1->max < i2->min ||
(i1->max == i2->min &&
(i1->openmax || i1->openmin)) ||
i1->min > i2->max ||

View file

@ -3,17 +3,17 @@
Linux Audio Developer's Simple Plugin API Version 1.1[LGPL].
Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis,
Stefan Westerfeld.
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 library 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
@ -32,7 +32,7 @@ extern "C" {
/*****************************************************************************/
/* Overview:
/* Overview:
There is a large number of synthesis packages in use or development
on the Linux platform at this time. This API (`The Linux Audio
@ -76,7 +76,7 @@ extern "C" {
/* Fundamental data type passed in and out of plugin. This data type
is used to communicate audio samples and control values. It is
assumed that the plugin will work sensibly given any numeric input
value although it may have a preferred range (see hints below).
value although it may have a preferred range (see hints below).
For audio it is generally assumed that 1.0f is the `0dB' reference
amplitude and is a `normal' signal level. */
@ -85,8 +85,8 @@ typedef float LADSPA_Data;
/*****************************************************************************/
/* Special Plugin Properties:
/* Special Plugin Properties:
Optional features of the plugin type are encapsulated in the
LADSPA_Properties type. This is assembled by ORing individual
properties together. */
@ -122,7 +122,7 @@ typedef int LADSPA_Properties;
(3) The plugin will not access files, devices, pipes, sockets, IPC
or any other mechanism that might result in process or thread
blocking.
(4) The plugin will take an amount of time to execute a run() or
run_adding() call approximately of form (A+B*SampleCount) where A
and B depend on the machine and host in use. This amount of time
@ -137,7 +137,7 @@ typedef int LADSPA_Properties;
/*****************************************************************************/
/* Plugin Ports:
/* Plugin Ports:
Plugins have `ports' that are inputs or outputs for audio or
data. Ports can communicate arrays of LADSPA_Data (for audio
@ -172,23 +172,23 @@ typedef int LADSPA_PortDescriptor;
/*****************************************************************************/
/* Plugin Port Range Hints:
/* Plugin Port Range Hints:
The host may wish to provide a representation of data entering or
leaving a plugin (e.g. to generate a GUI automatically). To make
this more meaningful, the plugin should provide `hints' to the host
describing the usual values taken by the data.
Note that these are only hints. The host may ignore them and the
plugin must not assume that data supplied to it is meaningful. If
the plugin receives invalid input data it is expected to continue
to run without failure and, where possible, produce a sensible
output (e.g. a high-pass filter given a negative cutoff frequency
might switch to an all-pass mode).
Hints are meaningful for all input and output ports but hints for
input control ports are expected to be particularly useful.
More hint information is encapsulated in the
LADSPA_PortRangeHintDescriptor type which is assembled by ORing
individual hint types together. Hints may require further
@ -316,23 +316,23 @@ typedef int LADSPA_PortRangeHintDescriptor;
#define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK)
#define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_MINIMUM)
== LADSPA_HINT_DEFAULT_MINIMUM)
#define LADSPA_IS_HINT_DEFAULT_LOW(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_LOW)
== LADSPA_HINT_DEFAULT_LOW)
#define LADSPA_IS_HINT_DEFAULT_MIDDLE(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_MIDDLE)
== LADSPA_HINT_DEFAULT_MIDDLE)
#define LADSPA_IS_HINT_DEFAULT_HIGH(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_HIGH)
== LADSPA_HINT_DEFAULT_HIGH)
#define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_MAXIMUM)
== LADSPA_HINT_DEFAULT_MAXIMUM)
#define LADSPA_IS_HINT_DEFAULT_0(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_0)
== LADSPA_HINT_DEFAULT_0)
#define LADSPA_IS_HINT_DEFAULT_1(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_1)
== LADSPA_HINT_DEFAULT_1)
#define LADSPA_IS_HINT_DEFAULT_100(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_100)
== LADSPA_HINT_DEFAULT_100)
#define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_440)
== LADSPA_HINT_DEFAULT_440)
typedef struct _LADSPA_PortRangeHint {
@ -353,7 +353,7 @@ typedef struct _LADSPA_PortRangeHint {
/*****************************************************************************/
/* Plugin Handles:
/* Plugin Handles:
This plugin handle indicates a particular instance of the plugin
concerned. It is valid to compare this to NULL (0 for C++) but
@ -364,13 +364,13 @@ typedef void * LADSPA_Handle;
/*****************************************************************************/
/* Descriptor for a Type of Plugin:
/* Descriptor for a Type of Plugin:
This structure is used to describe a plugin type. It provides a
number of functions to examine the type, instantiate it, link it to
buffers and workspaces and to run it. */
typedef struct _LADSPA_Descriptor {
typedef struct _LADSPA_Descriptor {
/* This numeric identifier indicates the plugin type
uniquely. Plugin programmers may reserve ranges of IDs from a
@ -430,12 +430,12 @@ typedef struct _LADSPA_Descriptor {
instantiation function accepts a sample rate as a parameter. The
plugin descriptor from which this instantiate function was found
must also be passed. This function must return NULL if
instantiation fails.
instantiation fails.
Note that instance initialisation should generally occur in
activate() rather than here. */
LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor,
unsigned long SampleRate);
unsigned long SampleRate);
/* This member is a function pointer that connects a port on an
instantiated plugin to a memory location at which a block of data
@ -464,8 +464,8 @@ typedef struct _LADSPA_Descriptor {
However, overlapped buffers or use of a single buffer for both
audio and control data may result in unexpected behaviour. */
void (*connect_port)(LADSPA_Handle Instance,
unsigned long Port,
LADSPA_Data * DataLocation);
unsigned long Port,
LADSPA_Data * DataLocation);
/* This member is a function pointer that initialises a plugin
instance and activates it for use. This is separated from
@ -503,7 +503,7 @@ typedef struct _LADSPA_Descriptor {
then there are various things that the plugin should not do
within the run() or run_adding() functions (see above). */
void (*run)(LADSPA_Handle Instance,
unsigned long SampleCount);
unsigned long SampleCount);
/* This method is a function pointer that runs an instance of a
plugin for a block. This has identical behaviour to run() except
@ -519,7 +519,7 @@ typedef struct _LADSPA_Descriptor {
this function pointer must be set to NULL. When it is provided,
the function set_run_adding_gain() must be provided also. */
void (*run_adding)(LADSPA_Handle Instance,
unsigned long SampleCount);
unsigned long SampleCount);
/* This method is a function pointer that sets the output gain for
use when run_adding() is called (see above). If this function is
@ -531,7 +531,7 @@ typedef struct _LADSPA_Descriptor {
run_adding() function is provided. When it is absent this
function pointer must be set to NULL. */
void (*set_run_adding_gain)(LADSPA_Handle Instance,
LADSPA_Data Gain);
LADSPA_Data Gain);
/* This is the counterpart to activate() (see above). If there is
nothing for deactivate() to do then the plugin writer may provide
@ -551,7 +551,7 @@ typedef struct _LADSPA_Descriptor {
/* Once an instance of a plugin has been finished with it can be
deleted using the following function. The instance handle passed
ceases to be valid after this call.
If activate() was called for a plugin instance then a
corresponding call to deactivate() must be made before cleanup()
is called. */
@ -589,7 +589,7 @@ typedef struct _LADSPA_Descriptor {
const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index);
/* Datatype corresponding to the ladspa_descriptor() function. */
typedef const LADSPA_Descriptor *
typedef const LADSPA_Descriptor *
(*LADSPA_Descriptor_Function)(unsigned long Index);
/**********************************************************************/

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#define SND_MASK_C
#define SND_MASK_INLINE

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
typedef struct _snd_mask snd_mask_t;
#define SND_MASK_MAX 64

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <strings.h>
#include <sys/types.h>
@ -32,36 +32,36 @@
MASK_INLINE unsigned int ld2(uint32_t v)
{
unsigned r = 0;
unsigned r = 0;
if (v >= 0x10000) {
v >>= 16;
r += 16;
}
if (v >= 0x100) {
v >>= 8;
r += 8;
}
if (v >= 0x10) {
v >>= 4;
r += 4;
}
if (v >= 4) {
v >>= 2;
r += 2;
}
if (v >= 2)
r++;
return r;
if (v >= 0x10000) {
v >>= 16;
r += 16;
}
if (v >= 0x100) {
v >>= 8;
r += 8;
}
if (v >= 0x10) {
v >>= 4;
r += 4;
}
if (v >= 4) {
v >>= 2;
r += 2;
}
if (v >= 2)
r++;
return r;
}
MASK_INLINE unsigned int hweight32(uint32_t v)
{
v = (v & 0x55555555) + ((v >> 1) & 0x55555555);
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F);
v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF);
return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF);
v = (v & 0x55555555) + ((v >> 1) & 0x55555555);
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F);
v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF);
return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF);
}
MASK_INLINE size_t snd_mask_sizeof(void)

View file

@ -153,7 +153,7 @@ using #snd_pcm_state() call. There are these states:
\par SND_PCM_STATE_OPEN
The PCM device is in the open state. After the #snd_pcm_open() open call,
the device is in this state. Also, when #snd_pcm_hw_params() call fails,
then this state is entered to force application calling
then this state is entered to force application calling
#snd_pcm_hw_params() function to set right communication
parameters.
@ -799,7 +799,7 @@ int snd_pcm_close(snd_pcm_t *pcm)
if (err < 0)
res = err;
return res;
}
}
/**
* \brief set nonblock mode
@ -925,7 +925,7 @@ int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
params->rate_den = pcm->rate_den;
params->fifo_size = pcm->fifo_size;
return 0;
}
}
/** \brief Install one PCM hardware configuration chosen from a configuration space and #snd_pcm_prepare it
* \param pcm PCM handle
@ -933,7 +933,7 @@ int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
* \return 0 on success otherwise a negative error code
*
* The configuration is chosen fixing single parameters in this order:
* first access, first format, first subformat, min channels, min rate,
* first access, first format, first subformat, min channels, min rate,
* min period time, max buffer size, min tick time. If no mutually
* compatible set of parameters can be chosen, a negative error code
* will be returned.
@ -1565,7 +1565,7 @@ use_default_symbol_version(__snd_pcm_forward, snd_pcm_forward, ALSA_0.9.0rc8);
* If the non-blocking behaviour is selected, then routine doesn't wait at all.
*
* The function is thread-safe when built with the proper option.
*/
*/
snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
{
int err;
@ -1604,7 +1604,7 @@ snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_ufr
* If the non-blocking behaviour is selected, then routine doesn't wait at all.
*
* The function is thread-safe when built with the proper option.
*/
*/
snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
{
int err;
@ -1643,7 +1643,7 @@ snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t
* If the non-blocking behaviour is selected, then routine doesn't wait at all.
*
* The function is thread-safe when built with the proper option.
*/
*/
snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
{
int err;
@ -1682,7 +1682,7 @@ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t
* If the non-blocking behaviour is selected, then routine doesn't wait at all.
*
* The function is thread-safe when built with the proper option.
*/
*/
snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
{
int err;
@ -1710,7 +1710,7 @@ snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t s
* \return 0 on success otherwise a negative error code
*
* The two PCMs will start/stop/prepare in sync.
*/
*/
int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
{
int err = 0;
@ -1899,10 +1899,10 @@ static int __snd_pcm_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds,
#define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v
#define SW_PARAM(v) [SND_PCM_SW_PARAM_##v] = #v
#define FORMAT(v) [SND_PCM_FORMAT_##v] = #v
#define SUBFORMAT(v) [SND_PCM_SUBFORMAT_##v] = #v
#define SUBFORMAT(v) [SND_PCM_SUBFORMAT_##v] = #v
#define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d
#define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d
#define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d
static const char *const snd_pcm_stream_names[] = {
@ -1923,7 +1923,7 @@ static const char *const snd_pcm_state_names[] = {
};
static const char *const snd_pcm_access_names[] = {
ACCESS(MMAP_INTERLEAVED),
ACCESS(MMAP_INTERLEAVED),
ACCESS(MMAP_NONINTERLEAVED),
ACCESS(MMAP_COMPLEX),
ACCESS(RW_INTERLEAVED),
@ -1999,7 +1999,7 @@ static const char *const snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = {
};
static const char *const snd_pcm_format_descriptions[] = {
FORMATD(S8, "Signed 8 bit"),
FORMATD(S8, "Signed 8 bit"),
FORMATD(U8, "Unsigned 8 bit"),
FORMATD(S16_LE, "Signed 16 bit Little Endian"),
FORMATD(S16_BE, "Signed 16 bit Big Endian"),
@ -2053,29 +2053,29 @@ static const char *const snd_pcm_format_descriptions[] = {
};
static const char *const snd_pcm_type_names[] = {
PCMTYPE(HW),
PCMTYPE(HOOKS),
PCMTYPE(MULTI),
PCMTYPE(FILE),
PCMTYPE(NULL),
PCMTYPE(SHM),
PCMTYPE(INET),
PCMTYPE(COPY),
PCMTYPE(LINEAR),
PCMTYPE(ALAW),
PCMTYPE(MULAW),
PCMTYPE(ADPCM),
PCMTYPE(RATE),
PCMTYPE(ROUTE),
PCMTYPE(PLUG),
PCMTYPE(SHARE),
PCMTYPE(METER),
PCMTYPE(MIX),
PCMTYPE(DROUTE),
PCMTYPE(LBSERVER),
PCMTYPE(LINEAR_FLOAT),
PCMTYPE(LADSPA),
PCMTYPE(DMIX),
PCMTYPE(HW),
PCMTYPE(HOOKS),
PCMTYPE(MULTI),
PCMTYPE(FILE),
PCMTYPE(NULL),
PCMTYPE(SHM),
PCMTYPE(INET),
PCMTYPE(COPY),
PCMTYPE(LINEAR),
PCMTYPE(ALAW),
PCMTYPE(MULAW),
PCMTYPE(ADPCM),
PCMTYPE(RATE),
PCMTYPE(ROUTE),
PCMTYPE(PLUG),
PCMTYPE(SHARE),
PCMTYPE(METER),
PCMTYPE(MIX),
PCMTYPE(DROUTE),
PCMTYPE(LBSERVER),
PCMTYPE(LINEAR_FLOAT),
PCMTYPE(LADSPA),
PCMTYPE(DMIX),
PCMTYPE(JACK),
PCMTYPE(DSNOOP),
PCMTYPE(IEC958),
@ -2086,14 +2086,14 @@ static const char *const snd_pcm_type_names[] = {
};
static const char *const snd_pcm_subformat_names[] = {
SUBFORMAT(STD),
SUBFORMAT(STD),
SUBFORMAT(MSBITS_MAX),
SUBFORMAT(MSBITS_20),
SUBFORMAT(MSBITS_24),
};
static const char *const snd_pcm_subformat_descriptions[] = {
SUBFORMATD(STD, "Standard"),
SUBFORMATD(STD, "Standard"),
SUBFORMATD(MSBITS_MAX, "Maximum based on PCM format"),
SUBFORMATD(MSBITS_20, "20 most significant bits"),
SUBFORMATD(MSBITS_24, "24 most significant bits"),
@ -2343,7 +2343,7 @@ int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out)
snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream));
snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream));
snd_output_printf(out, " access : %s\n", snd_pcm_access_name(pcm->access));
snd_output_printf(out, " format : %s\n", snd_pcm_format_name(pcm->format));
snd_output_printf(out, " subformat : %s\n", snd_pcm_subformat_name(pcm->subformat));
@ -2513,7 +2513,7 @@ ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples)
*
* The asynchronous callback is called when period boundary elapses.
*/
int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
snd_async_callback_t callback, void *private_data)
{
int err;
@ -2570,8 +2570,8 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
snd_config_iterator_t i, next;
const char *id;
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_pcm_t **, const char *,
snd_config_t *, snd_config_t *,
int (*open_func)(snd_pcm_t **, const char *,
snd_config_t *, snd_config_t *,
snd_pcm_stream_t, int) = NULL;
#ifndef PIC
extern void *snd_pcm_open_symbols(void);
@ -2741,7 +2741,7 @@ static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root,
* \param mode Open mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC)
* \return 0 on success otherwise a negative error code
*/
int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_stream_t stream, int mode)
{
snd_config_t *top;
@ -2771,7 +2771,7 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
* \param lconf Local configuration
* \return 0 on success otherwise a negative error code
*/
int snd_pcm_open_lconf(snd_pcm_t **pcmp, const char *name,
int snd_pcm_open_lconf(snd_pcm_t **pcmp, const char *name,
snd_pcm_stream_t stream, int mode,
snd_config_t *lconf)
{
@ -2894,7 +2894,7 @@ int snd_pcm_open_named_slave(snd_pcm_t **pcmp, const char *name,
* see also SND_PCM_WAIT_IO and SND_PCM_WAIT_DRAIN
* \return a positive value on success otherwise a negative error code
* (-EPIPE for the xrun and -ESTRPIPE for the suspended status,
* others for general errors)
* others for general errors)
* \retval 0 timeout occurred
* \retval 1 PCM stream is ready for I/O
*
@ -2957,7 +2957,7 @@ static int __snd_pcm_wait_drain_timeout(snd_pcm_t *pcm)
return timeout;
}
/*
/*
* like snd_pcm_wait() but doesn't check mmap_avail before calling poll()
*
* used in drain code in some plugins
@ -2969,7 +2969,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
struct pollfd *pfd;
unsigned short revents = 0;
int npfds, err, err_poll;
npfds = __snd_pcm_poll_descriptors_count(pcm);
if (npfds <= 0 || npfds >= 16) {
snd_error(PCM, "Invalid poll_fds %d", npfds);
@ -2995,9 +2995,9 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
__snd_pcm_lock(pcm->fast_op_arg);
if (err_poll < 0) {
if (errno == EINTR && !PCMINABORT(pcm) && !(pcm->mode & SND_PCM_EINTR))
continue;
continue;
return -errno;
}
}
if (! err_poll)
break;
err = __snd_pcm_poll_revents(pcm, pfd, npfds, &revents);
@ -3164,13 +3164,13 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes
dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
width = snd_pcm_format_physical_width(format);
silence = snd_pcm_format_silence_64(format);
/*
* Iterate copying silent sample for sample data aligned to 64 bit.
* This is a fast path.
*/
if (dst_area->step == (unsigned int) width &&
width != 24 &&
((intptr_t)dst & 7) == 0) {
/*
* Iterate copying silent sample for sample data aligned to 64 bit.
* This is a fast path.
*/
if (dst_area->step == (unsigned int) width &&
width != 24 &&
((intptr_t)dst & 7) == 0) {
unsigned int dwords = samples * width / 64;
uint64_t *dstp = (uint64_t *)dst;
samples -= dwords * 64 / width;
@ -3487,7 +3487,7 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_
d.first = dst_start->first;
d.step = width;
snd_pcm_area_copy(&d, dst_offset * chns,
&s, src_offset * chns,
&s, src_offset * chns,
frames * chns, format);
}
channels -= chns;
@ -6354,10 +6354,10 @@ int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_u
return err;
// compute frame bits
fb = snd_pcm_format_physical_width((snd_pcm_format_t)format) * channels;
min_align = 1;
min_align = 1;
while (fb % 8) {
fb *= 2;
min_align *= 2;
min_align *= 2;
}
if (val)
*val = min_align;
@ -6793,7 +6793,7 @@ int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_
* \param val Start threshold in frames
* \return 0 otherwise a negative error code
*
* PCM is automatically started when playback frames available to PCM
* PCM is automatically started when playback frames available to PCM
* are >= threshold or when requested capture frames are >= threshold
*/
#ifndef DOXYGEN
@ -6813,7 +6813,7 @@ int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *p
* \param val Returned start threshold in frames
* \return 0 otherwise a negative error code
*
* PCM is automatically started when playback frames available to PCM
* PCM is automatically started when playback frames available to PCM
* are >= threshold or when requested capture frames are >= threshold
*/
#ifndef DOXYGEN
@ -6878,10 +6878,10 @@ int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_
* \brief Set silence threshold inside a software configuration container
* \param pcm PCM handle
* \param params Software configuration container
* \param val Silence threshold in frames
* \param val Silence threshold in frames
* \return 0 otherwise a negative error code
*
* A portion of playback buffer is overwritten with silence (see
* A portion of playback buffer is overwritten with silence (see
* #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer
* than silence threshold.
*/
@ -6908,7 +6908,7 @@ int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t
* \param val Returned silence threshold in frames
* \return 0 otherwise a negative error value
*
* A portion of playback buffer is overwritten with silence (see
* A portion of playback buffer is overwritten with silence (see
* #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer
* than silence threshold.
*/
@ -6932,7 +6932,7 @@ int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, s
* \return 0 otherwise a negative error code
*
* A portion of playback buffer is overwritten with silence when playback
* underrun is nearer than silence threshold (see
* underrun is nearer than silence threshold (see
* #snd_pcm_sw_params_set_silence_threshold)
*
* When drain silence (see #snd_pcm_hw_params_get_drain_silence) is disabled,
@ -6968,7 +6968,7 @@ int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *para
* \return 0 otherwise a negative error code
*
* A portion of playback buffer is overwritten with silence when playback
* underrun is nearer than silence threshold (see
* underrun is nearer than silence threshold (see
* #snd_pcm_sw_params_set_silence_threshold)
*/
#ifndef DOXYGEN
@ -7026,7 +7026,7 @@ void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src)
*dst = *src;
}
/**
/**
* \brief Get state from a PCM status container (see #snd_pcm_state)
* \param obj #snd_pcm_status_t pointer
* \return PCM state
@ -7037,7 +7037,7 @@ snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj)
return obj->state;
}
/**
/**
* \brief Get trigger timestamp from a PCM status container
* \param obj #snd_pcm_status_t pointer
* \param ptr Pointer to returned timestamp
@ -7053,7 +7053,7 @@ void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestam
ptr->tv_usec = obj->trigger_tstamp.tv_nsec / 1000L;
}
/**
/**
* \brief Get trigger hi-res timestamp from a PCM status container
* \param obj #snd_pcm_status_t pointer
* \param ptr Pointer to returned timestamp
@ -7073,7 +7073,7 @@ void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimest
}
use_default_symbol_version(__snd_pcm_status_get_trigger_htstamp, snd_pcm_status_get_trigger_htstamp, ALSA_0.9.0rc8);
/**
/**
* \brief Get "now" timestamp from a PCM status container
* \param obj #snd_pcm_status_t pointer
* \param ptr Pointer to returned timestamp
@ -7085,7 +7085,7 @@ void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr
ptr->tv_usec = obj->tstamp.tv_nsec / 1000L;
}
/**
/**
* \brief Get "now" hi-res timestamp from a PCM status container
* \param obj pointer to #snd_pcm_status_t
* \param ptr Pointer to returned timestamp
@ -7101,7 +7101,7 @@ void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *p
}
use_default_symbol_version(__snd_pcm_status_get_htstamp, snd_pcm_status_get_htstamp, ALSA_0.9.0rc8);
/**
/**
* \brief Get "now" hi-res audio timestamp from a PCM status container
* \param obj pointer to #snd_pcm_status_t
* \param ptr Pointer to returned timestamp
@ -7166,7 +7166,7 @@ snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj)
return obj->delay;
}
/**
/**
* \brief Get number of frames available from a PCM status container (see #snd_pcm_avail_update)
* \return Number of frames ready to be read/written
*/
@ -7176,7 +7176,7 @@ snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj)
return obj->avail;
}
/**
/**
* \brief Get maximum number of frames available from a PCM status container after last #snd_pcm_status call
* \return Maximum number of frames ready to be read/written
*
@ -7188,7 +7188,7 @@ snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj)
return obj->avail_max;
}
/**
/**
* \brief Get count of ADC overrange detections since last call
* \return Count of ADC overrange detections
*/
@ -7413,7 +7413,7 @@ void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val)
/**
* \brief Application request to access a portion of direct (mmap) area
* \param pcm PCM handle
* \param pcm PCM handle
* \param areas Returned mmap channel areas
* \param offset Returned mmap area offset in area steps (== frames)
* \param frames mmap area portion size in frames (wanted on entry, contiguous available on exit)
@ -7516,7 +7516,7 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas,
if (avail < 0)
error(avail);
// at this point, we can transfer at least 'avail' frames
// we want to process frames in chunks (period_size)
if (avail < period_size)
goto _skip;
@ -7533,7 +7533,7 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas,
commitres = snd_pcm_mmap_commit(pcm_handle, offset, frames);
if (commitres < 0 || commitres != frames)
error(commitres >= 0 ? -EPIPE : commitres);
size -= frames;
}
_skip:
@ -7591,7 +7591,7 @@ int _snd_pcm_poll_descriptor(snd_pcm_t *pcm)
return pcm->poll_fd;
}
void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
void *buf)
{
unsigned int channel;
@ -7607,7 +7607,7 @@ void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
snd_pcm_unlock(pcm);
}
void snd_pcm_areas_from_bufs(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
void snd_pcm_areas_from_bufs(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas,
void **bufs)
{
unsigned int channel;
@ -7677,7 +7677,7 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
if (err < 0)
break;
goto _again;
}
frames = size;
if (frames > (snd_pcm_uframes_t) avail)
@ -7938,13 +7938,13 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
pcm_conf = NULL;
err = 0;
_err:
if (pcm_conf)
snd_config_delete(pcm_conf);
if (pcm_conf)
snd_config_delete(pcm_conf);
if (to_free)
snd_config_delete(conf);
return err;
}
static void snd_pcm_set_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *rbptr,
volatile snd_pcm_uframes_t *hw_ptr, int fd, off_t offset)
{
@ -7975,7 +7975,7 @@ static void snd_pcm_link_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr,
{
snd_pcm_t **a;
int idx;
a = slave_rbptr->link_dst;
for (idx = 0; idx < slave_rbptr->link_dst_count; idx++)
if (a[idx] == NULL) {
@ -8017,7 +8017,7 @@ static void snd_pcm_unlink_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr,
return;
__found:
pcm_rbptr->master = NULL;
pcm_rbptr->master = NULL;
pcm_rbptr->ptr = NULL;
pcm_rbptr->fd = -1;
pcm_rbptr->offset = 0UL;
@ -8752,8 +8752,8 @@ _snd_pcm_parse_config_chmaps(snd_config_t *conf)
/*
* basic helpers
*/
/**
* \brief Recover the stream state from an error or suspend
* \param pcm PCM handle
@ -8772,39 +8772,39 @@ _snd_pcm_parse_config_chmaps(snd_config_t *conf)
*/
int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
{
if (err > 0)
err = -err;
if (err == -EINTR) /* nothing to do, continue */
return 0;
if (err == -EPIPE) {
const char *s;
if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK)
s = "underrun";
else
s = "overrun";
if (!silent)
if (err > 0)
err = -err;
if (err == -EINTR) /* nothing to do, continue */
return 0;
if (err == -EPIPE) {
const char *s;
if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK)
s = "underrun";
else
s = "overrun";
if (!silent)
snd_error(PCM, "%s occurred", s);
err = snd_pcm_prepare(pcm);
if (err < 0) {
err = snd_pcm_prepare(pcm);
if (err < 0) {
snd_error(PCM, "cannot recovery from %s, prepare failed: %s", s, snd_strerror(err));
return err;
}
return 0;
}
if (err == -ESTRPIPE) {
while ((err = snd_pcm_resume(pcm)) == -EAGAIN)
/* wait until suspend flag is released */
poll(NULL, 0, 1000);
if (err < 0) {
err = snd_pcm_prepare(pcm);
if (err < 0) {
return err;
}
return 0;
}
if (err == -ESTRPIPE) {
while ((err = snd_pcm_resume(pcm)) == -EAGAIN)
/* wait until suspend flag is released */
poll(NULL, 0, 1000);
if (err < 0) {
err = snd_pcm_prepare(pcm);
if (err < 0) {
snd_error(PCM, "cannot recovery from suspend, prepare failed: %s", snd_strerror(err));
return err;
}
}
return 0;
}
return err;
return err;
}
}
return 0;
}
return err;
}
/**
@ -8819,12 +8819,12 @@ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
* \return 0 on success otherwise a negative error code
*/
int snd_pcm_set_params(snd_pcm_t *pcm,
snd_pcm_format_t format,
snd_pcm_access_t access,
unsigned int channels,
unsigned int rate,
int soft_resample,
unsigned int latency)
snd_pcm_format_t format,
snd_pcm_access_t access,
unsigned int channels,
unsigned int rate,
int soft_resample,
unsigned int latency)
{
snd_pcm_hw_params_t params_saved, params = {0};
snd_pcm_sw_params_t swparams = {0};
@ -8841,7 +8841,7 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
s);
return err;
}
}
/* set software resampling */
err = snd_pcm_hw_params_set_rate_resample(pcm, &params, soft_resample);
if (err < 0) {
@ -9028,8 +9028,8 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
* \return 0 on success otherwise a negative error code
*/
int snd_pcm_get_params(snd_pcm_t *pcm,
snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t *period_size)
snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t *period_size)
{
snd_pcm_hw_params_t params = {0};
int err;
@ -9037,7 +9037,7 @@ int snd_pcm_get_params(snd_pcm_t *pcm,
assert(pcm);
err = snd_pcm_hw_params_current(pcm, &params);
if (err < 0)
return err;
return err;
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(&params, buffer_size);
if (err < 0)
return err;

View file

@ -32,7 +32,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
These routines convert 16 bit linear PCM samples to 4 bit ADPCM code
and vice versa. The ADPCM code used is the Intel/DVI ADPCM code which
@ -376,7 +376,7 @@ static int snd_pcm_adpcm_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
return err;
return 0;
}
static int snd_pcm_adpcm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -477,7 +477,7 @@ snd_pcm_adpcm_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep)
size = *slave_sizep;
adpcm->func(slave_areas, slave_offset,
areas, offset,
areas, offset,
pcm->channels, size,
adpcm->getput_idx, adpcm->states);
*slave_sizep = size;
@ -496,7 +496,7 @@ snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
snd_pcm_adpcm_t *adpcm = pcm->private_data;
if (size > *slave_sizep)
size = *slave_sizep;
adpcm->func(areas, offset,
adpcm->func(areas, offset,
slave_areas, slave_offset,
pcm->channels, size,
adpcm->getput_idx, adpcm->states);
@ -507,7 +507,7 @@ snd_pcm_adpcm_read_areas(snd_pcm_t *pcm,
static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_adpcm_t *adpcm = pcm->private_data;
snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n",
snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n",
snd_pcm_format_name(adpcm->sformat));
if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n");
@ -596,15 +596,15 @@ format and rate must match for both of them.
\code
pcm.name {
type adpcm # Ima-ADPCM conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
type adpcm # Ima-ADPCM conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
}
\endcode
@ -631,7 +631,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -663,7 +663,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
return err;
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_IMA_ADPCM) {
snd_config_delete(sconf);
snd_config_delete(sconf);
snd_error(PCM, "invalid slave format");
return -EINVAL;
}

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "bswap.h"
#include "pcm_plugin.h"
@ -232,7 +232,7 @@ static int snd_pcm_alaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *
err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT,
&format_mask);
} else {
err = _snd_pcm_hw_params_set_format(params,
err = _snd_pcm_hw_params_set_format(params,
SND_PCM_FORMAT_A_LAW);
}
if (err < 0)
@ -273,7 +273,7 @@ static int snd_pcm_alaw_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_p
return err;
return 0;
}
static int snd_pcm_alaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -317,7 +317,7 @@ static int snd_pcm_alaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format);
if (err < 0)
return err;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
if (alaw->sformat == SND_PCM_FORMAT_A_LAW) {
alaw->getput_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S16);
@ -351,7 +351,7 @@ snd_pcm_alaw_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep)
size = *slave_sizep;
alaw->func(slave_areas, slave_offset,
areas, offset,
areas, offset,
pcm->channels, size,
alaw->getput_idx);
*slave_sizep = size;
@ -370,7 +370,7 @@ snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
snd_pcm_alaw_t *alaw = pcm->private_data;
if (size > *slave_sizep)
size = *slave_sizep;
alaw->func(areas, offset,
alaw->func(areas, offset,
slave_areas, slave_offset,
pcm->channels, size,
alaw->getput_idx);
@ -381,7 +381,7 @@ snd_pcm_alaw_read_areas(snd_pcm_t *pcm,
static void snd_pcm_alaw_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_alaw_t *alaw = pcm->private_data;
snd_output_printf(out, "A-Law conversion PCM (%s)\n",
snd_output_printf(out, "A-Law conversion PCM (%s)\n",
snd_pcm_format_name(alaw->sformat));
if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n");
@ -420,7 +420,7 @@ static const snd_pcm_ops_t snd_pcm_alaw_ops = {
* \warning Using of this function might be dangerous in the sense
* of compatibility reasons. The prototype might be freely
* changed in future.
*/
*/
int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave)
{
snd_pcm_t *pcm;
@ -471,15 +471,15 @@ format and rate must match for both of them.
\code
pcm.name {
type alaw # A-Law conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
type alaw # A-Law conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
}
\endcode
@ -506,7 +506,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -538,7 +538,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
return err;
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_A_LAW) {
snd_config_delete(sconf);
snd_config_delete(sconf);
snd_error(PCM, "invalid slave format");
return -EINVAL;
}

View file

@ -22,21 +22,21 @@ Slave PCMs can be defined asymmetrically for both directions.
\code
pcm.name {
type asym # Asym PCM
playback STR # Playback slave name
# or
playback { # Playback slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
capture STR # Capture slave name
# or
capture { # Capture slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
type asym # Asym PCM
playback STR # Playback slave name
# or
playback { # Playback slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
capture STR # Capture slave name
# or
capture { # Capture slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
}
\endcode

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "bswap.h"
@ -73,7 +73,7 @@ static int snd_pcm_copy_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_p
return err;
return 0;
}
static int snd_pcm_copy_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -133,7 +133,7 @@ snd_pcm_copy_read_areas(snd_pcm_t *pcm,
{
if (size > *slave_sizep)
size = *slave_sizep;
snd_pcm_areas_copy(areas, offset,
snd_pcm_areas_copy(areas, offset,
slave_areas, slave_offset,
pcm->channels, size, pcm->format);
*slave_sizep = size;
@ -222,7 +222,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int
\section pcm_plugins_copy Plugin: copy
This plugin copies samples from master copy PCM to given slave PCM.
The channel count, format and rate must match for both of them.
The channel count, format and rate must match for both of them.
\code
pcm.name {
@ -260,7 +260,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
@ -44,7 +44,7 @@
/*
*
*/
#if !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__ANDROID__)
union semun {
int val; /* Value for SETVAL */
@ -55,7 +55,7 @@ union semun {
#endif
};
#endif
/*
* FIXME:
* add possibility to use futexes here
@ -96,14 +96,14 @@ static unsigned int snd_pcm_direct_magic(snd_pcm_direct_t *dmix)
}
/*
* global shared memory area
* global shared memory area
*/
int snd_pcm_direct_shm_create_or_connect(snd_pcm_direct_t *dmix)
{
struct shmid_ds buf;
int tmpid, err, first_instance = 0;
retryget:
dmix->shmid = shmget(dmix->ipc_key, sizeof(snd_pcm_direct_share_t),
dmix->ipc_perm);
@ -120,7 +120,7 @@ retryget:
if ((tmpid = shmget(dmix->ipc_key, 0, dmix->ipc_perm)) != -1)
if (!shmctl(tmpid, IPC_STAT, &buf))
if (!buf.shm_nattch)
/* no users so destroy the segment */
/* no users so destroy the segment */
if (!shmctl(tmpid, IPC_RMID, NULL))
goto retryget;
return err;
@ -221,7 +221,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
memset(addr, 0, size); /* make valgrind happy */
addr->sun_family = AF_LOCAL;
memcpy(addr->sun_path, filename, l);
if (server) {
if (bind(sock, (struct sockaddr *) addr, size) < 0) {
int result = -errno;
@ -309,7 +309,7 @@ static int _snd_send_fd(int sock, void *data, size_t len, int fd)
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_iov = &vec;
msghdr.msg_iovlen = 1;
msghdr.msg_iovlen = 1;
msghdr.msg_control = cmsg;
msghdr.msg_controllen = cmsg_len;
msghdr.msg_flags = 0;
@ -342,7 +342,7 @@ static void server_job(snd_pcm_direct_t *dmix)
if (i != dmix->server_fd && i != dmix->hw_fd)
close(i);
}
/* detach from parent */
setsid();
@ -431,7 +431,7 @@ int snd_pcm_direct_server_create(snd_pcm_direct_t *dmix)
ret = get_tmp_name(dmix->shmptr->socket_name, sizeof(dmix->shmptr->socket_name));
if (ret < 0)
return ret;
ret = make_local_socket(dmix->shmptr->socket_name, 1, dmix->ipc_perm, dmix->ipc_gid);
if (ret < 0)
return ret;
@ -442,7 +442,7 @@ int snd_pcm_direct_server_create(snd_pcm_direct_t *dmix)
close(dmix->server_fd);
return ret;
}
ret = fork();
if (ret < 0) {
close(dmix->server_fd);
@ -894,7 +894,7 @@ static int snd_interval_step(struct snd_interval *i, unsigned int min,
int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
snd_pcm_direct_t *dshare = pcm->private_data;
static const snd_mask_t access = { .bits = {
static const snd_mask_t access = { .bits = {
(1<<SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) |
(1<<SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED) |
(1<<SNDRV_PCM_ACCESS_RW_INTERLEAVED) |
@ -1057,14 +1057,14 @@ int snd_pcm_direct_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
int snd_pcm_direct_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
{
return snd_pcm_channel_info_shm(pcm, info, -1);
return snd_pcm_channel_info_shm(pcm, info, -1);
}
int snd_pcm_direct_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{
return 0;
}
int snd_pcm_direct_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
{
return 0;
@ -1202,10 +1202,10 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
int loops = 10;
__again:
if (loops-- <= 0) {
if (loops-- <= 0) {
snd_error(PCM, "unable to find a valid configuration for slave");
return -EINVAL;
}
return -EINVAL;
}
ret = snd_pcm_hw_params_any(spcm, &hw_params);
if (ret < 0) {
snd_error(PCM, "snd_pcm_hw_params_any failed");
@ -1306,8 +1306,8 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
snd_error(PCM, "unable to set period_size");
return ret;
}
}
}
if (buffer_is_not_initialized && params->periods > 0) {
unsigned int periods = params->periods;
ret = INTERNAL(snd_pcm_hw_params_set_periods_near)(spcm,
@ -1329,7 +1329,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
return ret;
}
}
ret = snd_pcm_hw_params(spcm, &hw_params);
if (ret < 0) {
snd_error(PCM, "unable to install hw params");
@ -1420,7 +1420,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
snd_pcm_areas_silence(dst_areas, 0, spcm->channels,
spcm->buffer_size, spcm->format);
}
ret = snd_pcm_start(spcm);
if (ret < 0) {
snd_error(PCM, "unable to start PCM stream");
@ -1433,7 +1433,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
}
snd_pcm_poll_descriptors(spcm, &fd, 1);
dmix->hw_fd = fd.fd;
save_slave_setting(dmix, spcm);
/* Currently, we assume that each dmix client has the same
@ -1601,7 +1601,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm
snd_error(PCM, "unable to open hardware");
return ret;
}
spcm = *spcmp;
spcm->donot_close = 1;
spcm->setup = 1;

View file

@ -19,7 +19,7 @@
*
*/
#include "pcm_local.h"
#include "pcm_local.h"
#include "../timer/timer_local.h"
#define DIRECT_IPC_SEMS 1
@ -103,8 +103,8 @@ typedef struct {
unsigned int period_step;
unsigned int sleep_min; /* not used */
unsigned int avail_min;
unsigned int start_threshold;
unsigned int stop_threshold;
unsigned int start_threshold;
unsigned int stop_threshold;
unsigned int silence_threshold;
unsigned int silence_size;
unsigned int recoveries; /* no of executed recoveries on slave*/

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
@ -63,7 +63,7 @@ const char *_snd_module_pcm_dmix = "";
static int shm_sum_discard(snd_pcm_direct_t *dmix);
/*
* sum ring buffer shared memory area
* sum ring buffer shared memory area
*/
static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix)
{
@ -73,7 +73,7 @@ static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix)
size = dmix->shmptr->s.channels *
dmix->shmptr->s.buffer_size *
sizeof(signed int);
sizeof(signed int);
retryshm:
dmix->u.dmix.shmid_sum = shmget(dmix->ipc_key + 1, size,
IPC_CREAT | dmix->ipc_perm);
@ -82,7 +82,7 @@ retryshm:
if (errno == EINVAL)
if ((tmpid = shmget(dmix->ipc_key + 1, 0, dmix->ipc_perm)) != -1)
if (!shmctl(tmpid, IPC_STAT, &buf))
if (!buf.shm_nattch)
if (!buf.shm_nattch)
/* no users so destroy the segment */
if (!shmctl(tmpid, IPC_RMID, NULL))
goto retryshm;
@ -95,7 +95,7 @@ retryshm:
}
if (dmix->ipc_gid >= 0) {
buf.shm_perm.gid = dmix->ipc_gid;
shmctl(dmix->u.dmix.shmid_sum, IPC_SET, &buf);
shmctl(dmix->u.dmix.shmid_sum, IPC_SET, &buf);
}
dmix->u.dmix.sum_buffer = shmat(dmix->u.dmix.shmid_sum, 0, 0);
if (dmix->u.dmix.sum_buffer == (void *) -1) {
@ -162,7 +162,7 @@ static void mix_areas(snd_pcm_direct_t *dmix,
unsigned int src_step, dst_step;
unsigned int chn, dchn, channels, sample_size;
mix_areas_t *do_mix_areas;
channels = dmix->channels;
switch (dmix->shmptr->s.format) {
case SND_PCM_FORMAT_S16_LE:
@ -230,7 +230,7 @@ static void remix_areas(snd_pcm_direct_t *dmix,
unsigned int src_step, dst_step;
unsigned int chn, dchn, channels, sample_size;
mix_areas_t *do_remix_areas;
channels = dmix->channels;
switch (dmix->shmptr->s.format) {
case SND_PCM_FORMAT_S16_LE:
@ -315,7 +315,7 @@ static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm)
snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size;
snd_pcm_uframes_t appl_ptr, size, transfer;
const snd_pcm_channel_area_t *src_areas, *dst_areas;
/* calculate the size to transfer */
/* check the available size in the local buffer
* last_appl_ptr keeps the last updated position
@ -391,7 +391,7 @@ static int snd_pcm_dmix_sync_ptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr
snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_uframes_t old_slave_hw_ptr, avail;
snd_pcm_sframes_t diff;
old_slave_hw_ptr = dmix->slave_hw_ptr;
dmix->slave_hw_ptr = slave_hw_ptr;
diff = pcm_frame_diff(slave_hw_ptr, old_slave_hw_ptr, dmix->slave_boundary);
@ -483,7 +483,7 @@ static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
{
snd_pcm_direct_t *dmix = pcm->private_data;
int err;
switch(dmix->state) {
case SNDRV_PCM_STATE_DRAINING:
case SNDRV_PCM_STATE_RUNNING:
@ -554,7 +554,7 @@ static int snd_pcm_dmix_start(snd_pcm_t *pcm)
snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_sframes_t avail;
int err;
if (dmix->state != SND_PCM_STATE_PREPARED)
return -EBADFD;
avail = snd_pcm_mmap_playback_hw_avail(pcm);
@ -784,11 +784,11 @@ static int snd_pcm_dmix_close(snd_pcm_t *pcm)
snd_timer_close(dmix->timer);
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
snd_pcm_close(dmix->spcm);
if (dmix->server)
snd_pcm_direct_server_discard(dmix);
if (dmix->client)
snd_pcm_direct_client_discard(dmix);
shm_sum_discard(dmix);
if (dmix->server)
snd_pcm_direct_server_discard(dmix);
if (dmix->client)
snd_pcm_direct_client_discard(dmix);
shm_sum_discard(dmix);
if (snd_pcm_direct_shm_discard(dmix)) {
if (snd_pcm_direct_semaphore_discard(dmix))
snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT);
@ -837,7 +837,7 @@ static snd_pcm_sframes_t snd_pcm_dmix_avail_update(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dmix = pcm->private_data;
int err;
if (dmix->state == SND_PCM_STATE_RUNNING ||
dmix->state == SND_PCM_STATE_DRAINING) {
if ((err = snd_pcm_dmix_sync_ptr(pcm)) < 0)
@ -856,7 +856,7 @@ static int snd_pcm_dmix_htimestamp(snd_pcm_t *pcm,
snd_pcm_direct_t *dmix = pcm->private_data;
snd_pcm_uframes_t avail1;
int ok = 0;
while (1) {
if (dmix->state == SND_PCM_STATE_RUNNING ||
dmix->state == SND_PCM_STATE_DRAINING)
@ -1000,13 +1000,13 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
snd_error(PCM, "dmix plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dmix, spcm, params);
if (ret < 0) {
snd_error(PCM, "unable to initialize slave");
@ -1017,7 +1017,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
if (dmix->shmptr->use_server) {
dmix->server_free = dmix_server_free;
ret = snd_pcm_direct_server_create(dmix);
if (ret < 0) {
snd_error(PCM, "unable to create server");
@ -1035,7 +1035,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_open_secondary_client(&spcm, dmix, "dmix_client");
if (ret < 0)
@ -1062,7 +1062,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dmix, spcm, params);
if (ret < 0) {
snd_error(PCM, "unable to initialize slave");
@ -1086,14 +1086,14 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
}
mix_select_callbacks(dmix);
pcm->poll_fd = dmix->poll_fd;
pcm->poll_events = POLLIN; /* it's different than other plugins */
pcm->tstamp_type = spcm->tstamp_type;
pcm->mmap_rw = 1;
snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0);
if (dmix->channels == UINT_MAX)
dmix->channels = dmix->shmptr->s.channels;
@ -1101,7 +1101,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
*pcmp = pcm;
return 0;
_err:
if (dmix->timer)
snd_timer_close(dmix->timer);
@ -1317,7 +1317,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
if (err < 0)
return err;
/* set a reasonable default */
/* set a reasonable default */
if (psize == -1 && params.period_time == -1)
params.period_time = 125000; /* 0.125 seconds */

View file

@ -289,12 +289,12 @@ static void generic_mix_areas_16_swap(unsigned int size,
}
static void generic_remix_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)
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;
@ -354,12 +354,12 @@ static void generic_mix_areas_32_swap(unsigned int size,
}
static void generic_remix_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)
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;

View file

@ -55,7 +55,7 @@
#undef LOCK_PREFIX
#undef XADD
#undef XSUB
#define MIX_AREAS_16 remix_areas_16_smp
#define MIX_AREAS_16_MMX remix_areas_16_smp_mmx
#define MIX_AREAS_32 remix_areas_32_smp
@ -73,7 +73,7 @@
#undef LOCK_PREFIX
#undef XADD
#undef XSUB
#define i386_dmix_supported_format \
((1ULL << SND_PCM_FORMAT_S16_LE) |\
(1ULL << SND_PCM_FORMAT_S32_LE) |\
@ -100,7 +100,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
if (!smp) {
FILE *in;
char line[255];
/* try to determine the capabilities of the CPU */
in = fopen("/proc/cpuinfo", "r");
if (in) {
@ -117,7 +117,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
fclose(in);
}
}
if (mmx) {
dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp_mmx : mix_areas_16_mmx;
dmix->u.dmix.remix_areas_16 = smp > 1 ? remix_areas_16_smp_mmx : remix_areas_16_mmx;

View file

@ -244,7 +244,7 @@ static void MIX_AREAS_16_MMX(unsigned int size,
"\tdecl %[size]\n"
"\tjnz 1b\n"
"\temms\n"
"5:"
"5:"
#ifdef BOUNDED_EBX
"\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
#endif

View file

@ -43,7 +43,7 @@
#undef LOCK_PREFIX
#undef XADD
#undef XSUB
#define MIX_AREAS_16 remix_areas_16_smp
#define MIX_AREAS_32 remix_areas_32_smp
#define MIX_AREAS_24 remix_areas_24_smp
@ -57,7 +57,7 @@
#undef LOCK_PREFIX
#undef XADD
#undef XSUB
#define x86_64_dmix_supported_format \
((1ULL << SND_PCM_FORMAT_S16_LE) |\
(1ULL << SND_PCM_FORMAT_S32_LE) |\
@ -69,7 +69,7 @@
static void mix_select_callbacks(snd_pcm_direct_t *dmix)
{
static int smp = 0;
if (!dmix->direct_memory_access) {
generic_mix_select_callbacks(dmix);
return;

View file

@ -137,7 +137,7 @@ static void MIX_AREAS_16(unsigned int size,
#ifdef BOUNDED_RBX
, [old_rbx] "=m" (old_rbx)
#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "im" (dst_step), [src_step] "im" (src_step),
[sum_step] "im" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
@ -279,7 +279,7 @@ static void MIX_AREAS_32(unsigned int size,
#ifdef BOUNDED_RBX
, [old_rbx] "=m" (old_rbx)
#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "im" (dst_step), [src_step] "im" (src_step),
[sum_step] "im" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
@ -403,7 +403,7 @@ static void MIX_AREAS_24(unsigned int size,
#ifdef BOUNDED_RBX
, [old_rbx] "=m" (old_rbx)
#endif
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
[dst_step] "im" (dst_step), [src_step] "im" (src_step),
[sum_step] "im" (sum_step)
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
@ -111,7 +111,7 @@ static void snd_pcm_dshare_sync_area(snd_pcm_t *pcm)
snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size;
snd_pcm_uframes_t appl_ptr, size;
const snd_pcm_channel_area_t *src_areas, *dst_areas;
/* calculate the size to transfer */
size = pcm_frame_diff(dshare->appl_ptr, dshare->last_appl_ptr, pcm->boundary);
if (! size)
@ -259,7 +259,7 @@ static int snd_pcm_dshare_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
{
snd_pcm_direct_t *dshare = pcm->private_data;
int err;
switch (dshare->state) {
case SNDRV_PCM_STATE_DRAINING:
case SNDRV_PCM_STATE_RUNNING:
@ -328,7 +328,7 @@ static int snd_pcm_dshare_start(snd_pcm_t *pcm)
snd_pcm_direct_t *dshare = pcm->private_data;
snd_pcm_sframes_t avail;
int err;
if (dshare->state != SND_PCM_STATE_PREPARED)
return -EBADFD;
avail = snd_pcm_mmap_playback_hw_avail(pcm);
@ -484,10 +484,10 @@ static int snd_pcm_dshare_close(snd_pcm_t *pcm)
snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;
snd_pcm_close(dshare->spcm);
if (dshare->server)
snd_pcm_direct_server_discard(dshare);
if (dshare->client)
snd_pcm_direct_client_discard(dshare);
if (dshare->server)
snd_pcm_direct_server_discard(dshare);
if (dshare->client)
snd_pcm_direct_client_discard(dshare);
if (snd_pcm_direct_shm_discard(dshare)) {
if (snd_pcm_direct_semaphore_discard(dshare))
snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT);
@ -537,7 +537,7 @@ static snd_pcm_sframes_t snd_pcm_dshare_avail_update(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dshare = pcm->private_data;
int err;
if (dshare->state == SND_PCM_STATE_RUNNING ||
dshare->state == SND_PCM_STATE_DRAINING) {
if ((err = snd_pcm_dshare_sync_ptr(pcm)) < 0)
@ -556,7 +556,7 @@ static int snd_pcm_dshare_htimestamp(snd_pcm_t *pcm,
snd_pcm_direct_t *dshare = pcm->private_data;
snd_pcm_uframes_t avail1;
int ok = 0;
while (1) {
if (dshare->state == SND_PCM_STATE_RUNNING ||
dshare->state == SND_PCM_STATE_DRAINING)
@ -701,12 +701,12 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
snd_error(PCM, "dshare plugin can be only connected to hw plugin");
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dshare, spcm, params);
if (ret < 0) {
snd_error(PCM, "unable to initialize slave");
@ -714,7 +714,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
}
dshare->spcm = spcm;
if (dshare->shmptr->use_server) {
ret = snd_pcm_direct_server_create(dshare);
if (ret < 0) {
@ -733,7 +733,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_open_secondary_client(&spcm, dshare, "dshare_client");
if (ret < 0)
@ -761,7 +761,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dshare, spcm, params);
if (ret < 0) {
snd_error(PCM, "unable to initialize slave");
@ -784,7 +784,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
goto _err;
}
dshare->shmptr->u.dshare.chn_mask |= dshare->u.dshare.chn_mask;
ret = snd_pcm_direct_initialize_poll_fd(dshare);
if (ret < 0) {
snd_error(PCM, "unable to initialize poll_fd");
@ -797,12 +797,12 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
pcm->mmap_rw = 1;
snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0);
snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
*pcmp = pcm;
return 0;
_err:
if (dshare->shmptr != (void *) -1)
dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
@ -106,7 +106,7 @@ static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_
snd_pcm_uframes_t hw_ptr = dsnoop->hw_ptr;
snd_pcm_uframes_t transfer;
const snd_pcm_channel_area_t *src_areas, *dst_areas;
/* add sample areas here */
dst_areas = snd_pcm_mmap_areas(pcm);
src_areas = snd_pcm_mmap_areas(dsnoop->spcm);
@ -119,7 +119,7 @@ static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_
size -= transfer;
snoop_areas(dsnoop, src_areas, dst_areas, slave_hw_ptr, hw_ptr, transfer);
slave_hw_ptr += transfer;
slave_hw_ptr %= dsnoop->slave_buffer_size;
slave_hw_ptr %= dsnoop->slave_buffer_size;
hw_ptr += transfer;
hw_ptr %= pcm->buffer_size;
}
@ -206,7 +206,7 @@ static int snd_pcm_dsnoop_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
{
snd_pcm_direct_t *dsnoop = pcm->private_data;
int err;
switch(dsnoop->state) {
case SNDRV_PCM_STATE_DRAINING:
case SNDRV_PCM_STATE_RUNNING:
@ -373,10 +373,10 @@ static int snd_pcm_dsnoop_close(snd_pcm_t *pcm)
snd_timer_close(dsnoop->timer);
snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
snd_pcm_close(dsnoop->spcm);
if (dsnoop->server)
snd_pcm_direct_server_discard(dsnoop);
if (dsnoop->client)
snd_pcm_direct_client_discard(dsnoop);
if (dsnoop->server)
snd_pcm_direct_server_discard(dsnoop);
if (dsnoop->client)
snd_pcm_direct_client_discard(dsnoop);
if (snd_pcm_direct_shm_discard(dsnoop)) {
if (snd_pcm_direct_semaphore_discard(dsnoop))
snd_pcm_direct_semaphore_final(dsnoop, DIRECT_IPC_SEM_CLIENT);
@ -414,7 +414,7 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_avail_update(snd_pcm_t *pcm)
{
snd_pcm_direct_t *dsnoop = pcm->private_data;
int err;
if (dsnoop->state == SND_PCM_STATE_RUNNING) {
err = snd_pcm_dsnoop_sync_ptr(pcm);
if (err < 0)
@ -433,7 +433,7 @@ static int snd_pcm_dsnoop_htimestamp(snd_pcm_t *pcm,
snd_pcm_direct_t *dsnoop = pcm->private_data;
snd_pcm_uframes_t avail1;
int ok = 0;
while (1) {
if (dsnoop->state == SND_PCM_STATE_RUNNING ||
dsnoop->state == SND_PCM_STATE_DRAINING)
@ -567,12 +567,12 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
snd_error(PCM, "dsnoop plugin can be only connected to hw plugin");
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dsnoop, spcm, params);
if (ret < 0) {
snd_error(PCM, "unable to initialize slave");
@ -580,7 +580,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
}
dsnoop->spcm = spcm;
if (dsnoop->shmptr->use_server) {
ret = snd_pcm_direct_server_create(dsnoop);
if (ret < 0) {
@ -599,7 +599,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_open_secondary_client(&spcm, dsnoop, "dsnoop_client");
@ -627,7 +627,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dsnoop, spcm, params);
if (ret < 0) {
snd_error(PCM, "unable to initialize slave");
@ -650,17 +650,17 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
pcm->mmap_rw = 1;
snd_pcm_set_hw_ptr(pcm, &dsnoop->hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &dsnoop->appl_ptr, -1, 0);
if (dsnoop->channels == UINT_MAX)
dsnoop->channels = dsnoop->shmptr->s.channels;
snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
*pcmp = pcm;
return 0;
_err:
if (dsnoop->timer)
if (dsnoop->timer)
snd_timer_close(dsnoop->timer);
if (dsnoop->server)
snd_pcm_direct_server_discard(dsnoop);
@ -804,7 +804,7 @@ int _snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
if (err < 0)
return err;
/* set a reasonable default */
/* set a reasonable default */
if (psize == -1 && params.period_time == -1)
params.period_time = 125000; /* 0.125 seconds */

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
@ -77,8 +77,8 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_t *slave = NULL, *sconf;
snd_config_iterator_t i, next;

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "pcm_extplug.h"
@ -264,7 +264,7 @@ static int snd_pcm_extplug_hw_refine_schange(snd_pcm_t *pcm,
return _snd_pcm_hw_params_refine(sparams, links, params);
}
static int snd_pcm_extplug_hw_refine_cchange(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
@ -511,7 +511,7 @@ usually you will call the external plugin API function,
#snd_pcm_extplug_create() or #snd_pcm_ioplug_create(), depending
on the plugin type. The PCM handle must be filled *pcmp in return.
Then this function must return either a value 0 when succeeded, or a
negative value as the error code.
negative value as the error code.
Finally, add #SND_PCM_PLUGIN_SYMBOL() with the name of your
plugin as the argument at the end. This defines the proper versioned
@ -596,7 +596,7 @@ Otherfields are optional and should be initialized with zero.
The constant #SND_PCM_EXTPLUG_VERSION must be passed to the version
field for the version check in alsa-lib. A non-NULL ASCII string
has to be passed to the name field. The callback field contains the
has to be passed to the name field. The callback field contains the
table of callback functions for this plugin (defined as
#snd_pcm_extplug_callback_t).
@ -611,7 +611,7 @@ The callback functions in #snd_pcm_extplug_callback_t define the real
behavior of the driver.
At least, transfer callback must be given. This callback is called
at each time certain size of data block is transfered to the slave
PCM. Other callbacks are optional.
PCM. Other callbacks are optional.
The close callback is called when the PCM is closed. If the plugin
allocates private resources, this is the place to release them
@ -640,7 +640,7 @@ either #snd_pcm_extplug_set_slave_param_minmax() and
as former functions.
To clear the parameter constraints, call #snd_pcm_extplug_params_reset()
function.
function.
When using snd_pcm_extplug_set_param_*() or snd_pcm_extplug_set_slave_param_*()
for any parameter. This parameter is no longer linked between the client and

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "bswap.h"
@ -353,7 +353,7 @@ static int write_wav_header(snd_pcm_t *pcm)
'd', 'a', 't', 'a',
0, 0, 0, 0
};
setup_wav_header(pcm, &file->wav_header);
res = safe_write(file->fd, header, sizeof(header));
@ -472,7 +472,7 @@ static int snd_pcm_file_add_frames(snd_pcm_t *pcm,
n = cont;
if (n > avail)
n = avail;
snd_pcm_areas_copy(file->wbuf_areas, file->appl_ptr,
snd_pcm_areas_copy(file->wbuf_areas, file->appl_ptr,
areas, offset,
pcm->channels, n, pcm->format);
frames -= n;
@ -564,7 +564,7 @@ static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f
snd_pcm_file_t *file = pcm->private_data;
snd_pcm_sframes_t err;
snd_pcm_uframes_t n;
n = snd_pcm_frames_to_bytes(pcm, frames);
if (n > file->wbuf_used_bytes)
frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes);
@ -592,7 +592,7 @@ static snd_pcm_sframes_t snd_pcm_file_forward(snd_pcm_t *pcm, snd_pcm_uframes_t
snd_pcm_file_t *file = pcm->private_data;
snd_pcm_sframes_t err;
snd_pcm_uframes_t n;
n = snd_pcm_frames_to_bytes(pcm, frames);
if (file->wbuf_used_bytes + n > file->wbuf_size_bytes)
frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes);
@ -690,7 +690,7 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm
}
static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t size)
{
snd_pcm_file_t *file = pcm->private_data;
@ -982,14 +982,14 @@ to a command, and optionally uses an existing file as an input data source
\code
pcm.name {
type file # File PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
type file # File PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
file STR # Output filename (or shell command the stream
# will be piped to if STR starts with the pipe
# char).
@ -1034,7 +1034,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;

View file

@ -7,7 +7,7 @@
*/
/*
* PCM - Common generic plugin code
* Copyright (c) 2004 by Jaroslav Kysela <perex@perex.cz>
* Copyright (c) 2004 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
@ -125,7 +125,7 @@ int snd_pcm_generic_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
}
int snd_pcm_generic_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
{
{
snd_pcm_generic_t *generic = pcm->private_data;
return snd_pcm_status(generic->slave, status);
}
@ -256,7 +256,7 @@ snd_pcm_sframes_t snd_pcm_generic_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_ufr
return _snd_pcm_readn(generic->slave, bufs, size);
}
snd_pcm_sframes_t snd_pcm_generic_mmap_commit(snd_pcm_t *pcm,
snd_pcm_sframes_t snd_pcm_generic_mmap_commit(snd_pcm_t *pcm,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t size)
{

View file

@ -18,11 +18,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
typedef struct {
snd_pcm_t *slave;
int close_slave;
} snd_pcm_generic_t;
} snd_pcm_generic_t;
/* make local functions really local */
#define snd_pcm_generic_close \

View file

@ -26,7 +26,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_generic.h"
@ -283,9 +283,9 @@ pcm.NAME {
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
pcm { } # Slave PCM definition
}
hooks {
ID STR # Hook name (see pcm_hook)
@ -480,7 +480,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
* changed in future.
*/
int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;

View file

@ -26,7 +26,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "../control/control_local.h"
#include "../timer/timer_local.h"
@ -375,7 +375,7 @@ static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (pcm->tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY)
params->info |= SND_PCM_INFO_MONOTONIC;
}
return 0;
}
@ -434,7 +434,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
snd_timer_params_t params = {0};
unsigned int suspend, resume;
int err;
if (enable) {
err = snd_timer_hw_open(&hw->period_timer,
"hw-pcm-period-event",
@ -456,7 +456,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
return -EINVAL;
}
hw->period_timer_pfd.events = POLLIN;
hw->period_timer_pfd.revents = 0;
hw->period_timer_pfd.revents = 0;
snd_timer_poll_descriptors(hw->period_timer,
&hw->period_timer_pfd, 1);
hw->period_timer_need_poll = 0;
@ -473,7 +473,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
* In older versions, check via poll before read() is
* needed because of the confliction between
* TIMER_START and FIONBIO ioctls.
*/
*/
if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4))
hw->period_timer_need_poll = 1;
/*
@ -1691,7 +1691,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
return ret;
}
}
hw = calloc(1, sizeof(snd_pcm_hw_t));
if (!hw) {
close(fd);
@ -1785,7 +1785,7 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
sprintf(filename, filefmt, card, device);
__again:
if (attempt++ > 3) {
if (attempt++ > 3) {
ret = -EBUSY;
goto _err;
}
@ -2085,8 +2085,8 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
return 0;
fail:
snd_pcm_free_chmaps(chmap);
return err;
snd_pcm_free_chmaps(chmap);
return err;
}
#ifndef DOC_HIDDEN
@ -2152,7 +2152,7 @@ static int use_old_hw_params_ioctl(int fd, unsigned int cmd, snd_pcm_hw_params_t
struct sndrv_pcm_hw_params_old oparams;
unsigned int cmask = 0;
int res;
snd_pcm_hw_convert_to_old_params(&oparams, params, &cmask);
res = ioctl(fd, cmd, &oparams);
snd_pcm_hw_convert_from_old_params(params, &oparams);

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "plugin_ops.h"
@ -295,7 +295,7 @@ static int snd_pcm_iec958_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd
return err;
return 0;
}
static int snd_pcm_iec958_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -454,7 +454,7 @@ snd_pcm_iec958_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep)
size = *slave_sizep;
iec->func(iec, slave_areas, slave_offset,
areas, offset,
areas, offset,
pcm->channels, size);
*slave_sizep = size;
return size;
@ -472,7 +472,7 @@ snd_pcm_iec958_read_areas(snd_pcm_t *pcm,
snd_pcm_iec958_t *iec = pcm->private_data;
if (size > *slave_sizep)
size = *slave_sizep;
iec->func(iec, areas, offset,
iec->func(iec, areas, offset,
slave_areas, slave_offset,
pcm->channels, size);
*slave_sizep = size;
@ -489,7 +489,7 @@ static int snd_pcm_iec958_init(snd_pcm_t *pcm)
static void snd_pcm_iec958_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_iec958_t *iec = pcm->private_data;
snd_output_printf(out, "IEC958 subframe conversion PCM (%s)\n",
snd_output_printf(out, "IEC958 subframe conversion PCM (%s)\n",
snd_pcm_format_name(iec->sformat));
if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n");
@ -560,12 +560,12 @@ static const snd_pcm_ops_t snd_pcm_iec958_ops = {
* \warning Using of this function might be dangerous in the sense
* of compatibility reasons. The prototype might be freely
* changed in future.
*/
*/
int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat,
snd_pcm_t *slave, int close_slave,
const unsigned char *status_bits,
const unsigned char *preamble_vals,
int hdmi_mode)
int hdmi_mode)
{
snd_pcm_t *pcm;
snd_pcm_iec958_t *iec;
@ -638,14 +638,14 @@ This plugin converts 32bit IEC958 subframe samples to linear, or linear to
\code
pcm.name {
type iec958 # IEC958 subframe conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
type iec958 # IEC958 subframe conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
[status status-bytes] # IEC958 status bits (given in byte array)
# IEC958 preamble bits definitions
# B/M/W or Z/X/Y, B = block start, M = even subframe, W = odd subframe
@ -684,7 +684,7 @@ by the HDMI HBR specification.
* changed in future.
*/
int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -797,7 +797,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE &&
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
snd_config_delete(sconf);
snd_config_delete(sconf);
snd_error(PCM, "invalid slave format");
return -EINVAL;
}

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_ioplug.h"
#include "pcm_ext_parm.h"
@ -482,7 +482,7 @@ static int snd_pcm_ioplug_start(snd_pcm_t *pcm)
{
ioplug_priv_t *io = pcm->private_data;
int err;
if (io->data->state != SND_PCM_STATE_PREPARED)
return -EBADFD;
@ -637,7 +637,7 @@ static snd_pcm_sframes_t ioplug_priv_transfer_areas(snd_pcm_t *pcm,
{
ioplug_priv_t *io = pcm->private_data;
snd_pcm_sframes_t result;
if (! size)
return 0;
if (io->data->callback->transfer)
@ -656,7 +656,7 @@ static snd_pcm_sframes_t snd_pcm_ioplug_writei(snd_pcm_t *pcm, const void *buffe
else {
snd_pcm_channel_area_t areas[pcm->channels];
snd_pcm_areas_from_buf(pcm, areas, (void*)buffer);
return snd_pcm_write_areas(pcm, areas, 0, size,
return snd_pcm_write_areas(pcm, areas, 0, size,
ioplug_priv_transfer_areas);
}
}
@ -982,7 +982,7 @@ Otherfields are optional and should be initialized with zero.
The constant #SND_PCM_IOPLUG_VERSION must be passed to the version
field for the version check in alsa-lib. A non-NULL ASCII string
has to be passed to the name field. The callback field contains the
has to be passed to the name field. The callback field contains the
table of callback functions for this plugin (defined as
#snd_pcm_ioplug_callback_t).

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "plugin_ops.h"
@ -236,7 +236,7 @@ static int snd_pcm_lfloat_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd
return err;
return 0;
}
static int snd_pcm_lfloat_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -309,7 +309,7 @@ snd_pcm_lfloat_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep)
size = *slave_sizep;
lfloat->func(slave_areas, slave_offset,
areas, offset,
areas, offset,
pcm->channels, size,
lfloat->int32_idx, lfloat->float32_idx);
*slave_sizep = size;
@ -328,7 +328,7 @@ snd_pcm_lfloat_read_areas(snd_pcm_t *pcm,
snd_pcm_lfloat_t *lfloat = pcm->private_data;
if (size > *slave_sizep)
size = *slave_sizep;
lfloat->func(areas, offset,
lfloat->func(areas, offset,
slave_areas, slave_offset,
pcm->channels, size,
lfloat->int32_idx, lfloat->float32_idx);
@ -339,7 +339,7 @@ snd_pcm_lfloat_read_areas(snd_pcm_t *pcm,
static void snd_pcm_lfloat_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_lfloat_t *lfloat = pcm->private_data;
snd_output_printf(out, "Linear Integer <-> Linear Float conversion PCM (%s)\n",
snd_output_printf(out, "Linear Integer <-> Linear Float conversion PCM (%s)\n",
snd_pcm_format_name(lfloat->sformat));
if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n");
@ -415,7 +415,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
snd_pcm_set_hw_ptr(pcm, &lfloat->plug.hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &lfloat->plug.appl_ptr, -1, 0);
*pcmp = pcm;
return 0;
}
@ -429,15 +429,15 @@ match for both of them.
\code
pcm.name {
type lfloat # Linear<->Float conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
type lfloat # Linear<->Float conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
}
\endcode
@ -464,7 +464,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -528,7 +528,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
const char *name ATTRIBUTE_UNUSED,
snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf ATTRIBUTE_UNUSED,
snd_config_t *conf ATTRIBUTE_UNUSED,
snd_pcm_stream_t stream ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED)
{

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "plugin_ops.h"
@ -78,7 +78,7 @@ int snd_pcm_linear_convert_index(snd_pcm_format_t src_format,
int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
{
int sign, width, pwidth, endian;
sign = (snd_pcm_format_signed(src_format) !=
sign = (snd_pcm_format_signed(src_format) !=
snd_pcm_format_signed(dst_format));
#ifdef SND_LITTLE_ENDIAN
endian = snd_pcm_format_big_endian(src_format);
@ -112,7 +112,7 @@ int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_f
int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
{
int sign, width, pwidth, endian;
sign = (snd_pcm_format_signed(src_format) !=
sign = (snd_pcm_format_signed(src_format) !=
snd_pcm_format_signed(dst_format));
#ifdef SND_LITTLE_ENDIAN
endian = snd_pcm_format_big_endian(dst_format);
@ -264,7 +264,7 @@ static int snd_pcm_linear_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd
return err;
return 0;
}
static int snd_pcm_linear_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -344,12 +344,12 @@ snd_pcm_linear_write_areas(snd_pcm_t *pcm,
size = *slave_sizep;
if (linear->use_getput)
snd_pcm_linear_getput(slave_areas, slave_offset,
areas, offset,
areas, offset,
pcm->channels, size,
linear->get_idx, linear->put_idx);
else
snd_pcm_linear_convert(slave_areas, slave_offset,
areas, offset,
areas, offset,
pcm->channels, size, linear->conv_idx);
*slave_sizep = size;
return size;
@ -368,12 +368,12 @@ snd_pcm_linear_read_areas(snd_pcm_t *pcm,
if (size > *slave_sizep)
size = *slave_sizep;
if (linear->use_getput)
snd_pcm_linear_getput(areas, offset,
snd_pcm_linear_getput(areas, offset,
slave_areas, slave_offset,
pcm->channels, size,
linear->get_idx, linear->put_idx);
else
snd_pcm_linear_convert(areas, offset,
snd_pcm_linear_convert(areas, offset,
slave_areas, slave_offset,
pcm->channels, size, linear->conv_idx);
*slave_sizep = size;
@ -383,7 +383,7 @@ snd_pcm_linear_read_areas(snd_pcm_t *pcm,
static void snd_pcm_linear_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_linear_t *linear = pcm->private_data;
snd_output_printf(out, "Linear conversion PCM (%s)\n",
snd_output_printf(out, "Linear conversion PCM (%s)\n",
snd_pcm_format_name(linear->sformat));
if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n");
@ -472,15 +472,15 @@ slave PCM. The channel count, format and rate must match for both of them.
\code
pcm.name {
type linear # Linear conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
type linear # Linear conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
}
\endcode
@ -507,7 +507,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;

View file

@ -401,9 +401,9 @@ snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_ufram
snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
typedef snd_pcm_sframes_t (*snd_pcm_xfer_areas_func_t)(snd_pcm_t *pcm,
typedef snd_pcm_sframes_t (*snd_pcm_xfer_areas_func_t)(snd_pcm_t *pcm,
const snd_pcm_channel_area_t *areas,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t size);
snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas,
@ -606,13 +606,13 @@ static inline const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm)
static inline snd_pcm_uframes_t snd_pcm_mmap_offset(snd_pcm_t *pcm)
{
assert(pcm);
assert(pcm);
return *pcm->appl.ptr % pcm->buffer_size;
}
static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm)
{
assert(pcm);
assert(pcm);
return *pcm->hw.ptr % pcm->buffer_size;
}
@ -1079,7 +1079,7 @@ const snd_config_t *snd_pcm_rate_get_default_converter(snd_config_t *root);
(1U << (SND_PCM_FORMAT_U18_3LE - 32)) | \
(1U << (SND_PCM_FORMAT_S18_3BE - 32)) | \
(1U << (SND_PCM_FORMAT_U18_3BE - 32))) }
#define SND_PCM_FMTBIT_FLOAT \
{ ((1U << SND_PCM_FORMAT_FLOAT_LE) | \

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
@ -93,7 +93,7 @@ static void snd_pcm_meter_add_frames(snd_pcm_t *pcm,
n = dst_cont;
if (n > src_cont)
n = src_cont;
snd_pcm_areas_copy(meter->buf_areas, dst_offset,
snd_pcm_areas_copy(meter->buf_areas, dst_offset,
areas, src_offset,
pcm->channels, n, pcm->format);
frames -= n;
@ -259,7 +259,7 @@ static void *snd_pcm_meter_thread(void *data)
if (scope->enabled)
scope->ops->update(scope);
}
nanosleep(&meter->delay, NULL);
nanosleep(&meter->delay, NULL);
}
list_for_each(pos, &meter->scopes) {
scope = list_entry(pos, snd_pcm_scope_t, list);
@ -404,7 +404,7 @@ static int snd_pcm_meter_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
return err;
return 0;
}
static int snd_pcm_meter_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -716,14 +716,14 @@ pcm_scope.name {
}
pcm.name {
type meter # Meter PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
type meter # Meter PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
}
[frequency INT] # Updates per second
scopes {
ID STR # Scope name (see pcm_scope)
@ -756,7 +756,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -1174,7 +1174,7 @@ static const snd_pcm_scope_ops_t s16_ops = {
* \param scopep Pointer to newly created and added scope
* \return 0 on success otherwise a negative error code
*
* s16 pseudo scope convert #SND_PCM_TYPE_METER PCM frames in CPU endian
* s16 pseudo scope convert #SND_PCM_TYPE_METER PCM frames in CPU endian
* 16 bit frames for use with other scopes. Don't forget to insert it before
* and to not insert it more time (see #snd_pcm_meter_search_scope)
*/

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "bswap.h"
#include <stdio.h>
@ -519,7 +519,7 @@ uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
return bswap_64(u.i);
#endif
}
case SNDRV_PCM_FORMAT_FLOAT_BE:
case SNDRV_PCM_FORMAT_FLOAT_BE:
{
union {
float f[2];
@ -547,7 +547,7 @@ uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
}
case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE:
return 0;
return 0;
case SNDRV_PCM_FORMAT_MU_LAW:
return 0x7f7f7f7f7f7f7f7fULL;
case SNDRV_PCM_FORMAT_A_LAW:

View file

@ -85,8 +85,8 @@ static snd_pcm_sframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
__snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames);
snd_pcm_areas_copy(pcm_areas, pcm_offset,
areas, offset,
pcm->channels,
areas, offset,
pcm->channels,
frames, pcm->format);
result = __snd_pcm_mmap_commit(pcm, pcm_offset, frames);
if (result < 0)
@ -114,11 +114,11 @@ static snd_pcm_sframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
snd_pcm_uframes_t pcm_offset;
snd_pcm_uframes_t frames = size;
snd_pcm_sframes_t result;
__snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames);
snd_pcm_areas_copy(areas, offset,
pcm_areas, pcm_offset,
pcm->channels,
pcm->channels,
frames, pcm->format);
result = __snd_pcm_mmap_commit(pcm, pcm_offset, frames);
if (result < 0)
@ -255,7 +255,7 @@ int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int s
} else
info->type = SND_PCM_AREA_LOCAL;
return 0;
}
}
int snd_pcm_mmap(snd_pcm_t *pcm)
{
@ -306,12 +306,12 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
size_t size;
unsigned int c1;
if (i->addr) {
a->addr = i->addr;
a->first = i->first;
a->step = i->step;
continue;
}
size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits;
a->addr = i->addr;
a->first = i->first;
a->step = i->step;
continue;
}
size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits;
for (c1 = c + 1; c1 < pcm->channels; ++c1) {
snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
size_t s;
@ -415,7 +415,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
switch (i1->type) {
case SND_PCM_AREA_MMAP:
if (i1->u.mmap.fd != i->u.mmap.fd ||
i1->u.mmap.offset != i->u.mmap.offset)
i1->u.mmap.offset != i->u.mmap.offset)
continue;
break;
case SND_PCM_AREA_SHM:
@ -425,7 +425,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
case SND_PCM_AREA_LOCAL:
if (pcm->access != SND_PCM_ACCESS_MMAP_INTERLEAVED &&
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED)
continue;
continue;
break;
default:
assert(0);

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_generic.h"

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "plugin_ops.h"
@ -287,7 +287,7 @@ static int snd_pcm_mulaw_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
return err;
return 0;
}
static int snd_pcm_mulaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -365,7 +365,7 @@ snd_pcm_mulaw_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep)
size = *slave_sizep;
mulaw->func(slave_areas, slave_offset,
areas, offset,
areas, offset,
pcm->channels, size,
mulaw->getput_idx);
*slave_sizep = size;
@ -384,7 +384,7 @@ snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
snd_pcm_mulaw_t *mulaw = pcm->private_data;
if (size > *slave_sizep)
size = *slave_sizep;
mulaw->func(areas, offset,
mulaw->func(areas, offset,
slave_areas, slave_offset,
pcm->channels, size,
mulaw->getput_idx);
@ -395,7 +395,7 @@ snd_pcm_mulaw_read_areas(snd_pcm_t *pcm,
static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_mulaw_t *mulaw = pcm->private_data;
snd_output_printf(out, "Mu-Law conversion PCM (%s)\n",
snd_output_printf(out, "Mu-Law conversion PCM (%s)\n",
snd_pcm_format_name(mulaw->sformat));
if (pcm->setup) {
snd_output_printf(out, "Its setup is:\n");
@ -484,15 +484,15 @@ format and rate must match for both of them.
\code
pcm.name {
type mulaw # Mu-Law conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
type mulaw # Mu-Law conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
format STR # Slave format
}
}
\endcode
@ -519,7 +519,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_generic.h"
#include <stdio.h>
@ -208,7 +208,7 @@ static int snd_pcm_multi_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
return err;
return 0;
}
static int snd_pcm_multi_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
unsigned int slave_idx ATTRIBUTE_UNUSED,
snd_pcm_hw_params_t *params,
@ -523,7 +523,7 @@ static int snd_pcm_multi_reset(snd_pcm_t *pcm)
for (i = 0; i < multi->slaves_count; ++i) {
/* Reset each slave, as well as in prepare */
err = snd_pcm_reset(multi->slaves[i].pcm);
if (err < 0)
if (err < 0)
result = err;
}
multi->hw_ptr = multi->appl_ptr = 0;
@ -735,7 +735,7 @@ static int snd_pcm_multi_resume(snd_pcm_t *pcm)
* including the first one has to be relinked to the given master.
*/
static int snd_pcm_multi_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master)
{
{
snd_pcm_multi_t *multi = pcm->private_data;
unsigned int i;
int err;
@ -993,7 +993,7 @@ static void snd_pcm_multi_dump(snd_pcm_t *pcm, snd_output_t *out)
snd_pcm_multi_channel_t *c = &multi->channels[k];
if (c->slave_idx < 0)
continue;
snd_output_printf(out, " %d: slave %d, channel %d\n",
snd_output_printf(out, " %d: slave %d, channel %d\n",
k, c->slave_idx, c->slave_channel);
}
if (pcm->setup) {
@ -1097,7 +1097,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
}
stream = slaves_pcm[0]->stream;
multi->slaves_count = slaves_count;
multi->master_slave = master_slave;
multi->slaves = calloc(slaves_count, sizeof(*multi->slaves));
@ -1160,8 +1160,8 @@ This plugin converts multiple streams to one.
\code
pcm.name {
type multi # Multiple streams conversion PCM
slaves { # Slaves definition
type multi # Multiple streams conversion PCM
slaves { # Slaves definition
ID STR # Slave PCM name
# or
ID {
@ -1170,7 +1170,7 @@ pcm.name {
pcm { } # Slave PCM definition
channels INT # Slave channels
}
}
}
bindings { # Bindings table
N {
slave STR # Slave key
@ -1412,7 +1412,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
err = -EINVAL;
goto _free;
}
if (schannel < 0 ||
if (schannel < 0 ||
(unsigned int) schannel >= slaves_channels[slave]) {
snd_error(PCM, "Invalid or missing schannel for channel %s", id);
err = -EINVAL;
@ -1421,7 +1421,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
channels_sidx[cchannel] = slave;
channels_schannel[cchannel] = schannel;
}
for (idx = 0; idx < slaves_count; ++idx) {
err = snd_pcm_open_slave(&slaves_pcm[idx], root,
slaves_conf[idx], stream, mode,

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "bswap.h"
@ -82,11 +82,11 @@ static int snd_pcm_null_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm)
{
snd_pcm_null_t *null = pcm->private_data;
if (null->state == SND_PCM_STATE_PREPARED) {
/* it is required to return the correct avail count for */
/* the prepared stream, otherwise the start is not called */
return snd_pcm_mmap_avail(pcm);
}
if (null->state == SND_PCM_STATE_PREPARED) {
/* it is required to return the correct avail count for */
/* the prepared stream, otherwise the start is not called */
return snd_pcm_mmap_avail(pcm);
}
return pcm->buffer_size;
}
@ -403,7 +403,7 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
}
null->poll_fd = fd;
null->state = SND_PCM_STATE_OPEN;
err = snd_pcm_new(&pcm, SND_PCM_TYPE_NULL, name, stream, mode);
if (err < 0) {
close(fd);
@ -434,7 +434,7 @@ and /dev/full (capture, must be readable).
\code
pcm.name {
type null # Null PCM
type null # Null PCM
[chmap MAP] # Provide channel maps; MAP is a string array
}
\endcode
@ -462,7 +462,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#ifndef NDEBUG
@ -124,7 +124,7 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params)
params->info = ~0U;
}
/* Return the value for field PAR if it's fixed in configuration space
/* Return the value for field PAR if it's fixed in configuration space
defined by PARAMS. Return -EINVAL otherwise
*/
int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
@ -267,12 +267,12 @@ static int _snd_pcm_hw_param_set_integer(snd_pcm_hw_params_t *params,
}
return changed;
}
/* Inside configuration space defined by PARAMS remove from PAR all
/* Inside configuration space defined by PARAMS remove from PAR all
non integer values. Reduce configuration space accordingly.
Return -EINVAL if the configuration space is empty
*/
int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm,
int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params,
snd_set_mode_t mode,
snd_pcm_hw_param_t var)
@ -328,12 +328,12 @@ static int _snd_pcm_hw_param_set_first(snd_pcm_hw_params_t *params,
}
/* Inside configuration space defined by PARAMS remove from PAR all
/* Inside configuration space defined by PARAMS remove from PAR all
values > minimum. Reduce configuration space accordingly.
Return the minimum.
*/
int snd_pcm_hw_param_set_first(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params,
int snd_pcm_hw_param_set_first(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
unsigned int *rval, int *dir)
{
@ -370,11 +370,11 @@ static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params,
}
/* Inside configuration space defined by PARAMS remove from PAR all
/* Inside configuration space defined by PARAMS remove from PAR all
values < maximum. Reduce configuration space accordingly.
Return the maximum.
*/
int snd_pcm_hw_param_set_last(snd_pcm_t *pcm,
int snd_pcm_hw_param_set_last(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
unsigned int *rval, int *dir)
@ -422,7 +422,7 @@ int _snd_pcm_hw_param_set_min(snd_pcm_hw_params_t *params,
return changed;
}
/* Inside configuration space defined by PARAMS remove from PAR all
/* Inside configuration space defined by PARAMS remove from PAR all
values < VAL. Reduce configuration space accordingly.
Return new minimum or -EINVAL if the configuration space is empty
*/
@ -499,7 +499,7 @@ int _snd_pcm_hw_param_set_max(snd_pcm_hw_params_t *params,
return changed;
}
/* Inside configuration space defined by PARAMS remove from PAR all
/* Inside configuration space defined by PARAMS remove from PAR all
values >= VAL + 1. Reduce configuration space accordingly.
Return new maximum or -EINVAL if the configuration space is empty
*/
@ -610,7 +610,7 @@ int _snd_pcm_hw_param_set_minmax(snd_pcm_hw_params_t *params,
return changed;
}
/* Inside configuration space defined by PARAMS remove from PAR all
/* Inside configuration space defined by PARAMS remove from PAR all
values < MIN and all values > MAX. Reduce configuration space accordingly.
Return 0 or -EINVAL if the configuration space is empty
*/
@ -636,7 +636,7 @@ int snd_pcm_hw_param_set_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
assert(0);
return -EINVAL;
}
err = _snd_pcm_hw_param_set_minmax(params, var,
err = _snd_pcm_hw_param_set_minmax(params, var,
*min, mindir ? *mindir : 0,
*max, maxdir ? *maxdir : 0);
if (err < 0)
@ -707,7 +707,7 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
return changed;
}
/* Inside configuration space defined by PARAMS remove from PAR all
/* Inside configuration space defined by PARAMS remove from PAR all
values != VAL. Reduce configuration space accordingly.
Return -EINVAL if the configuration space is empty
*/
@ -845,7 +845,7 @@ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
dump_hw_params(params, "set_near", var, *val, err);
return err;
}
if (err >= 0) {
snd_pcm_hw_params_t params1;
if (min == saved_min && mindir == valdir)
@ -887,7 +887,7 @@ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
Return the value found.
*/
int snd_pcm_hw_param_set_next(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
snd_pcm_hw_param_t var,
unsigned int best, int bestdir,
unsigned int val, int *dir)
{
@ -1110,7 +1110,7 @@ static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (err >= 0)
err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, &max, &dir);
if (err >= 0 && (long)min < pcm->minperiodtime &&
(long)max > pcm->minperiodtime) {
(long)max > pcm->minperiodtime) {
min = pcm->minperiodtime; dir = 1;
snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, SND_PCM_HW_PARAM_PERIOD_TIME, &min, &dir);
}
@ -1187,7 +1187,7 @@ int _snd_pcm_hw_param_refine(snd_pcm_hw_params_t *params,
}
return changed;
}
#if 0
static void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
const snd_pcm_hw_params_t *src)
@ -1474,7 +1474,7 @@ unsigned int snd_pcm_hw_strategy_simple_near_min_badness(const snd_pcm_hw_params
diff = -diff;
return diff * p->mul;
}
int snd_pcm_hw_strategy_simple_near_next_value(snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
int value, int *dir,
@ -1510,7 +1510,7 @@ unsigned int snd_pcm_hw_strategy_simple_choices_min_badness(const snd_pcm_hw_par
assert(0);
return UINT_MAX;
}
int snd_pcm_hw_strategy_simple_choices_next_value(snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
int value, int *dir,
@ -1638,7 +1638,7 @@ int snd_pcm_hw_params_try_explain_failure1(snd_pcm_t *pcm,
i = *success;
_snd_pcm_hw_param_copy(&i, var, fail);
err = snd_pcm_hw_refine(pcm, &i);
if (err == 0 &&
if (err == 0 &&
snd_pcm_hw_params_try_explain_failure1(pcm, fail, &i, depth - 1, out) < 0)
continue;
snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(var));
@ -1801,133 +1801,133 @@ static const snd_pcm_hw_rule_t refine_rules[] = {
.private_data = 0,
},
{
.var = SND_PCM_HW_PARAM_SAMPLE_BITS,
.var = SND_PCM_HW_PARAM_SAMPLE_BITS,
.func = snd_pcm_hw_rule_sample_bits,
.deps = { SND_PCM_HW_PARAM_FORMAT,
.deps = { SND_PCM_HW_PARAM_FORMAT,
SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
.private_data = 0,
},
{
.var = SND_PCM_HW_PARAM_SAMPLE_BITS,
.var = SND_PCM_HW_PARAM_SAMPLE_BITS,
.func = snd_pcm_hw_rule_div,
.deps = { SND_PCM_HW_PARAM_FRAME_BITS,
SND_PCM_HW_PARAM_CHANNELS, -1 },
.private_data = 0,
},
{
.var = SND_PCM_HW_PARAM_FRAME_BITS,
.var = SND_PCM_HW_PARAM_FRAME_BITS,
.func = snd_pcm_hw_rule_mul,
.deps = { SND_PCM_HW_PARAM_SAMPLE_BITS,
SND_PCM_HW_PARAM_CHANNELS, -1 },
.private_data = 0,
},
{
.var = SND_PCM_HW_PARAM_FRAME_BITS,
.var = SND_PCM_HW_PARAM_FRAME_BITS,
.func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_PERIOD_BYTES,
SND_PCM_HW_PARAM_PERIOD_SIZE, -1 },
.private_data = (void*) 8,
},
{
.var = SND_PCM_HW_PARAM_FRAME_BITS,
.var = SND_PCM_HW_PARAM_FRAME_BITS,
.func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_BUFFER_BYTES,
SND_PCM_HW_PARAM_BUFFER_SIZE, -1 },
.private_data = (void*) 8,
},
{
.var = SND_PCM_HW_PARAM_CHANNELS,
.var = SND_PCM_HW_PARAM_CHANNELS,
.func = snd_pcm_hw_rule_div,
.deps = { SND_PCM_HW_PARAM_FRAME_BITS,
SND_PCM_HW_PARAM_SAMPLE_BITS, -1 },
.private_data = 0,
},
{
.var = SND_PCM_HW_PARAM_RATE,
.var = SND_PCM_HW_PARAM_RATE,
.func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
SND_PCM_HW_PARAM_PERIOD_TIME, -1 },
.private_data = (void*) 1000000,
},
{
.var = SND_PCM_HW_PARAM_RATE,
.var = SND_PCM_HW_PARAM_RATE,
.func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_BUFFER_TIME, -1 },
.private_data = (void*) 1000000,
},
{
.var = SND_PCM_HW_PARAM_PERIODS,
.var = SND_PCM_HW_PARAM_PERIODS,
.func = snd_pcm_hw_rule_div,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_PERIOD_SIZE, -1 },
.private_data = 0,
},
{
.var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.func = snd_pcm_hw_rule_div,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_PERIODS, -1 },
.private_data = 0,
},
{
.var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_PERIOD_BYTES,
SND_PCM_HW_PARAM_FRAME_BITS, -1 },
.private_data = (void*) 8,
},
{
.var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.var = SND_PCM_HW_PARAM_PERIOD_SIZE,
.func = snd_pcm_hw_rule_muldivk,
.deps = { SND_PCM_HW_PARAM_PERIOD_TIME,
SND_PCM_HW_PARAM_RATE, -1 },
.private_data = (void*) 1000000,
},
{
.var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.func = snd_pcm_hw_rule_mul,
.deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
SND_PCM_HW_PARAM_PERIODS, -1 },
.private_data = 0,
},
{
.var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_BUFFER_BYTES,
SND_PCM_HW_PARAM_FRAME_BITS, -1 },
.private_data = (void*) 8,
},
{
.var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.var = SND_PCM_HW_PARAM_BUFFER_SIZE,
.func = snd_pcm_hw_rule_muldivk,
.deps = { SND_PCM_HW_PARAM_BUFFER_TIME,
SND_PCM_HW_PARAM_RATE, -1 },
.private_data = (void*) 1000000,
},
{
.var = SND_PCM_HW_PARAM_PERIOD_BYTES,
.var = SND_PCM_HW_PARAM_PERIOD_BYTES,
.func = snd_pcm_hw_rule_muldivk,
.deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
SND_PCM_HW_PARAM_FRAME_BITS, -1 },
.private_data = (void*) 8,
},
{
.var = SND_PCM_HW_PARAM_BUFFER_BYTES,
.var = SND_PCM_HW_PARAM_BUFFER_BYTES,
.func = snd_pcm_hw_rule_muldivk,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_FRAME_BITS, -1 },
.private_data = (void*) 8,
},
{
.var = SND_PCM_HW_PARAM_PERIOD_TIME,
.var = SND_PCM_HW_PARAM_PERIOD_TIME,
.func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_PERIOD_SIZE,
SND_PCM_HW_PARAM_RATE, -1 },
.private_data = (void*) 1000000,
},
{
.var = SND_PCM_HW_PARAM_BUFFER_TIME,
.var = SND_PCM_HW_PARAM_BUFFER_TIME,
.func = snd_pcm_hw_rule_mulkdiv,
.deps = { SND_PCM_HW_PARAM_BUFFER_SIZE,
SND_PCM_HW_PARAM_RATE, -1 },
@ -2015,7 +2015,7 @@ static const snd_mask_t refine_masks[SND_PCM_HW_PARAM_LAST_MASK - SND_PCM_HW_PAR
},
},
};
static const snd_interval_t refine_intervals[SND_PCM_HW_PARAM_LAST_INTERVAL - SND_PCM_HW_PARAM_FIRST_INTERVAL + 1] = {
[SND_PCM_HW_PARAM_SAMPLE_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = {
.min = 1, .max = UINT_MAX,
@ -2433,14 +2433,14 @@ int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
min_align *= 2;
}
pcm->min_align = min_align;
pcm->hw_flags = params->flags;
pcm->info = params->info;
pcm->msbits = params->msbits;
pcm->rate_num = params->rate_num;
pcm->rate_den = params->rate_den;
pcm->fifo_size = params->fifo_size;
/* Default sw params */
memset(&sw, 0, sizeof(sw));
err = snd_pcm_sw_params_default(pcm, &sw);
@ -2450,7 +2450,7 @@ int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (err < 0)
return err;
if (pcm->mmap_rw ||
if (pcm->mmap_rw ||
pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
pcm->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED ||
pcm->access == SND_PCM_ACCESS_MMAP_COMPLEX) {

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
@ -85,7 +85,7 @@ static int snd_pcm_plug_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
snd_pcm_plug_t *plug = pcm->private_data;
snd_pcm_t *slave = plug->req_slave;
int err;
if ((err = snd_pcm_info(slave, info)) < 0)
return err;
return 0;
@ -743,7 +743,7 @@ static int snd_pcm_plug_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *
{
snd_pcm_plug_t *plug = pcm->private_data;
int err;
_snd_pcm_hw_params_any(sparams);
if (plug->sformat >= 0) {
_snd_pcm_hw_params_set_format(sparams, plug->sformat);
@ -782,7 +782,7 @@ static int check_access_change(snd_pcm_hw_params_t *cparams,
/* no mmap support - we need mmap emulation */
if (!snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_INTERLEAVED) &&
!snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_NONINTERLEAVED))
!snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_NONINTERLEAVED))
return -EINVAL; /* even no RW access? no way! */
cmask = (const snd_pcm_access_mask_t *)
@ -832,7 +832,7 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
if (err < 0)
return err;
}
if (plug->schannels == -2 || (pcm->mode & SND_PCM_NO_AUTO_CHANNELS))
links |= SND_PCM_HW_PARBIT_CHANNELS;
else {
@ -909,7 +909,7 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
return err;
return 0;
}
static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
@ -964,8 +964,8 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
}
return -EINVAL;
}
err = _snd_pcm_hw_param_set_mask(params,
err = _snd_pcm_hw_param_set_mask(params,
SND_PCM_HW_PARAM_FORMAT, &fmt_mask);
if (err < 0)
return err;
@ -978,7 +978,7 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
else {
unsigned int rate_min, srate_min;
int rate_mindir, srate_mindir;
/* This is a temporary hack, waiting for a better solution */
err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, &rate_mindir);
if (err < 0)
@ -1172,7 +1172,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
plug->tt_ssize = tt_ssize;
plug->tt_cused = tt_cused;
plug->tt_sused = tt_sused;
err = snd_pcm_new(&pcm, SND_PCM_TYPE_PLUG, name, slave->stream, slave->mode);
if (err < 0) {
free(plug);
@ -1210,17 +1210,17 @@ This plugin converts channels, rate and format on request.
\code
pcm.name {
type plug # Automatic conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
type plug # Automatic conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format (default nearest) or "unchanged"
[channels INT] # Slave channels (default nearest) or "unchanged"
[rate INT] # Slave rate (default nearest) or "unchanged"
}
}
route_policy STR # route policy for automatic ttable generation
# STR can be 'default', 'average', 'copy', 'duplicate'
# average: result is average of input channels
@ -1263,7 +1263,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -1357,7 +1357,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
}
}
#endif
#ifdef BUILD_PCM_PLUGIN_RATE
if (! rate_converter)
rate_converter = snd_pcm_rate_get_default_converter(root);

View file

@ -81,7 +81,7 @@ pcm.rate44100Hz {
\endcode
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include <limits.h>
@ -197,8 +197,8 @@ snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames
frames = n;
if (frames == 0)
return 0;
sframes = frames;
sframes = frames;
sframes = snd_pcm_rewind(plugin->gen.slave, sframes);
if (sframes < 0)
return sframes;
@ -221,8 +221,8 @@ snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frame
frames = n;
if (frames == 0)
return 0;
sframes = frames;
sframes = frames;
sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes);
if (sframes < 0)
return sframes;
@ -246,7 +246,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
const snd_pcm_channel_area_t *slave_areas;
snd_pcm_uframes_t slave_offset;
snd_pcm_uframes_t slave_frames = ULONG_MAX;
result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
if (result < 0) {
err = result;
@ -298,13 +298,13 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
snd_pcm_uframes_t xfer = 0;
snd_pcm_sframes_t result;
int err;
while (size > 0) {
snd_pcm_uframes_t frames = size;
const snd_pcm_channel_area_t *slave_areas;
snd_pcm_uframes_t slave_offset;
snd_pcm_uframes_t slave_frames = ULONG_MAX;
result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
if (result < 0) {
err = result;
@ -324,7 +324,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
snd_pcm_sframes_t res;
res = plugin->undo_read(slave, areas, offset, frames, slave_frames - result);
if (res < 0) {
err = res;
@ -353,7 +353,7 @@ snd_pcm_plugin_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size
{
snd_pcm_channel_area_t areas[pcm->channels];
snd_pcm_areas_from_buf(pcm, areas, (void*)buffer);
return snd_pcm_write_areas(pcm, areas, 0, size,
return snd_pcm_write_areas(pcm, areas, 0, size,
snd_pcm_plugin_write_areas);
}
@ -427,7 +427,7 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm,
result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
snd_pcm_sframes_t res;
res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result);
if (res < 0) {
err = res;
@ -532,8 +532,8 @@ static snd_pcm_sframes_t snd_pcm_plugin_sync_hw_ptr(snd_pcm_t *pcm,
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED)
return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size);
*pcm->hw.ptr = slave_hw_ptr;
return slave_size;
*pcm->hw.ptr = slave_hw_ptr;
return slave_size;
}
static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)

View file

@ -18,16 +18,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_generic.h"
typedef snd_pcm_uframes_t (*snd_pcm_slave_xfer_areas_func_t)
(snd_pcm_t *pcm,
(snd_pcm_t *pcm,
const snd_pcm_channel_area_t *areas,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t size,
const snd_pcm_channel_area_t *slave_areas,
snd_pcm_uframes_t slave_offset,
snd_pcm_uframes_t slave_offset,
snd_pcm_uframes_t *slave_sizep);
typedef snd_pcm_sframes_t (*snd_pcm_slave_xfer_areas_undo_func_t)
@ -45,7 +45,7 @@ typedef struct {
snd_pcm_slave_xfer_areas_undo_func_t undo_write;
int (*init)(snd_pcm_t *pcm);
snd_pcm_uframes_t appl_ptr, hw_ptr;
} snd_pcm_plugin_t;
} snd_pcm_plugin_t;
/* make local functions really local */
#define snd_pcm_plugin_init \

View file

@ -195,7 +195,7 @@ static int snd_pcm_rate_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
return err;
return 0;
}
static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -237,10 +237,10 @@ static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
period_size->openmin && period_size->openmax &&
period_size->min + 1 == period_size->max) {
if (period_size->min > 0 && (buffer_size->min / period_size->min) * period_size->min == buffer_size->min) {
snd_interval_set_value(period_size, period_size->min);
} else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) {
snd_interval_set_value(period_size, period_size->max);
}
snd_interval_set_value(period_size, period_size->min);
} else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) {
snd_interval_set_value(period_size, period_size->max);
}
}
}
#ifdef DEBUG_REFINE
@ -266,7 +266,7 @@ static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
return 0;
}
static int snd_pcm_rate_hw_refine(snd_pcm_t *pcm,
static int snd_pcm_rate_hw_refine(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params)
{
return snd_pcm_hw_refine_slave(pcm, params,
@ -756,15 +756,15 @@ static snd_pcm_sframes_t snd_pcm_rate_forwardable(snd_pcm_t *pcm ATTRIBUTE_UNUSE
}
static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
snd_pcm_uframes_t frames ATTRIBUTE_UNUSED)
snd_pcm_uframes_t frames ATTRIBUTE_UNUSED)
{
return 0;
return 0;
}
static snd_pcm_sframes_t snd_pcm_rate_forward(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
snd_pcm_uframes_t frames ATTRIBUTE_UNUSED)
snd_pcm_uframes_t frames ATTRIBUTE_UNUSED)
{
return 0;
return 0;
}
static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
@ -845,7 +845,7 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
if (xfer == slave_size)
goto commit_done;
/* commit second fragment */
cont = slave_size - cont;
slave_frames = cont;
@ -958,7 +958,7 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of
}
#endif
snd_pcm_areas_copy(rate->sareas, xfer,
slave_areas, slave_offset,
slave_areas, slave_offset,
pcm->channels, cont,
rate->gen.slave->format);
result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont);
@ -1046,7 +1046,7 @@ static snd_pcm_sframes_t snd_pcm_rate_avail_update_capture(snd_pcm_t *pcm,
snd_pcm_rate_t *rate = pcm->private_data;
snd_pcm_t *slave = rate->gen.slave;
snd_pcm_uframes_t xfer, hw_offset, size;
xfer = snd_pcm_mmap_capture_avail(pcm);
size = pcm->buffer_size - xfer;
hw_offset = snd_pcm_mmap_hw_offset(pcm);
@ -1197,7 +1197,7 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm)
{
snd_pcm_rate_t *rate = pcm->private_data;
snd_pcm_sframes_t avail;
if (pcm->stream == SND_PCM_STREAM_CAPTURE)
return snd_pcm_start(rate->gen.slave);
@ -1253,10 +1253,10 @@ static void snd_pcm_rate_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_rate_t *rate = pcm->private_data;
if (rate->sformat == SND_PCM_FORMAT_UNKNOWN)
snd_output_printf(out, "Rate conversion PCM (%d)\n",
snd_output_printf(out, "Rate conversion PCM (%d)\n",
rate->srate);
else
snd_output_printf(out, "Rate conversion PCM (%d, sformat=%s)\n",
snd_output_printf(out, "Rate conversion PCM (%d, sformat=%s)\n",
rate->srate,
snd_pcm_format_name(rate->sformat));
if (rate->ops.dump)
@ -1627,15 +1627,15 @@ This plugin converts a stream rate. The input and output formats must be linear.
\code
pcm.name {
type rate # Rate PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
rate INT # Slave rate
[format STR] # Slave format
}
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
rate INT # Slave rate
[format STR] # Slave format
}
converter STR # optional
# or
converter [ STR1 STR2 ... ] # optional
@ -1672,7 +1672,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -1713,7 +1713,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
return err;
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf);
snd_config_delete(sconf);
snd_error(PCM, "slave format is not linear");
return -EINVAL;
}

View file

@ -1,6 +1,6 @@
/*
* Linear rate converter plugin
*
*
* Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
* 2004 by Jaroslav Kysela <perex@perex.cz>
* 2006 by Takashi Iwai <tiwai@suse.de>
@ -83,7 +83,7 @@ static void linear_expand(struct rate_linear *rate,
unsigned int dst_frames1;
int16_t sample = 0;
unsigned int pos;
for (channel = 0; channel < rate->channels; ++channel) {
const snd_pcm_channel_area_t *src_area = &src_areas[channel];
const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
@ -129,7 +129,7 @@ static void linear_expand(struct rate_linear *rate,
src += src_step;
src_frames1++;
}
}
}
rate->old_sample[channel] = new_sample;
}
}
@ -146,7 +146,7 @@ static void linear_expand_s16(struct rate_linear *rate,
unsigned int dst_frames1;
unsigned int get_threshold = rate->pitch;
unsigned int pos;
for (channel = 0; channel < rate->channels; ++channel) {
const snd_pcm_channel_area_t *src_area = &src_areas[channel];
const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
@ -181,7 +181,7 @@ static void linear_expand_s16(struct rate_linear *rate,
src += src_step;
src_frames1++;
}
}
}
rate->old_sample[channel] = new_sample;
}
}
@ -223,7 +223,7 @@ static void linear_shrink(struct rate_linear *rate,
src_frames1 = 0;
dst_frames1 = 0;
while (src_frames1 < src_frames) {
goto *get;
#define GET16_END after_get
#include "plugin_ops.h"
@ -285,7 +285,7 @@ static void linear_shrink_s16(struct rate_linear *rate,
src_frames1 = 0;
dst_frames1 = 0;
while (src_frames1 < src_frames) {
new_sample = *src;
src += src_step;
src_frames1++;
@ -307,7 +307,7 @@ static void linear_shrink_s16(struct rate_linear *rate,
}
}
static void linear_convert(void *obj,
static void linear_convert(void *obj,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset, unsigned int dst_frames,
const snd_pcm_channel_area_t *src_areas,
@ -364,7 +364,7 @@ static int linear_adjust_pitch(void *obj, snd_pcm_rate_info_t *info)
rate->pitch = (((uint64_t)info->out.period_size * LINEAR_DIV) +
(info->in.period_size/2) ) / info->in.period_size;
cframes = input_frames(rate, info->out.period_size);
while (cframes != info->in.period_size) {
snd_pcm_uframes_t cframes_new;

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include "pcm_plugin.h"
#include "plugin_ops.h"
@ -155,7 +155,7 @@ static void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *dst_area,
frames, ttable, params);
return;
}
conv = conv_labels[params->conv_idx];
src = snd_pcm_channel_area_addr(src_area, src_offset);
dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
@ -206,7 +206,7 @@ static void snd_pcm_route_convert1_one_getput(const snd_pcm_channel_area_t *dst_
frames, ttable, params);
return;
}
get = get32_labels[params->get_idx];
put = put32_labels[params->put_idx];
src = snd_pcm_channel_area_addr(src_area, src_offset);
@ -315,7 +315,7 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
/* Zero sum */
goto *zero;
zero_int64:
zero_int64:
sum.as_sint64 = 0;
goto zero_end;
#if SND_PCM_PLUGIN_ROUTE_FLOAT
@ -326,7 +326,7 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
zero_end:
for (srcidx = 0; srcidx < nsrcs; ++srcidx) {
const char *src = srcs[srcidx];
/* Get sample */
goto *get32;
#define GET32_END after_get
@ -356,7 +356,7 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
srcs[srcidx] += src_steps[srcidx];
ttp++;
}
/* Normalization */
goto *norm;
norm_int64_att:
@ -383,14 +383,14 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
goto after_norm;
#endif
after_norm:
/* Put sample */
goto *put32;
#define PUT32_END after_put32
#include "plugin_ops.h"
#undef PUT32_END
after_put32:
dst += dst_step;
}
}
@ -499,7 +499,7 @@ static int snd_pcm_route_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *
SND_PCM_HW_PARBIT_BUFFER_TIME |
SND_PCM_HW_PARBIT_TICK_TIME);
if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
links |= (SND_PCM_HW_PARBIT_FORMAT |
links |= (SND_PCM_HW_PARBIT_FORMAT |
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS);
if (route->schannels < 0)
@ -509,7 +509,7 @@ static int snd_pcm_route_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *
return err;
return 0;
}
static int snd_pcm_route_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -523,7 +523,7 @@ static int snd_pcm_route_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *
SND_PCM_HW_PARBIT_BUFFER_TIME |
SND_PCM_HW_PARBIT_TICK_TIME);
if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
links |= (SND_PCM_HW_PARBIT_FORMAT |
links |= (SND_PCM_HW_PARBIT_FORMAT |
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS);
if (route->schannels < 0)
@ -599,7 +599,7 @@ snd_pcm_route_write_areas(snd_pcm_t *pcm,
if (size > *slave_sizep)
size = *slave_sizep;
snd_pcm_route_convert(slave_areas, slave_offset,
areas, offset,
areas, offset,
pcm->channels,
slave->channels,
size, &route->params);
@ -620,7 +620,7 @@ snd_pcm_route_read_areas(snd_pcm_t *pcm,
snd_pcm_t *slave = route->plug.gen.slave;
if (size > *slave_sizep)
size = *slave_sizep;
snd_pcm_route_convert(areas, offset,
snd_pcm_route_convert(areas, offset,
slave_areas, slave_offset,
slave->channels,
pcm->channels,
@ -686,7 +686,7 @@ static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out)
if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
snd_output_printf(out, "Route conversion PCM\n");
else
snd_output_printf(out, "Route conversion PCM (sformat=%s)\n",
snd_output_printf(out, "Route conversion PCM (sformat=%s)\n",
snd_pcm_format_name(route->sformat));
snd_output_puts(out, " Transformation table:\n");
for (dst = 0; dst < route->params.ndsts; dst++) {
@ -1025,7 +1025,7 @@ int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_route_t *route;
int err;
assert(pcmp && slave && ttable);
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1)
return -EINVAL;
route = calloc(1, sizeof(snd_pcm_route_t));
@ -1166,7 +1166,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
if (snd_config_get_id(in, &id) < 0)
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 ||
if (err < 0 ||
cchannel < 0 || (unsigned int) cchannel > tt_csize) {
snd_error(PCM, "Invalid client channel: %s", id);
return -EINVAL;
@ -1245,22 +1245,22 @@ If so, a matching channel map will be selected for the slave.
\code
pcm.name {
type route # Route & Volume conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format
[channels INT] # Slave channels
}
ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers)
CCHANNEL {
SCHANNEL REAL # route value (0.0 - 1.0)
}
}
[chmap MAP] # Override channel maps; MAP is a string array
type route # Route & Volume conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format
[channels INT] # Slave channels
}
ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers)
CCHANNEL {
SCHANNEL REAL # route value (0.0 - 1.0)
}
}
[chmap MAP] # Override channel maps; MAP is a string array
}
\endcode
@ -1287,7 +1287,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -1352,7 +1352,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
}
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf);
snd_config_delete(sconf);
snd_error(PCM, "slave format is not linear");
snd_pcm_free_chmaps(chmaps);
return -EINVAL;

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
@ -122,7 +122,7 @@ static snd_pcm_uframes_t snd_pcm_share_slave_avail(snd_pcm_share_slave_t *slave)
{
snd_pcm_sframes_t avail;
snd_pcm_t *pcm = slave->pcm;
avail = slave->hw_ptr - *pcm->appl.ptr;
avail = slave->hw_ptr - *pcm->appl.ptr;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
avail += pcm->buffer_size;
if (avail < 0)
@ -188,7 +188,7 @@ static snd_pcm_uframes_t _snd_pcm_share_slave_forward(snd_pcm_share_slave_t *sla
}
/*
/*
- stop PCM on xrun
- update poll status
- draining silencing
@ -566,7 +566,7 @@ static int snd_pcm_share_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
return err;
return 0;
}
static int snd_pcm_share_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -635,7 +635,7 @@ static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (err < 0)
goto _err;
err = _snd_pcm_hw_param_set_minmax(params, SND_PCM_HW_PARAM_RATE,
spcm->rate, 0,
spcm->rate, 0,
spcm->rate, 1);
if (err < 0)
goto _err;
@ -1253,7 +1253,7 @@ static int snd_pcm_share_drop(snd_pcm_t *pcm)
assert(0);
break;
}
share->appl_ptr = share->hw_ptr = 0;
_end:
Pthread_mutex_unlock(&slave->mutex);
@ -1435,7 +1435,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
free(share);
return -errno;
}
if (stream == SND_PCM_STREAM_PLAYBACK) {
int bufsize = 1;
err = setsockopt(sd[0], SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize));
@ -1533,7 +1533,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
share->pcm = pcm;
share->client_socket = sd[0];
share->slave_socket = sd[1];
pcm->mmap_rw = 1;
pcm->ops = &snd_pcm_share_ops;
pcm->fast_ops = &snd_pcm_share_fast_ops;
@ -1569,17 +1569,17 @@ doesn't need the explicit server but access to the shared buffer.
\code
pcm.name {
type share # Share PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
[format STR] # Slave format
[channels INT] # Slave channels
[rate INT] # Slave rate
[period_time INT] # Slave period time in us
[buffer_time INT] # Slave buffer time in us
}
type share # Share PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
[format STR] # Slave format
[channels INT] # Slave channels
[rate INT] # Slave rate
[period_time INT] # Slave period time in us
[buffer_time INT] # Slave buffer time in us
}
bindings {
N INT # Slave channel INT for client channel N
}
@ -1624,7 +1624,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
int srate = -1;
int speriod_time= -1, sbuffer_time = -1;
unsigned int schannel_max = 0;
snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i);
const char *id;
@ -1720,7 +1720,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
}
if (schannels <= 0)
schannels = schannel_max + 1;
err = snd_pcm_share_open(pcmp, name, sname, sformat, srate,
err = snd_pcm_share_open(pcmp, name, sname, sformat, srate,
(unsigned int) schannels,
speriod_time, sbuffer_time,
channels, channels_map, stream, mode);

View file

@ -25,7 +25,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "pcm_local.h"
#include <stdio.h>
#include <stdlib.h>
@ -91,7 +91,7 @@ static int snd_pcm_shm_new_rbptr(snd_pcm_t *pcm, snd_pcm_shm_t *shm,
size_t mmap_size, mmap_offset, offset;
int fd;
long result;
shm->ctrl->cmd = &pcm->hw == rbptr ? SND_PCM_IOCTL_HW_PTR_FD : SND_PCM_IOCTL_APPL_PTR_FD;
result = snd_pcm_shm_action_fd0(pcm, &fd);
if (result < 0)
@ -240,7 +240,7 @@ static int snd_pcm_shm_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pc
return err;
return 0;
}
static int snd_pcm_shm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
@ -283,7 +283,7 @@ static int snd_pcm_shm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
snd_pcm_shm_hw_refine_slave);
}
static int snd_pcm_shm_hw_params_slave(snd_pcm_t *pcm,
static int snd_pcm_shm_hw_params_slave(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params)
{
snd_pcm_shm_t *shm = pcm->private_data;
@ -644,7 +644,7 @@ static int make_local_socket(const char *filename)
snd_errornum(PCM, "socket failed");
return -errno;
}
addr->sun_family = AF_LOCAL;
memcpy(addr->sun_path, filename, l);
@ -732,7 +732,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
result = -errno;
goto _err;
}
shm = calloc(1, sizeof(snd_pcm_shm_t));
if (!shm) {
result = -ENOMEM;
@ -781,7 +781,7 @@ performance.
\code
pcm.name {
type shm # Shared memory PCM
type shm # Shared memory PCM
server STR # Server name
pcm STR # PCM name
}

View file

@ -58,7 +58,7 @@ static int set_hw_params(snd_pcm_t *pcm,
/*
* hardware parameters
*/
*/
err = snd_pcm_hw_params_any(pcm, hw_params);
if (err < 0)
return err;
@ -93,7 +93,7 @@ static int set_hw_params(snd_pcm_t *pcm,
err = INTERNAL(snd_pcm_hw_params_get_period_time)(hw_params, period_time, NULL);
if (err < 0)
return err;
}
}
} else {
err = snd_pcm_hw_params_set_period_time(pcm, hw_params, *period_time, 0);
if (err < 0)
@ -105,15 +105,15 @@ static int set_hw_params(snd_pcm_t *pcm,
if (err < 0)
return err;
return 0;
}
}
static int set_sw_params(snd_pcm_t *pcm,
snd_pcm_sw_params_t *sw_params,
snd_spcm_xrun_type_t xrun_type)
snd_spcm_xrun_type_t xrun_type)
{
int err;
err = snd_pcm_sw_params_current(pcm, sw_params);
err = snd_pcm_sw_params_current(pcm, sw_params);
if (err < 0)
return err;
err = snd_pcm_sw_params_set_start_threshold(pcm, sw_params, (pcm->buffer_size / pcm->period_size) * pcm->period_size);
@ -236,10 +236,10 @@ int snd_spcm_init_duplex(snd_pcm_t *playback_pcm,
/*
* hardware parameters
*/
err = set_buffer_time(latency, &xbuffer_time);
err = set_buffer_time(latency, &xbuffer_time);
if (err < 0)
return err;
for (i = 0; i < 2; i++) {
buffer_time[i] = xbuffer_time;
period_time[i] = i > 0 ? period_time[0] : 0;

View file

@ -294,7 +294,7 @@ static inline short MULTI_DIV_short(short a, unsigned int b, int swap)
} \
} \
} while (0)
#define GET_VOL_SCALE \
switch (ch) { \
case 0: \
@ -349,7 +349,7 @@ static void softvol_convert_stereo_vol(snd_pcm_softvol_t *svol,
case SND_PCM_FORMAT_S16_LE:
case SND_PCM_FORMAT_S16_BE:
/* 16bit samples */
CONVERT_AREA(short,
CONVERT_AREA(short,
!snd_pcm_format_cpu_endian(svol->sformat));
break;
case SND_PCM_FORMAT_S32_LE:
@ -404,7 +404,7 @@ static void softvol_convert_mono_vol(snd_pcm_softvol_t *svol,
case SND_PCM_FORMAT_S16_LE:
case SND_PCM_FORMAT_S16_BE:
/* 16bit samples */
CONVERT_AREA(short,
CONVERT_AREA(short,
!snd_pcm_format_cpu_endian(svol->sformat));
break;
case SND_PCM_FORMAT_S32_LE:
@ -475,7 +475,7 @@ static int snd_pcm_softvol_hw_refine_cprepare(snd_pcm_t *pcm,
(1ULL << SND_PCM_FORMAT_S16_BE) |
(1ULL << SND_PCM_FORMAT_S24_LE) |
(1ULL << SND_PCM_FORMAT_S32_LE) |
(1ULL << SND_PCM_FORMAT_S32_BE),
(1ULL << SND_PCM_FORMAT_S32_BE),
(1ULL << (SND_PCM_FORMAT_S24_3LE - 32))
}
};
@ -562,7 +562,7 @@ static int snd_pcm_softvol_hw_refine_schange(snd_pcm_t *pcm,
SND_PCM_HW_PARBIT_BUFFER_TIME |
SND_PCM_HW_PARBIT_TICK_TIME);
if (svol->sformat == SND_PCM_FORMAT_UNKNOWN)
links |= (SND_PCM_HW_PARBIT_FORMAT |
links |= (SND_PCM_HW_PARBIT_FORMAT |
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS);
err = _snd_pcm_hw_params_refine(sparams, links, params);
@ -575,7 +575,7 @@ static int snd_pcm_softvol_hw_refine_schange(snd_pcm_t *pcm,
return 0;
}
static int snd_pcm_softvol_hw_refine_cchange(snd_pcm_t *pcm,
snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
@ -591,7 +591,7 @@ static int snd_pcm_softvol_hw_refine_cchange(snd_pcm_t *pcm,
SND_PCM_HW_PARBIT_BUFFER_TIME |
SND_PCM_HW_PARBIT_TICK_TIME);
if (svol->sformat == SND_PCM_FORMAT_UNKNOWN)
links |= (SND_PCM_HW_PARBIT_FORMAT |
links |= (SND_PCM_HW_PARBIT_FORMAT |
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS);
err = _snd_pcm_hw_params_refine(params, links, sparams);
@ -628,7 +628,7 @@ static int snd_pcm_softvol_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * param
return err;
if (slave->format != SND_PCM_FORMAT_S16_LE &&
slave->format != SND_PCM_FORMAT_S16_BE &&
slave->format != SND_PCM_FORMAT_S24_3LE &&
slave->format != SND_PCM_FORMAT_S24_3LE &&
slave->format != SND_PCM_FORMAT_S24_LE &&
slave->format != SND_PCM_FORMAT_S32_LE &&
slave->format != SND_PCM_FORMAT_S32_BE) {
@ -727,7 +727,7 @@ static int add_user_ctl(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo,
int err;
int i;
unsigned int def_val;
if (svol->max_val == 1) {
snd_ctl_elem_info_set_read_write(cinfo, 1, 1);
err = snd_ctl_add_boolean_elem_set(svol->ctl, cinfo, 1, count);
@ -795,7 +795,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
else
svol->zero_dB_val = (min_dB / (min_dB - max_dB)) *
svol->max_val;
snd_ctl_elem_info_set_id(&cinfo, ctl_id);
if ((err = snd_ctl_elem_info(svol->ctl, &cinfo)) < 0) {
if (err != -ENOENT) {
@ -926,7 +926,7 @@ int snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
sformat != SND_PCM_FORMAT_S16_LE &&
sformat != SND_PCM_FORMAT_S16_BE &&
sformat != SND_PCM_FORMAT_S24_3LE &&
sformat != SND_PCM_FORMAT_S24_3LE &&
sformat != SND_PCM_FORMAT_S24_LE &&
sformat != SND_PCM_FORMAT_S32_LE &&
sformat != SND_PCM_FORMAT_S32_BE)
@ -1101,17 +1101,17 @@ any changes.
\code
pcm.name {
type softvol # Soft Volume conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format
}
control {
name STR # control element id string
type softvol # Soft Volume conversion PCM
slave STR # Slave name
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format
}
control {
name STR # control element id string
[card STR] # control card index
[iface STR] # interface of the element
[index INT] # index of the element
@ -1149,7 +1149,7 @@ pcm.name {
* changed in future.
*/
int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)
{
snd_config_iterator_t i, next;
@ -1245,7 +1245,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
sformat != SND_PCM_FORMAT_S16_LE &&
sformat != SND_PCM_FORMAT_S16_BE &&
sformat != SND_PCM_FORMAT_S24_3LE &&
sformat != SND_PCM_FORMAT_S24_3LE &&
sformat != SND_PCM_FORMAT_S24_LE &&
sformat != SND_PCM_FORMAT_S32_LE &&
sformat != SND_PCM_FORMAT_S32_BE) {

View file

@ -55,7 +55,7 @@ static const char **snd_pcm_open_objects[] = {
&_snd_module_pcm_hw,
#include "pcm_symbols_list.c"
};
void *snd_pcm_open_symbols(void)
{
return snd_pcm_open_objects;

View file

@ -260,7 +260,7 @@ conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END;
conv_xx12_x210: as_u32(dst) = sx24((uint32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END;
conv_xx12_012x: as_u32(dst) = sx24s((uint32_t)as_u16c(src) << 8); goto CONV_END;
conv_xx12_2100: as_u32(dst) = (uint32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END;
conv_xx12_0012: as_u32(dst) = (uint32_t)as_u16c(src); goto CONV_END;
conv_xx12_0012: as_u32(dst) = (uint32_t)as_u16c(src); goto CONV_END;
conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END;
conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END;
conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END;
@ -681,35 +681,35 @@ static void *const get32float_labels[2 * 2] = {
#ifdef GET32F_END
get32f_1234F_1234: tmp_float.f = as_floatc(src);
if (tmp_float.f >= 1.0)
sample = 0x7fffffff;
sample = 0x7fffffff;
else if (tmp_float.f <= -1.0)
sample = 0x80000000;
sample = 0x80000000;
else
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
goto GET32F_END;
get32f_4321F_1234: tmp_float.i = bswap_32(as_u32c(src));
if (tmp_float.f >= 1.0)
sample = 0x7fffffff;
sample = 0x7fffffff;
else if (tmp_float.f <= -1.0)
sample = 0x80000000;
sample = 0x80000000;
else
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
goto GET32F_END;
get32f_1234D_1234: tmp_double.d = as_doublec(src);
if (tmp_double.d >= 1.0)
sample = 0x7fffffff;
sample = 0x7fffffff;
else if (tmp_double.d <= -1.0)
sample = 0x80000000;
sample = 0x80000000;
else
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
goto GET32F_END;
get32f_4321D_1234: tmp_double.l = bswap_64(as_u64c(src));
if (tmp_double.d >= 1.0)
sample = 0x7fffffff;
sample = 0x7fffffff;
else if (tmp_double.d <= -1.0)
sample = 0x80000000;
sample = 0x80000000;
else
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
goto GET32F_END;
#endif

View file

@ -58,7 +58,7 @@ static int level_enable(snd_pcm_scope_t *scope)
snd_pcm_scope_set_callback_private(scope, level);
level->win = initscr();
winsdelln(level->win, snd_pcm_meter_get_channels(level->pcm));
getyx(level->win, y, x);
getyx(level->win, y, x);
level->top = y;
return 0;
}

View file

@ -86,7 +86,7 @@ is passed to \link ::snd_rawmidi_open() \endlink or \link ::snd_rawmidi_open_lco
It contains two parts: device name and arguments. Devices and arguments are described
in configuration files. The usual place for default definitions is at /usr/share/alsa/alsa.conf.
\subsection rawmidi_dev_names_default
\subsection rawmidi_dev_names_default
The default device is equal to hw device. The defaults are used:
@ -143,7 +143,7 @@ This example shows open and read/write rawmidi operations.
* \anchor example_test_rawmidi
* Shows open and read/write rawmidi operations.
*/
#include "rawmidi_local.h"
#include <stdio.h>
#include <stdlib.h>
@ -360,7 +360,7 @@ int snd_rawmidi_open_lconf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
int snd_rawmidi_close(snd_rawmidi_t *rawmidi)
{
int err;
assert(rawmidi);
assert(rawmidi);
err = rawmidi->ops->close(rawmidi);
free(rawmidi->name);
if (rawmidi->open_func)
@ -448,12 +448,12 @@ int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rawmidi, struct pollfd *pfds, un
*/
int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{
assert(rawmidi && pfds && revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
}
return -EINVAL;
assert(rawmidi && pfds && revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
}
return -EINVAL;
}
/**

View file

@ -335,7 +335,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
*outputp = NULL;
if (!inputp && !outputp)
return -EINVAL;
if ((ret = snd_ctl_hw_open(&ctl, NULL, card, 0)) < 0)
return ret;
if (is_ump)
@ -344,11 +344,11 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
sprintf(filename, SNDRV_FILE_RAWMIDI, card, device);
__again:
if (attempt++ > 3) {
snd_ctl_close(ctl);
return -EBUSY;
}
ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice);
if (attempt++ > 3) {
snd_ctl_close(ctl);
return -EBUSY;
}
ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice);
if (ret < 0) {
snd_ctl_close(ctl);
return ret;
@ -369,7 +369,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
if (mode & SND_RAWMIDI_NONBLOCK) {
fmode |= O_NONBLOCK;
}
if (mode & SND_RAWMIDI_SYNC) {
fmode |= O_SYNC;
}

View file

@ -31,7 +31,7 @@ static const char **snd_rawmidi_open_objects[] = {
&_snd_module_rawmidi_virt
#endif
};
void *snd_rawmidi_open_symbols(void)
{
return snd_rawmidi_open_objects;

View file

@ -52,7 +52,7 @@ typedef struct {
int pending;
} snd_rawmidi_virtual_t;
int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
int streams, int mode, snd_config_t *lconf,
snd_config_t *parent_conf);
#endif

View file

@ -9,7 +9,7 @@
* See \ref seq page for more details.
*/
/*
/*
* Sequencer Interface - main file
*
* This library is free software; you can redistribute it and/or modify
@ -58,12 +58,12 @@ A typical code would be like below:
// create a new client
snd_seq_t *open_client()
{
snd_seq_t *handle;
int err;
err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0);
if (err < 0)
return NULL;
snd_seq_set_client_name(handle, "My Client");
snd_seq_t *handle;
int err;
err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0);
if (err < 0)
return NULL;
snd_seq_set_client_name(handle, "My Client");
return handle;
}
\endcode
@ -138,13 +138,13 @@ Then, a connection from MIDI input port to this program is established.
From this time, events from keyboard are automatically sent to this program.
Timestamps will be updated according to the subscribed queue.
\code
MIDI input port (keyboard)
|
V
ALSA sequencer - update timestamp
|
V
application port
MIDI input port (keyboard)
|
V
ALSA sequencer - update timestamp
|
V
application port
\endcode
There is another subscription type for opposite direction:
@ -155,13 +155,13 @@ to MIDI port for write.
After this connection is established, events will be properly sent
to MIDI output device.
\code
application port
|
V
ALSA sequencer - events are scheduled
|
V
MIDI output port (WaveTable etc.)
application port
|
V
ALSA sequencer - events are scheduled
|
V
MIDI output port (WaveTable etc.)
\endcode
From the viewpoint of subscription, the examples above are special cases.
@ -178,13 +178,13 @@ The connection between ports can be done also by the "third" client.
Thus, filter applications have to manage
only input and output events regardless of receiver/sender addresses.
\code
sequencer port #1
|
V
ALSA sequencer (scheduled or real-time)
|
V
sequencer port #2
sequencer port #1
|
V
ALSA sequencer (scheduled or real-time)
|
V
sequencer port #2
\endcode
For the detail about subscription, see the section \ref seq_subs_more.
@ -315,7 +315,7 @@ contains a combination of client id and port id numbers, defined as
When an event is passed to sequencer from a client, sequencer fills
source.client field
with the sender's id automatically.
It is the responsibility of sender client to
It is the responsibility of sender client to
fill the port id of source.port and
both client and port of dest field.
@ -335,7 +335,7 @@ queue-control event
like start, stop and continue queue, change tempo, etc.
to the system timer port.
Then the sequencer system handles the queue according to the received event.
This port supports subscription. The received timer events are
This port supports subscription. The received timer events are
broadcasted to all subscribed clients.
The latter port does not receive messages but supports subscription.
@ -454,11 +454,11 @@ For example, to set the tempo of the queue <code>q</code> to
\code
void set_tempo(snd_seq_t *handle, int queue)
{
snd_seq_queue_tempo_t *tempo;
snd_seq_queue_tempo_alloca(&tempo);
snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM
snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ
snd_seq_set_queue_tempo(handle, queue, tempo);
snd_seq_queue_tempo_t *tempo;
snd_seq_queue_tempo_alloca(&tempo);
snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM
snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ
snd_seq_set_queue_tempo(handle, queue, tempo);
}
\endcode
@ -629,19 +629,19 @@ The application port must have capability #SND_SEQ_PORT_CAP_WRITE.
\code
void capture_keyboard(snd_seq_t *seq)
{
snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs;
sender.client = 64;
sender.port = 0;
dest.client = 128;
dest.port = 0;
snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_port_subscribe_set_queue(subs, 1);
snd_seq_port_subscribe_set_time_update(subs, 1);
snd_seq_port_subscribe_set_time_real(subs, 1);
snd_seq_subscribe_port(seq, subs);
snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs;
sender.client = 64;
sender.port = 0;
dest.client = 128;
dest.port = 0;
snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_port_subscribe_set_queue(subs, 1);
snd_seq_port_subscribe_set_time_update(subs, 1);
snd_seq_port_subscribe_set_time_real(subs, 1);
snd_seq_subscribe_port(seq, subs);
}
\endcode
@ -652,23 +652,23 @@ The application port must have capability #SND_SEQ_PORT_CAP_READ.
\code
void subscribe_output(snd_seq_t *seq)
{
snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs;
sender.client = 128;
sender.port = 0;
dest.client = 65;
dest.port = 1;
snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_subscribe_port(seq, subs);
snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs;
sender.client = 128;
sender.port = 0;
dest.client = 65;
dest.port = 1;
snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_subscribe_port(seq, subs);
}
\endcode
This example can be simplified by using #snd_seq_connect_to() function.
\code
void subscribe_output(snd_seq_t *seq)
{
snd_seq_connect_to(seq, 0, 65, 1);
snd_seq_connect_to(seq, 0, 65, 1);
}
\endcode
@ -686,16 +686,16 @@ and the receiver
// ..in the third application (130:0) ..
void coupling(snd_seq_t *seq)
{
snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs;
sender.client = 128;
sender.port = 0;
dest.client = 129;
dest.port = 0;
snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_subscribe_port(seq, subs);
snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs;
sender.client = 128;
sender.port = 0;
dest.client = 129;
dest.port = 0;
snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_subscribe_port(seq, subs);
}
\endcode
@ -729,17 +729,17 @@ The program appears like this:
\code
void schedule_event(snd_seq_t *seq)
{
snd_seq_event_t ev;
snd_seq_event_t ev;
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, my_port);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_schedule_tick(&ev, Q, 0, t);
... // set event type, data, so on..
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, my_port);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_schedule_tick(&ev, Q, 0, t);
... // set event type, data, so on..
snd_seq_event_output(seq, &ev);
...
snd_seq_drain_output(seq); // if necessary
snd_seq_event_output(seq, &ev);
...
snd_seq_drain_output(seq); // if necessary
}
\endcode
Of course, you can use realtime stamp, too.
@ -754,16 +754,16 @@ The program can be more simplified as follows:
\code
void direct_delivery(snd_seq_t *seq)
{
snd_seq_event_t ev;
snd_seq_event_t ev;
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, port);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_direct(&ev);
... // set event type, data, so on..
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, port);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_direct(&ev);
... // set event type, data, so on..
snd_seq_event_output(seq, &ev);
snd_seq_drain_output(seq);
snd_seq_event_output(seq, &ev);
snd_seq_drain_output(seq);
}
\endcode
You should flush event soon after output event.
@ -778,15 +778,15 @@ after some modification, will appear as following:
\code
void event_filter(snd_seq_t *seq, snd_seq_event_t *ev)
{
while (snd_seq_event_input(seq, &ev) >= 0) {
//.. modify input event ..
while (snd_seq_event_input(seq, &ev) >= 0) {
//.. modify input event ..
snd_seq_ev_set_source(ev, my_port);
snd_seq_ev_set_subs(ev);
snd_seq_ev_set_direct(ev);
snd_seq_event_output(seq, ev);
snd_seq_drain_output(seq);
}
snd_seq_ev_set_source(ev, my_port);
snd_seq_ev_set_subs(ev);
snd_seq_ev_set_direct(ev);
snd_seq_event_output(seq, ev);
snd_seq_drain_output(seq);
}
}
\endcode
@ -906,7 +906,7 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
const char *id;
const char *lib = NULL, *open_name = NULL;
int (*open_func)(snd_seq_t **, const char *,
snd_config_t *, snd_config_t *,
snd_config_t *, snd_config_t *,
int, int) = NULL;
#ifndef PIC
extern void *snd_seq_open_symbols(void);
@ -1047,7 +1047,7 @@ static int snd_seq_open_noupdate(snd_seq_t **seqp, snd_config_t *root,
* \sa snd_seq_open_lconf(), snd_seq_close(), snd_seq_type(), snd_seq_name(),
* snd_seq_nonblock(), snd_seq_client_id()
*/
int snd_seq_open(snd_seq_t **seqp, const char *name,
int snd_seq_open(snd_seq_t **seqp, const char *name,
int streams, int mode)
{
snd_config_t *top;
@ -1083,7 +1083,7 @@ int snd_seq_open(snd_seq_t **seqp, const char *name,
*
* \sa snd_seq_open()
*/
int snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
int snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
int streams, int mode, snd_config_t *lconf)
{
assert(seqp && name && lconf);
@ -1091,7 +1091,7 @@ int snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
}
#ifndef DOC_HIDDEN
int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name,
int streams, int mode, snd_config_t *lconf,
snd_config_t *parent_conf)
{
@ -1212,12 +1212,12 @@ int snd_seq_poll_descriptors(snd_seq_t *seq, struct pollfd *pfds, unsigned int s
*/
int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{
assert(seq && pfds && revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
}
return -EINVAL;
assert(seq && pfds && revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
}
return -EINVAL;
}
/**
@ -1714,7 +1714,7 @@ const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_i
*
* Remove all event types added with #snd_seq_client_info_event_filter_add and clear
* the event filtering flag of this client_info container.
*
*
* \sa snd_seq_client_info_event_filter_add(),
* snd_seq_client_info_event_filter_del(),
* snd_seq_client_info_event_filter_check(),
@ -1732,8 +1732,8 @@ void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info)
* \brief Add an event type to the event filtering of a client_info container
* \param info client_info container
* \param event_type event type to be added
*
* Set the event filtering flag of this client_info and add the specified event type to the
*
* Set the event filtering flag of this client_info and add the specified event type to the
* filter bitmap of this client_info container.
*
* \sa snd_seq_get_client_info(),
@ -1787,7 +1787,7 @@ int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int even
{
assert(info);
return snd_seq_get_bit(event_type, info->event_filter);
}
}
/**
* \brief Get the number of opened ports of a client_info container
@ -2028,7 +2028,7 @@ void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned
* \param client client id
* \param info the pointer to be stored
* \return 0 on success otherwise a negative error code
*
*
* Obtains the information of the client with a client id specified by
* info argument.
* The obtained information is written on info parameter.
@ -2950,7 +2950,7 @@ void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd
assert(info);
memcpy(&info->sender, addr, sizeof(*addr));
}
/**
* \brief Set destination address of a port_subscribe container
* \param info port_subscribe container
@ -3196,7 +3196,7 @@ int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info)
{
assert(info);
return info->num_subs;
}
}
/**
* \brief Get the address of subscriber of a query_subscribe container
@ -3548,7 +3548,7 @@ int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info)
* \return the queue id (zero or positive) on success otherwise a negative error code
*
* \sa snd_seq_alloc_queue()
*/
*/
int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name)
{
snd_seq_queue_info_t info;
@ -3566,7 +3566,7 @@ int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name)
*
* \sa snd_seq_alloc_named_queue(), snd_seq_create_queue(), snd_seq_free_queue(),
* snd_seq_get_queue_info()
*/
*/
int snd_seq_alloc_queue(snd_seq_t *seq)
{
return snd_seq_alloc_named_queue(seq, NULL);
@ -3647,7 +3647,7 @@ int snd_seq_query_named_queue(snd_seq_t *seq, const char *name)
* \brief Get the queue usage flag to the client
* \param seq sequencer handle
* \param q queue id
* \return 1 = client is allowed to access the queue, 0 = not allowed,
* \return 1 = client is allowed to access the queue, 0 = not allowed,
* otherwise a negative error code
*
* \sa snd_seq_get_queue_info(), snd_seq_set_queue_usage()
@ -4164,7 +4164,7 @@ void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_tim
assert(info);
info->type = (int)type;
}
/**
* \brief Set the timer id of a queue_timer container
* \param info queue_timer container
@ -4544,7 +4544,7 @@ static int snd_seq_event_retrieve_buffer(snd_seq_t *seq, snd_seq_event_t **retp)
* \brief retrieve an event from sequencer
* \param seq sequencer handle
* \param ev event pointer to be stored
* \return
* \return
*
* Obtains an input event from sequencer.
* The event is created via snd_seq_create_event(), and its pointer is stored on
@ -4597,7 +4597,7 @@ static int snd_seq_event_input_feed(snd_seq_t *seq, int timeout)
snd_errornum(SEQUENCER, "poll");
return -errno;
}
if (pfd.revents & POLLIN)
if (pfd.revents & POLLIN)
return snd_seq_event_read_buffer(seq);
return seq->ibuflen;
}

View file

@ -522,7 +522,7 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
assert(0);
return -EINVAL;
}
if (mode & SND_SEQ_NONBLOCK)
fmode |= O_NONBLOCK;

View file

@ -25,7 +25,7 @@ extern const char *_snd_module_seq_hw;
static const char **snd_seq_open_objects[] = {
&_snd_module_seq_hw
};
void *snd_seq_open_symbols(void)
{
return snd_seq_open_objects;

View file

@ -119,7 +119,7 @@ int snd_seq_delete_simple_port(snd_seq_t *seq, int port)
int snd_seq_connect_from(snd_seq_t *seq, int myport, int src_client, int src_port)
{
snd_seq_port_subscribe_t subs;
memset(&subs, 0, sizeof(subs));
subs.sender.client = src_client;
subs.sender.port = src_port;
@ -146,7 +146,7 @@ int snd_seq_connect_from(snd_seq_t *seq, int myport, int src_client, int src_por
int snd_seq_connect_to(snd_seq_t *seq, int myport, int dest_client, int dest_port)
{
snd_seq_port_subscribe_t subs;
memset(&subs, 0, sizeof(subs));
/*subs.sender.client = seq->client;*/
subs.sender.client = snd_seq_client_id(seq);
@ -173,7 +173,7 @@ int snd_seq_connect_to(snd_seq_t *seq, int myport, int dest_client, int dest_por
int snd_seq_disconnect_from(snd_seq_t *seq, int myport, int src_client, int src_port)
{
snd_seq_port_subscribe_t subs;
memset(&subs, 0, sizeof(subs));
subs.sender.client = src_client;
subs.sender.port = src_port;
@ -200,7 +200,7 @@ int snd_seq_disconnect_from(snd_seq_t *seq, int myport, int src_client, int src_
int snd_seq_disconnect_to(snd_seq_t *seq, int myport, int dest_client, int dest_port)
{
snd_seq_port_subscribe_t subs;
memset(&subs, 0, sizeof(subs));
/*subs.sender.client = seq->client;*/
subs.sender.client = snd_seq_client_id(seq);
@ -400,7 +400,7 @@ int snd_seq_sync_output_queue(snd_seq_t *seq)
pfd.fd = seq->poll_fd;
pfd.events = POLLOUT;
err = poll(&pfd, 1, -1);
/* restore the room size */
/* restore the room size */
info.output_room = saved_room;
snd_seq_set_client_pool(seq, &info);
return err;

View file

@ -24,7 +24,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "local.h"
#include <stdio.h>
#include <stdlib.h>
@ -60,7 +60,7 @@ int snd_send_fd(int sock, void *data, size_t len, int fd)
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_iov = &vec;
msghdr.msg_iovlen = 1;
msghdr.msg_iovlen = 1;
msghdr.msg_control = cmsg;
msghdr.msg_controllen = cmsg_len;
msghdr.msg_flags = 0;

View file

@ -248,7 +248,7 @@ int snd_timer_open_lconf(snd_timer_t **timer, const char *name,
int snd_timer_close(snd_timer_t *timer)
{
int err;
assert(timer);
assert(timer);
while (!list_empty(&timer->async_handlers)) {
snd_async_handler_t *h = list_entry(timer->async_handlers.next, snd_async_handler_t, hlist);
snd_async_del_handler(h);
@ -335,7 +335,7 @@ snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler)
return NULL;
}
return handler->u.timer;
}
}
/**
* \brief get count of poll descriptors for timer handle
@ -388,12 +388,12 @@ int snd_timer_poll_descriptors(snd_timer_t *timer, struct pollfd *pfds, unsigned
*/
int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{
assert(timer && pfds && revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
}
return -EINVAL;
assert(timer && pfds && revents);
if (nfds == 1) {
*revents = pfds->revents;
return 0;
}
return -EINVAL;
}
/**
@ -428,8 +428,8 @@ int snd_timer_nonblock(snd_timer_t *timer, int nonblock)
int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid)
{
assert(timer);
if (sig == 0)
sig = SIGIO;
if (sig == 0)
sig = SIGIO;
if (pid == 0)
pid = getpid();
return timer->ops->async(timer, sig, pid);

View file

@ -227,7 +227,7 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int
tmode = O_RDONLY;
if (mode & SND_TIMER_OPEN_NONBLOCK)
tmode |= O_NONBLOCK;
tmode |= O_NONBLOCK;
fd = snd_open_device(SNDRV_FILE_TIMER, tmode);
if (fd < 0)
return -errno;

View file

@ -200,7 +200,7 @@ int snd_timer_query_open_lconf(snd_timer_query_t **timer, const char *name,
int snd_timer_query_close(snd_timer_query_t *timer)
{
int err;
assert(timer);
assert(timer);
err = timer->ops->close(timer);
if (timer->dl_handle)
snd_dlclose(timer->dl_handle);
@ -220,8 +220,8 @@ int snd_timer_query_close(snd_timer_query_t *timer)
*/
int snd_timer_query_next_device(snd_timer_query_t *timer, snd_timer_id_t *tid)
{
assert(timer);
assert(tid);
assert(timer);
assert(tid);
return timer->ops->next_device(timer, tid);
}
@ -261,9 +261,9 @@ int snd_timer_ginfo_malloc(snd_timer_ginfo_t **info)
void snd_timer_ginfo_free(snd_timer_ginfo_t *info)
{
assert(info);
free(info);
free(info);
}
/**
* \brief copy one snd_timer_info_t structure to another
* \param dst destination snd_timer_info_t structure
@ -389,8 +389,8 @@ EXPORT_SYMBOL int INTERNAL(snd_timer_query_info)(snd_timer_query_t *timer, snd_t
int snd_timer_query_info(snd_timer_query_t *timer, snd_timer_ginfo_t *info)
#endif
{
assert(timer);
assert(info);
assert(timer);
assert(info);
return timer->ops->info(timer, info);
}
use_default_symbol_version(__snd_timer_query_info, snd_timer_query_info, ALSA_0.9.0);
@ -407,8 +407,8 @@ EXPORT_SYMBOL int INTERNAL(snd_timer_query_params)(snd_timer_query_t *timer, snd
int snd_timer_query_params(snd_timer_query_t *timer, snd_timer_gparams_t *params)
#endif
{
assert(timer);
assert(params);
assert(timer);
assert(params);
return timer->ops->params(timer, params);
}
use_default_symbol_version(__snd_timer_query_params, snd_timer_query_params, ALSA_0.9.0);
@ -425,8 +425,8 @@ EXPORT_SYMBOL int INTERNAL(snd_timer_query_status)(snd_timer_query_t *timer, snd
int snd_timer_query_status(snd_timer_query_t *timer, snd_timer_gstatus_t *status)
#endif
{
assert(timer);
assert(status);
assert(timer);
assert(status);
return timer->ops->status(timer, status);
}
use_default_symbol_version(__snd_timer_query_status, snd_timer_query_status, ALSA_0.9.0);

View file

@ -92,7 +92,7 @@ int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mo
tmode = O_RDONLY;
if (mode & SND_TIMER_OPEN_NONBLOCK)
tmode |= O_NONBLOCK;
tmode |= O_NONBLOCK;
fd = snd_open_device(SNDRV_FILE_TIMER, tmode);
if (fd < 0)
return -errno;

View file

@ -25,7 +25,7 @@ extern const char *_snd_module_timer_hw;
static const char **snd_timer_open_objects[] = {
&_snd_module_timer_hw
};
void *snd_timer_open_symbols(void)
{
return (void *)snd_timer_open_objects[0];
@ -37,7 +37,7 @@ extern const char *_snd_module_timer_query_hw;
static const char **snd_timer_query_open_objects[] = {
&_snd_module_timer_query_hw
};
void *snd_timer_query_open_symbols(void)
{
return snd_timer_query_open_objects;

View file

@ -13,8 +13,8 @@
GNU Lesser General Public License for more details.
Authors: Mengdong Lin <mengdong.lin@intel.com>
Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com>
Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com>
*/
#include "tplg_local.h"
@ -132,7 +132,7 @@ static int write_elem_block(snd_tplg_t *tplg,
if (sub_pos == pos)
break;
}
/* the last elem of the current sub list as the head of
/* the last elem of the current sub list as the head of
next sub list*/
sub_base = pos;
count = 0;

View file

@ -13,8 +13,8 @@
GNU Lesser General Public License for more details.
Authors: Mengdong Lin <mengdong.lin@intel.com>
Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com>
Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com>
*/
#include "tplg_local.h"

View file

@ -13,8 +13,8 @@
GNU Lesser General Public License for more details.
Authors: Mengdong Lin <mengdong.lin@intel.com>
Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com>
Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com>
*/
#include "tplg_local.h"

View file

@ -13,8 +13,8 @@
GNU Lesser General Public License for more details.
Authors: Mengdong Lin <mengdong.lin@intel.com>
Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com>
Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com>
*/
#include "tplg_local.h"

Some files were not shown because too many files have changed in this diff Show more