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

@ -56,8 +56,8 @@
#define use_symbol_version(real, name, version) /* nothing */ #define use_symbol_version(real, name, version) /* nothing */
#if defined(__alpha__) || defined(__mips__) #if defined(__alpha__) || defined(__mips__)
#define use_default_symbol_version(real, name, version) \ #define use_default_symbol_version(real, name, version) \
__asm__ (".weak " ASM_NAME(#name)); \ __asm__ (".weak " ASM_NAME(#name)); \
__asm__ (ASM_NAME(#name) " = " ASM_NAME(#real)) __asm__ (ASM_NAME(#name) " = " ASM_NAME(#real))
#else #else
#define use_default_symbol_version(real, name, version) \ #define use_default_symbol_version(real, name, version) \
__asm__ (".weak " ASM_NAME(#name)); \ __asm__ (".weak " ASM_NAME(#name)); \

View file

@ -52,15 +52,15 @@ extern "C" {
/** \brief Configuration node type. */ /** \brief Configuration node type. */
typedef enum _snd_config_type { typedef enum _snd_config_type {
/** Integer number. */ /** Integer number. */
SND_CONFIG_TYPE_INTEGER, SND_CONFIG_TYPE_INTEGER,
/** 64-bit integer number. */ /** 64-bit integer number. */
SND_CONFIG_TYPE_INTEGER64, SND_CONFIG_TYPE_INTEGER64,
/** Real number. */ /** Real number. */
SND_CONFIG_TYPE_REAL, SND_CONFIG_TYPE_REAL,
/** Character string. */ /** Character string. */
SND_CONFIG_TYPE_STRING, SND_CONFIG_TYPE_STRING,
/** Pointer (runtime only, cannot be saved). */ /** Pointer (runtime only, cannot be saved). */
SND_CONFIG_TYPE_POINTER, SND_CONFIG_TYPE_POINTER,
/** Compound node. */ /** Compound node. */
SND_CONFIG_TYPE_COMPOUND = 1024 SND_CONFIG_TYPE_COMPOUND = 1024
} snd_config_type_t; } snd_config_type_t;

View file

@ -385,7 +385,7 @@ int snd_config_check_hop(snd_config_t *conf);
#define SND_CONF_MAX_HOPS 64 #define SND_CONF_MAX_HOPS 64
int snd_config_search_alias_hooks(snd_config_t *config, int snd_config_search_alias_hooks(snd_config_t *config,
const char *base, const char *key, const char *base, const char *key,
snd_config_t **result); snd_config_t **result);
int _snd_conf_generic_id(const char *id); int _snd_conf_generic_id(const char *id);

View file

@ -679,15 +679,15 @@ snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str);
int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent); int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);
int snd_pcm_set_params(snd_pcm_t *pcm, int snd_pcm_set_params(snd_pcm_t *pcm,
snd_pcm_format_t format, snd_pcm_format_t format,
snd_pcm_access_t access, snd_pcm_access_t access,
unsigned int channels, unsigned int channels,
unsigned int rate, unsigned int rate,
int soft_resample, int soft_resample,
unsigned int latency); unsigned int latency);
int snd_pcm_get_params(snd_pcm_t *pcm, int snd_pcm_get_params(snd_pcm_t *pcm,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t *period_size); snd_pcm_uframes_t *period_size);
/** \} */ /** \} */
@ -1326,7 +1326,7 @@ int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
/** Simple PCM latency type */ /** Simple PCM latency type */
typedef enum _snd_spcm_latency { typedef enum _snd_spcm_latency {
/** standard latency - for standard playback or capture /** standard latency - for standard playback or capture
(estimated latency in one direction 350ms) */ (estimated latency in one direction 350ms) */
SND_SPCM_LATENCY_STANDARD = 0, SND_SPCM_LATENCY_STANDARD = 0,
/** medium latency - software phones etc. /** medium latency - software phones etc.
(estimated latency in one direction maximally 25ms */ (estimated latency in one direction maximally 25ms */

View file

@ -81,7 +81,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_pcm_t *slave, int close_slave); snd_pcm_t *slave, int close_slave);
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, 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_pcm_stream_t stream, int mode);
/* /*
* Linear conversion plugin * Linear conversion plugin
@ -111,7 +111,7 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
int close_slave); int close_slave);
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, 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_pcm_stream_t stream, int mode);
/* /*
* Linear<->a-Law conversion plugin * Linear<->a-Law conversion plugin
@ -207,8 +207,8 @@ int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *capture_conf, snd_config_t *capture_conf,
snd_pcm_stream_t stream, int mode); snd_pcm_stream_t stream, int mode);
int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, int _snd_pcm_jack_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_pcm_stream_t stream, int mode);
/** \} */ /** \} */

View file

@ -409,7 +409,7 @@ struct snd_pcm_hw_params {
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
struct snd_mask mres[5]; /* reserved masks */ struct snd_mask mres[5]; /* reserved masks */
struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
struct snd_interval ires[9]; /* reserved intervals */ struct snd_interval ires[9]; /* reserved intervals */
unsigned int rmask; /* W: requested masks */ unsigned int rmask; /* W: requested masks */
unsigned int cmask; /* R: changed masks */ unsigned int cmask; /* R: changed masks */

View file

@ -105,7 +105,7 @@ typedef enum _snd_timer_event {
/** timer read structure */ /** timer read structure */
typedef struct _snd_timer_read { typedef struct _snd_timer_read {
unsigned int resolution; /**< tick resolution in nanoseconds */ unsigned int resolution; /**< tick resolution in nanoseconds */
unsigned int ticks; /**< count of happened ticks */ unsigned int ticks; /**< count of happened ticks */
} snd_timer_read_t; } snd_timer_read_t;
/** timer tstamp + event read structure */ /** timer tstamp + event read structure */

View file

@ -239,8 +239,8 @@ int snd_use_case_free_list(const char *list[], int items);
* *
*/ */
int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
const char *identifier, const char *identifier,
const char **list[]); const char **list[]);
/** /**
@ -410,8 +410,8 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* increase latency. * increase latency.
*/ */
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
const char *identifier, const char *identifier,
const char **value); const char **value);
/** /**
* \brief Get current - integer * \brief Get current - integer
@ -456,8 +456,8 @@ int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
* - check transmit sequence firstly * - check transmit sequence firstly
*/ */
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
const char *identifier, const char *identifier,
const char *value); const char *value);
/** /**
* \brief Open and initialise use case core for sound card * \brief Open and initialise use case core for sound card
@ -482,7 +482,7 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
* only one ALSA sound card in this case. * only one ALSA sound card in this case.
*/ */
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr,
const char *card_name); const char *card_name);
/** /**

View file

@ -68,24 +68,24 @@ static PyInterpreterState *main_interpreter;
static inline int get_long(PyObject *o, long *val) static inline int get_long(PyObject *o, long *val)
{ {
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
if (PyInt_Check(o)) { if (PyInt_Check(o)) {
*val = PyInt_AsLong(o); *val = PyInt_AsLong(o);
return 0; return 0;
} }
#endif #endif
if (PyLong_Check(o)) { if (PyLong_Check(o)) {
*val = PyLong_AsLong(o); *val = PyLong_AsLong(o);
return 0; return 0;
} }
return 1; return 1;
} }
static inline PyObject *InternFromString(const char *name) static inline PyObject *InternFromString(const char *name)
{ {
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
return PyString_InternFromString(name); return PyString_InternFromString(name);
#else #else
return PyUnicode_InternFromString(name); return PyUnicode_InternFromString(name);
#endif #endif
} }
@ -191,7 +191,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
} }
static int get_x_range_ops(snd_mixer_elem_t *elem, int dir, static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max, const char *attr) long *min, long *max, const char *attr)
{ {
PyObject *obj1, *t1, *t2, *res; PyObject *obj1, *t1, *t2, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -225,13 +225,13 @@ static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
} }
static int get_range_ops(snd_mixer_elem_t *elem, int dir, static int get_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max) long *min, long *max)
{ {
return get_x_range_ops(elem, dir, min, max, "opsGetRange"); return get_x_range_ops(elem, dir, min, max, "opsGetRange");
} }
static int set_range_ops(snd_mixer_elem_t *elem, int dir, static int set_range_ops(snd_mixer_elem_t *elem, int dir,
long min, long max) long min, long max)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -244,8 +244,8 @@ static int set_range_ops(snd_mixer_elem_t *elem, int dir,
} }
static int get_x_ops(snd_mixer_elem_t *elem, int dir, static int get_x_ops(snd_mixer_elem_t *elem, int dir,
long channel, long *value, long channel, long *value,
const char *attr) const char *attr)
{ {
PyObject *obj1, *t1, *res; PyObject *obj1, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -283,7 +283,7 @@ static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
} }
static int get_switch_ops(snd_mixer_elem_t *elem, int dir, static int get_switch_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, int *value) snd_mixer_selem_channel_id_t channel, int *value)
{ {
long value1; long value1;
int res; int res;
@ -337,21 +337,21 @@ static int ask_dB_vol_ops(snd_mixer_elem_t *elem,
} }
static int get_dB_ops(snd_mixer_elem_t *elem, static int get_dB_ops(snd_mixer_elem_t *elem,
int dir, int dir,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
long *value) long *value)
{ {
return get_x_ops(elem, dir, channel, value, "opsGetDB"); return get_x_ops(elem, dir, channel, value, "opsGetDB");
} }
static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir, static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max) long *min, long *max)
{ {
return get_x_range_ops(elem, dir, min, max, "opsGetDBRange"); return get_x_range_ops(elem, dir, min, max, "opsGetDBRange");
} }
static int set_volume_ops(snd_mixer_elem_t *elem, int dir, static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, long value) snd_mixer_selem_channel_id_t channel, long value)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -364,7 +364,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
} }
static int set_switch_ops(snd_mixer_elem_t *elem, int dir, static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, int value) snd_mixer_selem_channel_id_t channel, int value)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -377,8 +377,8 @@ static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
} }
static int set_dB_ops(snd_mixer_elem_t *elem, int dir, static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
long db_gain, int xdir) long db_gain, int xdir)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -392,8 +392,8 @@ static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
} }
static int enum_item_name_ops(snd_mixer_elem_t *elem, static int enum_item_name_ops(snd_mixer_elem_t *elem,
unsigned int item, unsigned int item,
size_t maxlen, char *buf) size_t maxlen, char *buf)
{ {
PyObject *obj1, *obj2, *t1, *res; PyObject *obj1, *obj2, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -441,8 +441,8 @@ errlbl:
} }
static int get_enum_item_ops(snd_mixer_elem_t *elem, static int get_enum_item_ops(snd_mixer_elem_t *elem,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
unsigned int *itemp) unsigned int *itemp)
{ {
PyObject *obj1, *t1, *res; PyObject *obj1, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -473,8 +473,8 @@ static int get_enum_item_ops(snd_mixer_elem_t *elem,
} }
static int set_enum_item_ops(snd_mixer_elem_t *elem, static int set_enum_item_ops(snd_mixer_elem_t *elem,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
unsigned int item) unsigned int item)
{ {
PyObject *obj1; PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem); struct pymelem *pymelem = melem_to_pymelem(elem);
@ -486,21 +486,21 @@ static int set_enum_item_ops(snd_mixer_elem_t *elem,
} }
static struct sm_elem_ops simple_python_ops = { static struct sm_elem_ops simple_python_ops = {
.is = is_ops, .is = is_ops,
.get_range = get_range_ops, .get_range = get_range_ops,
.get_dB_range = get_dB_range_ops, .get_dB_range = get_dB_range_ops,
.set_range = set_range_ops, .set_range = set_range_ops,
.ask_vol_dB = ask_vol_dB_ops, .ask_vol_dB = ask_vol_dB_ops,
.ask_dB_vol = ask_dB_vol_ops, .ask_dB_vol = ask_dB_vol_ops,
.get_volume = get_volume_ops, .get_volume = get_volume_ops,
.get_dB = get_dB_ops, .get_dB = get_dB_ops,
.set_volume = set_volume_ops, .set_volume = set_volume_ops,
.set_dB = set_dB_ops, .set_dB = set_dB_ops,
.get_switch = get_switch_ops, .get_switch = get_switch_ops,
.set_switch = set_switch_ops, .set_switch = set_switch_ops,
.enum_item_name = enum_item_name_ops, .enum_item_name = enum_item_name_ops,
.get_enum_item = get_enum_item_ops, .get_enum_item = get_enum_item_ops,
.set_enum_item = set_enum_item_ops .set_enum_item = set_enum_item_ops
}; };
static void selem_free(snd_mixer_elem_t *elem) static void selem_free(snd_mixer_elem_t *elem)
@ -703,18 +703,18 @@ static PyMethodDef pymelem_methods[] = {
}; };
static PyTypeObject pymelem_type = { static PyTypeObject pymelem_type = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
tp_name: "smixer_python.InternalMElement", tp_name: "smixer_python.InternalMElement",
tp_basicsize: sizeof(struct pymelem), tp_basicsize: sizeof(struct pymelem),
tp_dealloc: (destructor)pymelem_dealloc, tp_dealloc: (destructor)pymelem_dealloc,
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
tp_doc: NULL /* mixerinit__doc__ */, tp_doc: NULL /* mixerinit__doc__ */,
tp_getset: pymelem_getseters, tp_getset: pymelem_getseters,
tp_init: (initproc)pymelem_init, tp_init: (initproc)pymelem_init,
tp_alloc: PyType_GenericAlloc, tp_alloc: PyType_GenericAlloc,
tp_new: PyType_GenericNew, tp_new: PyType_GenericNew,
tp_free: PyObject_Del, tp_free: PyObject_Del,
tp_methods: pymelem_methods, tp_methods: pymelem_methods,
}; };
static PyObject * static PyObject *
@ -884,18 +884,18 @@ static PyMethodDef pymixer_methods[] = {
}; };
static PyTypeObject pymixer_type = { static PyTypeObject pymixer_type = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
tp_name: "smixer_python.InternalMixer", tp_name: "smixer_python.InternalMixer",
tp_basicsize: sizeof(struct pymixer), tp_basicsize: sizeof(struct pymixer),
tp_dealloc: (destructor)pymixer_dealloc, tp_dealloc: (destructor)pymixer_dealloc,
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
tp_doc: NULL /* mixerinit__doc__ */, tp_doc: NULL /* mixerinit__doc__ */,
tp_getset: pymixer_getseters, tp_getset: pymixer_getseters,
tp_init: (initproc)pymixer_init, tp_init: (initproc)pymixer_init,
tp_alloc: PyType_GenericAlloc, tp_alloc: PyType_GenericAlloc,
tp_new: PyType_GenericNew, tp_new: PyType_GenericNew,
tp_free: PyObject_Del, tp_free: PyObject_Del,
tp_methods: pymixer_methods, tp_methods: pymixer_methods,
}; };
static PyMethodDef python_methods[] = { static PyMethodDef python_methods[] = {
@ -985,19 +985,19 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
tstate = PyThreadState_New(main_interpreter); tstate = PyThreadState_New(main_interpreter);
PyThreadState_Swap(tstate); PyThreadState_Swap(tstate);
t = PyTuple_New(3); t = PyTuple_New(3);
if (t) { if (t) {
PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask)); PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask));
o = find_helem(priv, helem); o = find_helem(priv, helem);
if (mask & SND_CTL_EVENT_MASK_ADD) { if (mask & SND_CTL_EVENT_MASK_ADD) {
if (o == NULL) if (o == NULL)
o = new_helem(priv, helem); o = new_helem(priv, helem);
} }
if (o == NULL) if (o == NULL)
return 0; return 0;
PyTuple_SET_ITEM(t, 1, o); PyTuple_SET_ITEM(t, 1, o);
Py_INCREF(o); Py_INCREF(o);
o = melem ? find_melem(priv, melem) : Py_None; o = melem ? find_melem(priv, melem) : Py_None;
PyTuple_SET_ITEM(t, 2, o); PyTuple_SET_ITEM(t, 2, o);
Py_INCREF(o); Py_INCREF(o);
r = PyObject_CallObject(priv->py_event_func, t); r = PyObject_CallObject(priv->py_event_func, t);
@ -1039,8 +1039,8 @@ static void alsa_mixer_simple_free(snd_mixer_class_t *class)
} }
static int alsa_mixer_simple_pyinit(struct python_priv *priv, static int alsa_mixer_simple_pyinit(struct python_priv *priv,
PyObject *py_mod, PyObject *py_mod,
FILE *fp, FILE *fp,
const char *file, const char *file,
snd_mixer_class_t *class, snd_mixer_class_t *class,
snd_mixer_t *mixer, snd_mixer_t *mixer,
@ -1091,15 +1091,15 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3
static struct PyModuleDef smixer_python_module = { static struct PyModuleDef smixer_python_module = {
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"smixer_python", "smixer_python",
NULL, NULL,
0, 0,
python_methods, python_methods,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL NULL
}; };
#endif #endif

View file

@ -62,10 +62,10 @@ static long to_user(struct selem_base *s, int dir, struct helem_base *c, long va
static long from_user(struct selem_base *s, int dir, struct helem_base *c, long value) static long from_user(struct selem_base *s, int dir, struct helem_base *c, long value)
{ {
int64_t n; int64_t n;
if (s->dir[dir].max == s->dir[dir].min) if (s->dir[dir].max == s->dir[dir].min)
return c->min; return c->min;
n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min); n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min);
return c->min + (n + (s->dir[dir].max - s->dir[dir].min) / 2) / (s->dir[dir].max - s->dir[dir].min); return c->min + (n + (s->dir[dir].max - s->dir[dir].min) / 2) / (s->dir[dir].max - s->dir[dir].min);
} }
#endif #endif
@ -374,7 +374,7 @@ static int simple_event_add1(snd_mixer_class_t *class,
case PURPOSE_SWITCH: case PURPOSE_SWITCH:
if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) { if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) {
__invalid_type: __invalid_type:
snd_mixer_selem_id_free(id); snd_mixer_selem_id_free(id);
free(hsimple); free(hsimple);
return -EINVAL; return -EINVAL;
} }
@ -446,9 +446,9 @@ static int simple_event_add1(snd_mixer_class_t *class,
err = snd_mixer_elem_value(melem); err = snd_mixer_elem_value(melem);
return err; return err;
__error: __error:
if (new) if (new)
snd_mixer_elem_free(melem); snd_mixer_elem_free(melem);
return -EINVAL; return -EINVAL;
} }
static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem) static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)

View file

@ -97,8 +97,8 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
return 1; return 1;
__error: __error:
if (initflag) if (initflag)
free(priv); free(priv);
if (h) if (h)
snd_dlclose(h); snd_dlclose(h);
free(xlib); free(xlib);

View file

@ -255,8 +255,8 @@ name [=] value [,|;]
# Compound assignment (first style) # Compound assignment (first style)
name [=] { name [=] {
name1 [=] value [,|;] name1 [=] value [,|;]
... ...
} }
# Compound assignment (second style) # Compound assignment (second style)
@ -264,9 +264,9 @@ name.name1 [=] value [,|;]
# Array assignment (first style) # Array assignment (first style)
name [ name [
value0 [,|;] value0 [,|;]
value1 [,|;] value1 [,|;]
... ...
] ]
# Array assignment (second style) # Array assignment (second style)
@ -1341,7 +1341,7 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
err = 0; err = 0;
__end: __end:
free(id); free(id);
return err; return err;
} }
static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int override) static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int override)
@ -4608,12 +4608,12 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
return err; return err;
_reread: _reread:
*_top = NULL; *_top = NULL;
*_update = NULL; *_update = NULL;
if (update) { if (update) {
snd_config_update_free(update); snd_config_update_free(update);
update = NULL; update = NULL;
} }
if (top) { if (top) {
snd_config_delete(top); snd_config_delete(top);
top = NULL; top = NULL;
@ -5221,7 +5221,7 @@ static int _snd_config_evaluate(snd_config_t *src,
* replaces those nodes with the respective function results. * replaces those nodes with the respective function results.
*/ */
int snd_config_evaluate(snd_config_t *config, snd_config_t *root, 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 */ /* FIXME: Only in place evaluation is currently implemented */
assert(result == NULL); assert(result == NULL);
@ -5725,7 +5725,7 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args
*result = res; *result = res;
err = 1; err = 1;
_end: _end:
if (subs) if (subs)
snd_config_delete(subs); snd_config_delete(subs);
return err; return err;
} }

View file

@ -558,7 +558,7 @@ static int snd_func_iops(snd_config_t **dst,
\endcode \endcode
*/ */
int snd_func_iadd(snd_config_t **dst, snd_config_t *root, 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); return snd_func_iops(dst, root, src, private_data, 0);
} }
@ -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, err = snd_config_imake_string(dst, id,
snd_ctl_card_info_get_id(&info)); snd_ctl_card_info_get_id(&info));
__error: __error:
if (ctl) if (ctl)
snd_ctl_close(ctl); snd_ctl_close(ctl);
return err; return err;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
@ -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, err = snd_config_imake_safe_string(dst, id,
snd_ctl_card_info_get_name(&info)); snd_ctl_card_info_get_name(&info));
__error: __error:
if (ctl) if (ctl)
snd_ctl_close(ctl); snd_ctl_close(ctl);
return err; return err;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
@ -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, err = snd_config_imake_string(dst, id,
snd_pcm_info_get_id(&info)); snd_pcm_info_get_id(&info));
__error: __error:
if (ctl) if (ctl)
snd_ctl_close(ctl); snd_ctl_close(ctl);
return err; return err;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN
@ -1217,14 +1217,14 @@ int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_confi
index == idx++) index == idx++)
goto __out; goto __out;
} }
snd_ctl_close(ctl); snd_ctl_close(ctl);
ctl = NULL; ctl = NULL;
} }
err = -ENODEV; err = -ENODEV;
__out: __out:
if (ctl) if (ctl)
snd_ctl_close(ctl); snd_ctl_close(ctl);
if (err < 0) if (err < 0)
return err; return err;
if((err = snd_config_get_id(src, &id)) >= 0) { if((err = snd_config_get_id(src, &id)) >= 0) {

View file

@ -52,7 +52,7 @@ file. The format is:
\verbatim \verbatim
index [ID ] Driver - name index [ID ] Driver - name
longname longname
\endverbatim \endverbatim
Note that the mixername and components are not listed. Note that the mixername and components are not listed.
@ -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); return ctl->ops->poll_revents(ctl, pfds, nfds, revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; 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, static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag,
const snd_ctl_elem_id_t *id, 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; snd_ctl_elem_info_t *info = NULL;
int err; 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 = ctl->ops->element_tlv(ctl, op_flag, id->numid, tlv, tlv_size);
__err: __err:
if (info) if (info)
free(info); free(info);
return err; return err;
} }

View file

@ -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); return ext->callback->poll_revents(ext, pfds, nfds, revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
} }

View file

@ -232,7 +232,7 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
switch (op_flag) { switch (op_flag) {
case -1: inum = SNDRV_CTL_IOCTL_TLV_COMMAND; break; 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; case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break;
default: return -EINVAL; default: return -EINVAL;
} }

View file

@ -261,7 +261,7 @@ static int try_config(snd_config_t *config,
snd_config_get_string(cfg, &str) >= 0 && snd_config_get_string(cfg, &str) >= 0 &&
((strncmp(base, str, strlen(base)) == 0 && ((strncmp(base, str, strlen(base)) == 0 &&
str[strlen(base)] == '.') || strchr(str, '.') == NULL)) str[strlen(base)] == '.') || strchr(str, '.') == NULL))
goto __skip_add; goto __skip_add;
if (list->card >= 0 && list->device >= 0) 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); sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device);
else if (list->card >= 0) else if (list->card >= 0)
@ -294,7 +294,7 @@ static int try_config(snd_config_t *config,
cfg1 = res; cfg1 = res;
level = 0; level = 0;
__hint: __hint:
level++; level++;
if (snd_config_search(cfg1, "type", &cfg) >= 0 && if (snd_config_search(cfg1, "type", &cfg) >= 0 &&
snd_config_get_string(cfg, &str) >= 0 && snd_config_get_string(cfg, &str) >= 0 &&
strcmp(str, "hw") == 0) { strcmp(str, "hw") == 0) {
@ -363,7 +363,7 @@ static int try_config(snd_config_t *config,
goto __skip_add; goto __skip_add;
if (snd_config_search(cfg1, "slave", &cfg) >= 0 && if (snd_config_search(cfg1, "slave", &cfg) >= 0 &&
snd_config_search(cfg, base, &cfg1) >= 0) snd_config_search(cfg, base, &cfg1) >= 0)
goto __hint; goto __hint;
snd_config_delete(res); snd_config_delete(res);
res = NULL; res = NULL;
cleanup_res = 0; cleanup_res = 0;
@ -395,38 +395,38 @@ static int try_config(snd_config_t *config,
__ok: __ok:
err = 0; err = 0;
__cleanup: __cleanup:
if (err >= 0) { if (err >= 0) {
list->device = dev; list->device = dev;
str = list->card >= 0 ? get_dev_name(list) : NULL; str = list->card >= 0 ? get_dev_name(list) : NULL;
if (str != NULL) { if (str != NULL) {
level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str); level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str);
buf2 = realloc((char *)str, level + 1); buf2 = realloc((char *)str, level + 1);
if (buf2 != NULL) { if (buf2 != NULL) {
if (buf1 != NULL) { if (buf1 != NULL) {
str = strchr(buf2, '|'); str = strchr(buf2, '|');
if (str != NULL) if (str != NULL)
memmove(buf2 + (level - strlen(str)), str, strlen(str)); memmove(buf2 + (level - strlen(str)), str, strlen(str));
else else
str = buf2 + strlen(buf2); str = buf2 + strlen(buf2);
*(char *)str++ = '\n'; *(char *)str++ = '\n';
memcpy((char *)str, buf1, strlen(buf1)); memcpy((char *)str, buf1, strlen(buf1));
buf2[level] = '\0'; buf2[level] = '\0';
free(buf1); free(buf1);
} }
buf1 = buf2; buf1 = buf2;
} else { } else {
free((char *)str); free((char *)str);
} }
} else if (list->device >= 0) } else if (list->device >= 0)
goto __skip_add; goto __skip_add;
err = hint_list_add(list, buf, buf1); err = hint_list_add(list, buf, buf1);
} }
__skip_add: __skip_add:
if (res && cleanup_res) if (res && cleanup_res)
snd_config_delete(res); snd_config_delete(res);
if (buf1) if (buf1)
free(buf1); free(buf1);
free(buf); free(buf);
return err; return err;
} }
@ -510,7 +510,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l
} }
err = 0; err = 0;
__error: __error:
snd_ctl_close(list->ctl); snd_ctl_close(list->ctl);
return err; return err;
} }
@ -665,9 +665,9 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
if (!err && !list.list) if (!err && !list.list)
err = hint_list_add(&list, NULL, NULL); err = hint_list_add(&list, NULL, NULL);
if (err < 0) if (err < 0)
snd_device_name_free_hint((void **)list.list); snd_device_name_free_hint((void **)list.list);
else else
*hints = (void **)list.list; *hints = (void **)list.list;
free(list.cardname); free(list.cardname);
if (local_config_rw) if (local_config_rw)
snd_config_delete(local_config_rw); snd_config_delete(local_config_rw);

View file

@ -571,7 +571,7 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
list_add_tail(&elem->list, &h->elems); list_add_tail(&elem->list, &h->elems);
_err: _err:
if (err < 0 && elem) { if (err < 0 && elem) {
if (elem->id) if (elem->id)
snd_ctl_elem_id_free(elem->id); snd_ctl_elem_id_free(elem->id);
if (elem->info) if (elem->info)

View file

@ -332,8 +332,8 @@ snd_dlobj_cache_get0(const char *lib, const char *name,
errbuf[0] = '\0'; errbuf[0] = '\0';
dlobj = INTERNAL(snd_dlopen)(lib, RTLD_NOW, dlobj = INTERNAL(snd_dlopen)(lib, RTLD_NOW,
verbose ? errbuf : 0, verbose ? errbuf : 0,
verbose ? sizeof(errbuf) : 0); verbose ? sizeof(errbuf) : 0);
if (dlobj == NULL) { if (dlobj == NULL) {
if (verbose) if (verbose)
snd_error(CORE, "Cannot open shared library %s (%s)", 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 snd_hwdep_close(snd_hwdep_t *hwdep)
{ {
int err; int err;
assert(hwdep); assert(hwdep);
err = hwdep->ops->close(hwdep); err = hwdep->ops->close(hwdep);
if (hwdep->dl_handle) if (hwdep->dl_handle)
snd_dlclose(hwdep->dl_handle); snd_dlclose(hwdep->dl_handle);
@ -296,12 +296,12 @@ 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) int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{ {
assert(hwdep && pfds && revents); assert(hwdep && pfds && revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
} }
/** /**

View file

@ -752,7 +752,7 @@ int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds,
{ {
unsigned int idx; unsigned int idx;
unsigned short res; unsigned short res;
assert(mixer && pfds && revents); assert(mixer && pfds && revents);
if (nfds == 0) if (nfds == 0)
return -EINVAL; return -EINVAL;
res = 0; res = 0;

View file

@ -350,7 +350,7 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
__error: __error:
if (top) if (top)
snd_config_delete(top); snd_config_delete(top);
if (class) if (class)
snd_mixer_class_free(class); snd_mixer_class_free(class);
return err; return err;
} }

View file

@ -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, static int get_dB_ops(snd_mixer_elem_t *elem,
int dir, int dir,
snd_mixer_selem_channel_id_t channel, snd_mixer_selem_channel_id_t channel,
long *value) long *value)
{ {
selem_none_t *s = snd_mixer_elem_get_private(elem); selem_none_t *s = snd_mixer_elem_get_private(elem);
selem_ctl_t *c; 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, 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_none_t *s = snd_mixer_elem_get_private(elem);
selem_ctl_t *c; 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) if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED)
type = CTL_GLOBAL_ENUM; type = CTL_GLOBAL_ENUM;
else if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN && else if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN &&
ctype != SND_CTL_ELEM_TYPE_INTEGER) ctype != SND_CTL_ELEM_TYPE_INTEGER)
return 0; return 0;
break; break;
case CTL_GLOBAL_ROUTE: case CTL_GLOBAL_ROUTE:

View file

@ -316,23 +316,23 @@ typedef int LADSPA_PortRangeHintDescriptor;
#define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK) #define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK)
#define LADSPA_IS_HINT_DEFAULT_MINIMUM(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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #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) \ #define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
== LADSPA_HINT_DEFAULT_440) == LADSPA_HINT_DEFAULT_440)
typedef struct _LADSPA_PortRangeHint { typedef struct _LADSPA_PortRangeHint {
@ -435,7 +435,7 @@ typedef struct _LADSPA_Descriptor {
Note that instance initialisation should generally occur in Note that instance initialisation should generally occur in
activate() rather than here. */ activate() rather than here. */
LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor, 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 /* This member is a function pointer that connects a port on an
instantiated plugin to a memory location at which a block of data 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 However, overlapped buffers or use of a single buffer for both
audio and control data may result in unexpected behaviour. */ audio and control data may result in unexpected behaviour. */
void (*connect_port)(LADSPA_Handle Instance, void (*connect_port)(LADSPA_Handle Instance,
unsigned long Port, unsigned long Port,
LADSPA_Data * DataLocation); LADSPA_Data * DataLocation);
/* This member is a function pointer that initialises a plugin /* This member is a function pointer that initialises a plugin
instance and activates it for use. This is separated from 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 then there are various things that the plugin should not do
within the run() or run_adding() functions (see above). */ within the run() or run_adding() functions (see above). */
void (*run)(LADSPA_Handle Instance, void (*run)(LADSPA_Handle Instance,
unsigned long SampleCount); unsigned long SampleCount);
/* This method is a function pointer that runs an instance of a /* This method is a function pointer that runs an instance of a
plugin for a block. This has identical behaviour to run() except 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, this function pointer must be set to NULL. When it is provided,
the function set_run_adding_gain() must be provided also. */ the function set_run_adding_gain() must be provided also. */
void (*run_adding)(LADSPA_Handle Instance, void (*run_adding)(LADSPA_Handle Instance,
unsigned long SampleCount); unsigned long SampleCount);
/* This method is a function pointer that sets the output gain for /* This method is a function pointer that sets the output gain for
use when run_adding() is called (see above). If this function is 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 run_adding() function is provided. When it is absent this
function pointer must be set to NULL. */ function pointer must be set to NULL. */
void (*set_run_adding_gain)(LADSPA_Handle Instance, 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 /* This is the counterpart to activate() (see above). If there is
nothing for deactivate() to do then the plugin writer may provide nothing for deactivate() to do then the plugin writer may provide

View file

@ -32,36 +32,36 @@
MASK_INLINE unsigned int ld2(uint32_t v) MASK_INLINE unsigned int ld2(uint32_t v)
{ {
unsigned r = 0; unsigned r = 0;
if (v >= 0x10000) { if (v >= 0x10000) {
v >>= 16; v >>= 16;
r += 16; r += 16;
} }
if (v >= 0x100) { if (v >= 0x100) {
v >>= 8; v >>= 8;
r += 8; r += 8;
} }
if (v >= 0x10) { if (v >= 0x10) {
v >>= 4; v >>= 4;
r += 4; r += 4;
} }
if (v >= 4) { if (v >= 4) {
v >>= 2; v >>= 2;
r += 2; r += 2;
} }
if (v >= 2) if (v >= 2)
r++; r++;
return r; return r;
} }
MASK_INLINE unsigned int hweight32(uint32_t v) MASK_INLINE unsigned int hweight32(uint32_t v)
{ {
v = (v & 0x55555555) + ((v >> 1) & 0x55555555); v = (v & 0x55555555) + ((v >> 1) & 0x55555555);
v = (v & 0x33333333) + ((v >> 2) & 0x33333333); v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F); v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F);
v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF); v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF);
return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF); return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF);
} }
MASK_INLINE size_t snd_mask_sizeof(void) MASK_INLINE size_t snd_mask_sizeof(void)

View file

@ -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"); snd_check(PCM, "PCM not set up");
return -EIO; 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, " 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, " format : %s\n", snd_pcm_format_name(pcm->format));
snd_output_printf(out, " subformat : %s\n", snd_pcm_subformat_name(pcm->subformat)); snd_output_printf(out, " subformat : %s\n", snd_pcm_subformat_name(pcm->subformat));
@ -2995,9 +2995,9 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
__snd_pcm_lock(pcm->fast_op_arg); __snd_pcm_lock(pcm->fast_op_arg);
if (err_poll < 0) { if (err_poll < 0) {
if (errno == EINTR && !PCMINABORT(pcm) && !(pcm->mode & SND_PCM_EINTR)) if (errno == EINTR && !PCMINABORT(pcm) && !(pcm->mode & SND_PCM_EINTR))
continue; continue;
return -errno; return -errno;
} }
if (! err_poll) if (! err_poll)
break; break;
err = __snd_pcm_poll_revents(pcm, pfd, npfds, &revents); 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); dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
width = snd_pcm_format_physical_width(format); width = snd_pcm_format_physical_width(format);
silence = snd_pcm_format_silence_64(format); silence = snd_pcm_format_silence_64(format);
/* /*
* Iterate copying silent sample for sample data aligned to 64 bit. * Iterate copying silent sample for sample data aligned to 64 bit.
* This is a fast path. * This is a fast path.
*/ */
if (dst_area->step == (unsigned int) width && if (dst_area->step == (unsigned int) width &&
width != 24 && width != 24 &&
((intptr_t)dst & 7) == 0) { ((intptr_t)dst & 7) == 0) {
unsigned int dwords = samples * width / 64; unsigned int dwords = samples * width / 64;
uint64_t *dstp = (uint64_t *)dst; uint64_t *dstp = (uint64_t *)dst;
samples -= dwords * 64 / width; samples -= dwords * 64 / width;
@ -6354,10 +6354,10 @@ int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_u
return err; return err;
// compute frame bits // compute frame bits
fb = snd_pcm_format_physical_width((snd_pcm_format_t)format) * channels; fb = snd_pcm_format_physical_width((snd_pcm_format_t)format) * channels;
min_align = 1; min_align = 1;
while (fb % 8) { while (fb % 8) {
fb *= 2; fb *= 2;
min_align *= 2; min_align *= 2;
} }
if (val) if (val)
*val = min_align; *val = min_align;
@ -7938,8 +7938,8 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
pcm_conf = NULL; pcm_conf = NULL;
err = 0; err = 0;
_err: _err:
if (pcm_conf) if (pcm_conf)
snd_config_delete(pcm_conf); snd_config_delete(pcm_conf);
if (to_free) if (to_free)
snd_config_delete(conf); snd_config_delete(conf);
return err; return err;
@ -8017,7 +8017,7 @@ static void snd_pcm_unlink_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr,
return; return;
__found: __found:
pcm_rbptr->master = NULL; pcm_rbptr->master = NULL;
pcm_rbptr->ptr = NULL; pcm_rbptr->ptr = NULL;
pcm_rbptr->fd = -1; pcm_rbptr->fd = -1;
pcm_rbptr->offset = 0UL; pcm_rbptr->offset = 0UL;
@ -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) int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
{ {
if (err > 0) if (err > 0)
err = -err; err = -err;
if (err == -EINTR) /* nothing to do, continue */ if (err == -EINTR) /* nothing to do, continue */
return 0; return 0;
if (err == -EPIPE) { if (err == -EPIPE) {
const char *s; const char *s;
if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK) if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK)
s = "underrun"; s = "underrun";
else else
s = "overrun"; s = "overrun";
if (!silent) if (!silent)
snd_error(PCM, "%s occurred", s); snd_error(PCM, "%s occurred", s);
err = snd_pcm_prepare(pcm); err = snd_pcm_prepare(pcm);
if (err < 0) { if (err < 0) {
snd_error(PCM, "cannot recovery from %s, prepare failed: %s", s, snd_strerror(err)); snd_error(PCM, "cannot recovery from %s, prepare failed: %s", s, snd_strerror(err));
return err; return err;
} }
return 0; return 0;
} }
if (err == -ESTRPIPE) { if (err == -ESTRPIPE) {
while ((err = snd_pcm_resume(pcm)) == -EAGAIN) while ((err = snd_pcm_resume(pcm)) == -EAGAIN)
/* wait until suspend flag is released */ /* wait until suspend flag is released */
poll(NULL, 0, 1000); poll(NULL, 0, 1000);
if (err < 0) { if (err < 0) {
err = snd_pcm_prepare(pcm); err = snd_pcm_prepare(pcm);
if (err < 0) { if (err < 0) {
snd_error(PCM, "cannot recovery from suspend, prepare failed: %s", snd_strerror(err)); snd_error(PCM, "cannot recovery from suspend, prepare failed: %s", snd_strerror(err));
return err; return err;
} }
} }
return 0; return 0;
} }
return err; 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 * \return 0 on success otherwise a negative error code
*/ */
int snd_pcm_set_params(snd_pcm_t *pcm, int snd_pcm_set_params(snd_pcm_t *pcm,
snd_pcm_format_t format, snd_pcm_format_t format,
snd_pcm_access_t access, snd_pcm_access_t access,
unsigned int channels, unsigned int channels,
unsigned int rate, unsigned int rate,
int soft_resample, int soft_resample,
unsigned int latency) unsigned int latency)
{ {
snd_pcm_hw_params_t params_saved, params = {0}; snd_pcm_hw_params_t params_saved, params = {0};
snd_pcm_sw_params_t swparams = {0}; snd_pcm_sw_params_t swparams = {0};
@ -8841,7 +8841,7 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
s); s);
return err; return err;
} }
/* set software resampling */ /* set software resampling */
err = snd_pcm_hw_params_set_rate_resample(pcm, &params, soft_resample); err = snd_pcm_hw_params_set_rate_resample(pcm, &params, soft_resample);
if (err < 0) { 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 * \return 0 on success otherwise a negative error code
*/ */
int snd_pcm_get_params(snd_pcm_t *pcm, int snd_pcm_get_params(snd_pcm_t *pcm,
snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *buffer_size,
snd_pcm_uframes_t *period_size) snd_pcm_uframes_t *period_size)
{ {
snd_pcm_hw_params_t params = {0}; snd_pcm_hw_params_t params = {0};
int err; int err;
@ -9037,7 +9037,7 @@ int snd_pcm_get_params(snd_pcm_t *pcm,
assert(pcm); assert(pcm);
err = snd_pcm_hw_params_current(pcm, &params); err = snd_pcm_hw_params_current(pcm, &params);
if (err < 0) if (err < 0)
return err; return err;
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(&params, buffer_size); err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(&params, buffer_size);
if (err < 0) if (err < 0)
return err; return err;

View file

@ -596,15 +596,15 @@ format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
type adpcm # Ima-ADPCM conversion PCM type adpcm # Ima-ADPCM conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode
@ -663,7 +663,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
return err; return err;
if (snd_pcm_format_linear(sformat) != 1 && if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_IMA_ADPCM) { sformat != SND_PCM_FORMAT_IMA_ADPCM) {
snd_config_delete(sconf); snd_config_delete(sconf);
snd_error(PCM, "invalid slave format"); snd_error(PCM, "invalid slave format");
return -EINVAL; return -EINVAL;
} }

View file

@ -471,15 +471,15 @@ format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
type alaw # A-Law conversion PCM type alaw # A-Law conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode
@ -538,7 +538,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
return err; return err;
if (snd_pcm_format_linear(sformat) != 1 && if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_A_LAW) { sformat != SND_PCM_FORMAT_A_LAW) {
snd_config_delete(sconf); snd_config_delete(sconf);
snd_error(PCM, "invalid slave format"); snd_error(PCM, "invalid slave format");
return -EINVAL; return -EINVAL;
} }

View file

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

View file

@ -120,7 +120,7 @@ retryget:
if ((tmpid = shmget(dmix->ipc_key, 0, dmix->ipc_perm)) != -1) if ((tmpid = shmget(dmix->ipc_key, 0, dmix->ipc_perm)) != -1)
if (!shmctl(tmpid, IPC_STAT, &buf)) if (!shmctl(tmpid, IPC_STAT, &buf))
if (!buf.shm_nattch) if (!buf.shm_nattch)
/* no users so destroy the segment */ /* no users so destroy the segment */
if (!shmctl(tmpid, IPC_RMID, NULL)) if (!shmctl(tmpid, IPC_RMID, NULL))
goto retryget; goto retryget;
return err; return err;
@ -309,7 +309,7 @@ static int _snd_send_fd(int sock, void *data, size_t len, int fd)
msghdr.msg_name = NULL; msghdr.msg_name = NULL;
msghdr.msg_namelen = 0; msghdr.msg_namelen = 0;
msghdr.msg_iov = &vec; msghdr.msg_iov = &vec;
msghdr.msg_iovlen = 1; msghdr.msg_iovlen = 1;
msghdr.msg_control = cmsg; msghdr.msg_control = cmsg;
msghdr.msg_controllen = cmsg_len; msghdr.msg_controllen = cmsg_len;
msghdr.msg_flags = 0; msghdr.msg_flags = 0;
@ -1057,7 +1057,7 @@ 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) 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) int snd_pcm_direct_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
@ -1202,10 +1202,10 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
int loops = 10; int loops = 10;
__again: __again:
if (loops-- <= 0) { if (loops-- <= 0) {
snd_error(PCM, "unable to find a valid configuration for slave"); snd_error(PCM, "unable to find a valid configuration for slave");
return -EINVAL; return -EINVAL;
} }
ret = snd_pcm_hw_params_any(spcm, &hw_params); ret = snd_pcm_hw_params_any(spcm, &hw_params);
if (ret < 0) { if (ret < 0) {
snd_error(PCM, "snd_pcm_hw_params_any failed"); snd_error(PCM, "snd_pcm_hw_params_any failed");

View file

@ -82,7 +82,7 @@ retryshm:
if (errno == EINVAL) if (errno == EINVAL)
if ((tmpid = shmget(dmix->ipc_key + 1, 0, dmix->ipc_perm)) != -1) if ((tmpid = shmget(dmix->ipc_key + 1, 0, dmix->ipc_perm)) != -1)
if (!shmctl(tmpid, IPC_STAT, &buf)) if (!shmctl(tmpid, IPC_STAT, &buf))
if (!buf.shm_nattch) if (!buf.shm_nattch)
/* no users so destroy the segment */ /* no users so destroy the segment */
if (!shmctl(tmpid, IPC_RMID, NULL)) if (!shmctl(tmpid, IPC_RMID, NULL))
goto retryshm; goto retryshm;
@ -784,11 +784,11 @@ static int snd_pcm_dmix_close(snd_pcm_t *pcm)
snd_timer_close(dmix->timer); snd_timer_close(dmix->timer);
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
snd_pcm_close(dmix->spcm); snd_pcm_close(dmix->spcm);
if (dmix->server) if (dmix->server)
snd_pcm_direct_server_discard(dmix); snd_pcm_direct_server_discard(dmix);
if (dmix->client) if (dmix->client)
snd_pcm_direct_client_discard(dmix); snd_pcm_direct_client_discard(dmix);
shm_sum_discard(dmix); shm_sum_discard(dmix);
if (snd_pcm_direct_shm_discard(dmix)) { if (snd_pcm_direct_shm_discard(dmix)) {
if (snd_pcm_direct_semaphore_discard(dmix)) if (snd_pcm_direct_semaphore_discard(dmix))
snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT);

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, static void generic_remix_areas_16_swap(unsigned int size,
volatile signed short *dst, volatile signed short *dst,
signed short *src, signed short *src,
volatile signed int *sum, volatile signed int *sum,
size_t dst_step, size_t dst_step,
size_t src_step, size_t src_step,
size_t sum_step) size_t sum_step)
{ {
register signed int sample; 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, static void generic_remix_areas_32_swap(unsigned int size,
volatile signed int *dst, volatile signed int *dst,
signed int *src, signed int *src,
volatile signed int *sum, volatile signed int *sum,
size_t dst_step, size_t dst_step,
size_t src_step, size_t src_step,
size_t sum_step) size_t sum_step)
{ {
register signed int sample; register signed int sample;

View file

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

View file

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

View file

@ -484,10 +484,10 @@ static int snd_pcm_dshare_close(snd_pcm_t *pcm)
snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask; dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;
snd_pcm_close(dshare->spcm); snd_pcm_close(dshare->spcm);
if (dshare->server) if (dshare->server)
snd_pcm_direct_server_discard(dshare); snd_pcm_direct_server_discard(dshare);
if (dshare->client) if (dshare->client)
snd_pcm_direct_client_discard(dshare); snd_pcm_direct_client_discard(dshare);
if (snd_pcm_direct_shm_discard(dshare)) { if (snd_pcm_direct_shm_discard(dshare)) {
if (snd_pcm_direct_semaphore_discard(dshare)) if (snd_pcm_direct_semaphore_discard(dshare))
snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT);

View file

@ -119,7 +119,7 @@ static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_
size -= transfer; size -= transfer;
snoop_areas(dsnoop, src_areas, dst_areas, slave_hw_ptr, hw_ptr, transfer); snoop_areas(dsnoop, src_areas, dst_areas, slave_hw_ptr, hw_ptr, transfer);
slave_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 += transfer;
hw_ptr %= pcm->buffer_size; hw_ptr %= pcm->buffer_size;
} }
@ -373,10 +373,10 @@ static int snd_pcm_dsnoop_close(snd_pcm_t *pcm)
snd_timer_close(dsnoop->timer); snd_timer_close(dsnoop->timer);
snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
snd_pcm_close(dsnoop->spcm); snd_pcm_close(dsnoop->spcm);
if (dsnoop->server) if (dsnoop->server)
snd_pcm_direct_server_discard(dsnoop); snd_pcm_direct_server_discard(dsnoop);
if (dsnoop->client) if (dsnoop->client)
snd_pcm_direct_client_discard(dsnoop); snd_pcm_direct_client_discard(dsnoop);
if (snd_pcm_direct_shm_discard(dsnoop)) { if (snd_pcm_direct_shm_discard(dsnoop)) {
if (snd_pcm_direct_semaphore_discard(dsnoop)) if (snd_pcm_direct_semaphore_discard(dsnoop))
snd_pcm_direct_semaphore_final(dsnoop, DIRECT_IPC_SEM_CLIENT); snd_pcm_direct_semaphore_final(dsnoop, DIRECT_IPC_SEM_CLIENT);
@ -660,7 +660,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
return 0; return 0;
_err: _err:
if (dsnoop->timer) if (dsnoop->timer)
snd_timer_close(dsnoop->timer); snd_timer_close(dsnoop->timer);
if (dsnoop->server) if (dsnoop->server)
snd_pcm_direct_server_discard(dsnoop); snd_pcm_direct_server_discard(dsnoop);

View file

@ -77,8 +77,8 @@ pcm.name {
* changed in future. * changed in future.
*/ */
int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED, int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
snd_config_t *root, snd_config_t *conf, snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode) snd_pcm_stream_t stream, int mode)
{ {
snd_config_t *slave = NULL, *sconf; snd_config_t *slave = NULL, *sconf;
snd_config_iterator_t i, next; snd_config_iterator_t i, next;

View file

@ -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, 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_uframes_t size)
{ {
snd_pcm_file_t *file = pcm->private_data; 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 \code
pcm.name { pcm.name {
type file # File PCM type file # File PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
file STR # Output filename (or shell command the stream file STR # Output filename (or shell command the stream
# will be piped to if STR starts with the pipe # will be piped to if STR starts with the pipe
# char). # char).

View file

@ -283,9 +283,9 @@ pcm.NAME {
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
hooks { hooks {
ID STR # Hook name (see pcm_hook) ID STR # Hook name (see pcm_hook)

View file

@ -456,7 +456,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
return -EINVAL; return -EINVAL;
} }
hw->period_timer_pfd.events = POLLIN; 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, snd_timer_poll_descriptors(hw->period_timer,
&hw->period_timer_pfd, 1); &hw->period_timer_pfd, 1);
hw->period_timer_need_poll = 0; 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 * In older versions, check via poll before read() is
* needed because of the confliction between * needed because of the confliction between
* TIMER_START and FIONBIO ioctls. * TIMER_START and FIONBIO ioctls.
*/ */
if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4)) if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4))
hw->period_timer_need_poll = 1; hw->period_timer_need_poll = 1;
/* /*
@ -1785,7 +1785,7 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
sprintf(filename, filefmt, card, device); sprintf(filename, filefmt, card, device);
__again: __again:
if (attempt++ > 3) { if (attempt++ > 3) {
ret = -EBUSY; ret = -EBUSY;
goto _err; goto _err;
} }
@ -2085,8 +2085,8 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
return 0; return 0;
fail: fail:
snd_pcm_free_chmaps(chmap); snd_pcm_free_chmaps(chmap);
return err; return err;
} }
#ifndef DOC_HIDDEN #ifndef DOC_HIDDEN

View file

@ -565,7 +565,7 @@ int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
snd_pcm_t *slave, int close_slave, snd_pcm_t *slave, int close_slave,
const unsigned char *status_bits, const unsigned char *status_bits,
const unsigned char *preamble_vals, const unsigned char *preamble_vals,
int hdmi_mode) int hdmi_mode)
{ {
snd_pcm_t *pcm; snd_pcm_t *pcm;
snd_pcm_iec958_t *iec; snd_pcm_iec958_t *iec;
@ -638,14 +638,14 @@ This plugin converts 32bit IEC958 subframe samples to linear, or linear to
\code \code
pcm.name { pcm.name {
type iec958 # IEC958 subframe conversion PCM type iec958 # IEC958 subframe conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
[status status-bytes] # IEC958 status bits (given in byte array) [status status-bytes] # IEC958 status bits (given in byte array)
# IEC958 preamble bits definitions # IEC958 preamble bits definitions
# B/M/W or Z/X/Y, B = block start, M = even subframe, W = odd subframe # B/M/W or Z/X/Y, B = block start, M = even subframe, W = odd subframe
@ -797,7 +797,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
if (snd_pcm_format_linear(sformat) != 1 && if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE && sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE &&
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) { sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
snd_config_delete(sconf); snd_config_delete(sconf);
snd_error(PCM, "invalid slave format"); snd_error(PCM, "invalid slave format");
return -EINVAL; return -EINVAL;
} }

File diff suppressed because it is too large Load diff

View file

@ -429,15 +429,15 @@ match for both of them.
\code \code
pcm.name { pcm.name {
type lfloat # Linear<->Float conversion PCM type lfloat # Linear<->Float conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode

View file

@ -472,15 +472,15 @@ slave PCM. The channel count, format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
type linear # Linear conversion PCM type linear # Linear conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode

View file

@ -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) 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; return *pcm->appl.ptr % pcm->buffer_size;
} }
static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm) 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; return *pcm->hw.ptr % pcm->buffer_size;
} }

View file

@ -259,7 +259,7 @@ static void *snd_pcm_meter_thread(void *data)
if (scope->enabled) if (scope->enabled)
scope->ops->update(scope); scope->ops->update(scope);
} }
nanosleep(&meter->delay, NULL); nanosleep(&meter->delay, NULL);
} }
list_for_each(pos, &meter->scopes) { list_for_each(pos, &meter->scopes) {
scope = list_entry(pos, snd_pcm_scope_t, list); scope = list_entry(pos, snd_pcm_scope_t, list);
@ -716,14 +716,14 @@ pcm_scope.name {
} }
pcm.name { pcm.name {
type meter # Meter PCM type meter # Meter PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
} }
[frequency INT] # Updates per second [frequency INT] # Updates per second
scopes { scopes {
ID STR # Scope name (see pcm_scope) ID STR # Scope name (see pcm_scope)

View file

@ -306,12 +306,12 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
size_t size; size_t size;
unsigned int c1; unsigned int c1;
if (i->addr) { if (i->addr) {
a->addr = i->addr; a->addr = i->addr;
a->first = i->first; a->first = i->first;
a->step = i->step; a->step = i->step;
continue; continue;
} }
size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits; size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits;
for (c1 = c + 1; c1 < pcm->channels; ++c1) { for (c1 = c + 1; c1 < pcm->channels; ++c1) {
snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1]; snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
size_t s; size_t s;
@ -415,7 +415,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
switch (i1->type) { switch (i1->type) {
case SND_PCM_AREA_MMAP: case SND_PCM_AREA_MMAP:
if (i1->u.mmap.fd != i->u.mmap.fd || 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; continue;
break; break;
case SND_PCM_AREA_SHM: case SND_PCM_AREA_SHM:
@ -425,7 +425,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
case SND_PCM_AREA_LOCAL: case SND_PCM_AREA_LOCAL:
if (pcm->access != SND_PCM_ACCESS_MMAP_INTERLEAVED && if (pcm->access != SND_PCM_ACCESS_MMAP_INTERLEAVED &&
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED)
continue; continue;
break; break;
default: default:
assert(0); assert(0);

View file

@ -484,15 +484,15 @@ format and rate must match for both of them.
\code \code
pcm.name { pcm.name {
type mulaw # Mu-Law conversion PCM type mulaw # Mu-Law conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
format STR # Slave format format STR # Slave format
} }
} }
\endcode \endcode

View file

@ -1160,8 +1160,8 @@ This plugin converts multiple streams to one.
\code \code
pcm.name { pcm.name {
type multi # Multiple streams conversion PCM type multi # Multiple streams conversion PCM
slaves { # Slaves definition slaves { # Slaves definition
ID STR # Slave PCM name ID STR # Slave PCM name
# or # or
ID { ID {
@ -1170,7 +1170,7 @@ pcm.name {
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
channels INT # Slave channels channels INT # Slave channels
} }
} }
bindings { # Bindings table bindings { # Bindings table
N { N {
slave STR # Slave key slave STR # Slave key

View file

@ -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) static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm)
{ {
snd_pcm_null_t *null = pcm->private_data; snd_pcm_null_t *null = pcm->private_data;
if (null->state == SND_PCM_STATE_PREPARED) { if (null->state == SND_PCM_STATE_PREPARED) {
/* it is required to return the correct avail count for */ /* it is required to return the correct avail count for */
/* the prepared stream, otherwise the start is not called */ /* the prepared stream, otherwise the start is not called */
return snd_pcm_mmap_avail(pcm); return snd_pcm_mmap_avail(pcm);
} }
return pcm->buffer_size; return pcm->buffer_size;
} }
@ -434,7 +434,7 @@ and /dev/full (capture, must be readable).
\code \code
pcm.name { pcm.name {
type null # Null PCM type null # Null PCM
[chmap MAP] # Provide channel maps; MAP is a string array [chmap MAP] # Provide channel maps; MAP is a string array
} }
\endcode \endcode

View file

@ -1110,7 +1110,7 @@ static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
if (err >= 0) if (err >= 0)
err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, &max, &dir); err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, &max, &dir);
if (err >= 0 && (long)min < pcm->minperiodtime && if (err >= 0 && (long)min < pcm->minperiodtime &&
(long)max > pcm->minperiodtime) { (long)max > pcm->minperiodtime) {
min = pcm->minperiodtime; dir = 1; min = pcm->minperiodtime; dir = 1;
snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, SND_PCM_HW_PARAM_PERIOD_TIME, &min, &dir); snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, SND_PCM_HW_PARAM_PERIOD_TIME, &min, &dir);
} }

View file

@ -1210,17 +1210,17 @@ This plugin converts channels, rate and format on request.
\code \code
pcm.name { pcm.name {
type plug # Automatic conversion PCM type plug # Automatic conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
[format STR] # Slave format (default nearest) or "unchanged" [format STR] # Slave format (default nearest) or "unchanged"
[channels INT] # Slave channels (default nearest) or "unchanged" [channels INT] # Slave channels (default nearest) or "unchanged"
[rate INT] # Slave rate (default nearest) or "unchanged" [rate INT] # Slave rate (default nearest) or "unchanged"
} }
route_policy STR # route policy for automatic ttable generation route_policy STR # route policy for automatic ttable generation
# STR can be 'default', 'average', 'copy', 'duplicate' # STR can be 'default', 'average', 'copy', 'duplicate'
# average: result is average of input channels # average: result is average of input channels

View file

@ -198,7 +198,7 @@ snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames
if (frames == 0) if (frames == 0)
return 0; return 0;
sframes = frames; sframes = frames;
sframes = snd_pcm_rewind(plugin->gen.slave, sframes); sframes = snd_pcm_rewind(plugin->gen.slave, sframes);
if (sframes < 0) if (sframes < 0)
return sframes; return sframes;
@ -222,7 +222,7 @@ snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frame
if (frames == 0) if (frames == 0)
return 0; return 0;
sframes = frames; sframes = frames;
sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes); sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes);
if (sframes < 0) if (sframes < 0)
return sframes; return sframes;
@ -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_INTERLEAVED &&
pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED)
return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size); return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size);
*pcm->hw.ptr = slave_hw_ptr; *pcm->hw.ptr = slave_hw_ptr;
return slave_size; return slave_size;
} }
static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm) static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)

View file

@ -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->openmin && period_size->openmax &&
period_size->min + 1 == period_size->max) { period_size->min + 1 == period_size->max) {
if (period_size->min > 0 && (buffer_size->min / period_size->min) * period_size->min == buffer_size->min) { 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); snd_interval_set_value(period_size, period_size->min);
} else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) { } 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->max);
} }
} }
} }
#ifdef DEBUG_REFINE #ifdef DEBUG_REFINE
@ -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, 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, 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, static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
@ -958,7 +958,7 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of
} }
#endif #endif
snd_pcm_areas_copy(rate->sareas, xfer, snd_pcm_areas_copy(rate->sareas, xfer,
slave_areas, slave_offset, slave_areas, slave_offset,
pcm->channels, cont, pcm->channels, cont,
rate->gen.slave->format); rate->gen.slave->format);
result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont); result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont);
@ -1627,15 +1627,15 @@ This plugin converts a stream rate. The input and output formats must be linear.
\code \code
pcm.name { pcm.name {
type rate # Rate PCM type rate # Rate PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
rate INT # Slave rate rate INT # Slave rate
[format STR] # Slave format [format STR] # Slave format
} }
converter STR # optional converter STR # optional
# or # or
converter [ STR1 STR2 ... ] # optional converter [ STR1 STR2 ... ] # optional
@ -1713,7 +1713,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
return err; return err;
if (sformat != SND_PCM_FORMAT_UNKNOWN && if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1) { snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf); snd_config_delete(sconf);
snd_error(PCM, "slave format is not linear"); snd_error(PCM, "slave format is not linear");
return -EINVAL; return -EINVAL;
} }

View file

@ -1245,22 +1245,22 @@ If so, a matching channel map will be selected for the slave.
\code \code
pcm.name { pcm.name {
type route # Route & Volume conversion PCM type route # Route & Volume conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
[format STR] # Slave format [format STR] # Slave format
[channels INT] # Slave channels [channels INT] # Slave channels
} }
ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers) ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers)
CCHANNEL { CCHANNEL {
SCHANNEL REAL # route value (0.0 - 1.0) SCHANNEL REAL # route value (0.0 - 1.0)
} }
} }
[chmap MAP] # Override channel maps; MAP is a string array [chmap MAP] # Override channel maps; MAP is a string array
} }
\endcode \endcode
@ -1352,7 +1352,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
} }
if (sformat != SND_PCM_FORMAT_UNKNOWN && if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1) { snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf); snd_config_delete(sconf);
snd_error(PCM, "slave format is not linear"); snd_error(PCM, "slave format is not linear");
snd_pcm_free_chmaps(chmaps); snd_pcm_free_chmaps(chmaps);
return -EINVAL; return -EINVAL;

View file

@ -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_sframes_t avail;
snd_pcm_t *pcm = slave->pcm; 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) if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
avail += pcm->buffer_size; avail += pcm->buffer_size;
if (avail < 0) if (avail < 0)
@ -1569,17 +1569,17 @@ doesn't need the explicit server but access to the shared buffer.
\code \code
pcm.name { pcm.name {
type share # Share PCM type share # Share PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
[format STR] # Slave format [format STR] # Slave format
[channels INT] # Slave channels [channels INT] # Slave channels
[rate INT] # Slave rate [rate INT] # Slave rate
[period_time INT] # Slave period time in us [period_time INT] # Slave period time in us
[buffer_time INT] # Slave buffer time in us [buffer_time INT] # Slave buffer time in us
} }
bindings { bindings {
N INT # Slave channel INT for client channel N N INT # Slave channel INT for client channel N
} }

View file

@ -781,7 +781,7 @@ performance.
\code \code
pcm.name { pcm.name {
type shm # Shared memory PCM type shm # Shared memory PCM
server STR # Server name server STR # Server name
pcm STR # PCM name pcm STR # PCM name
} }

View file

@ -109,7 +109,7 @@ static int set_hw_params(snd_pcm_t *pcm,
static int set_sw_params(snd_pcm_t *pcm, static int set_sw_params(snd_pcm_t *pcm,
snd_pcm_sw_params_t *sw_params, snd_pcm_sw_params_t *sw_params,
snd_spcm_xrun_type_t xrun_type) snd_spcm_xrun_type_t xrun_type)
{ {
int err; int err;

View file

@ -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_S16_BE) |
(1ULL << SND_PCM_FORMAT_S24_LE) | (1ULL << SND_PCM_FORMAT_S24_LE) |
(1ULL << SND_PCM_FORMAT_S32_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)) (1ULL << (SND_PCM_FORMAT_S24_3LE - 32))
} }
}; };
@ -1101,17 +1101,17 @@ any changes.
\code \code
pcm.name { pcm.name {
type softvol # Soft Volume conversion PCM type softvol # Soft Volume conversion PCM
slave STR # Slave name slave STR # Slave name
# or # or
slave { # Slave definition slave { # Slave definition
pcm STR # Slave PCM name pcm STR # Slave PCM name
# or # or
pcm { } # Slave PCM definition pcm { } # Slave PCM definition
[format STR] # Slave format [format STR] # Slave format
} }
control { control {
name STR # control element id string name STR # control element id string
[card STR] # control card index [card STR] # control card index
[iface STR] # interface of the element [iface STR] # interface of the element
[index INT] # index of the element [index INT] # index of the element

View file

@ -681,35 +681,35 @@ static void *const get32float_labels[2 * 2] = {
#ifdef GET32F_END #ifdef GET32F_END
get32f_1234F_1234: tmp_float.f = as_floatc(src); get32f_1234F_1234: tmp_float.f = as_floatc(src);
if (tmp_float.f >= 1.0) if (tmp_float.f >= 1.0)
sample = 0x7fffffff; sample = 0x7fffffff;
else if (tmp_float.f <= -1.0) else if (tmp_float.f <= -1.0)
sample = 0x80000000; sample = 0x80000000;
else else
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL); sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
goto GET32F_END; goto GET32F_END;
get32f_4321F_1234: tmp_float.i = bswap_32(as_u32c(src)); get32f_4321F_1234: tmp_float.i = bswap_32(as_u32c(src));
if (tmp_float.f >= 1.0) if (tmp_float.f >= 1.0)
sample = 0x7fffffff; sample = 0x7fffffff;
else if (tmp_float.f <= -1.0) else if (tmp_float.f <= -1.0)
sample = 0x80000000; sample = 0x80000000;
else else
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL); sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
goto GET32F_END; goto GET32F_END;
get32f_1234D_1234: tmp_double.d = as_doublec(src); get32f_1234D_1234: tmp_double.d = as_doublec(src);
if (tmp_double.d >= 1.0) if (tmp_double.d >= 1.0)
sample = 0x7fffffff; sample = 0x7fffffff;
else if (tmp_double.d <= -1.0) else if (tmp_double.d <= -1.0)
sample = 0x80000000; sample = 0x80000000;
else else
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL); sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
goto GET32F_END; goto GET32F_END;
get32f_4321D_1234: tmp_double.l = bswap_64(as_u64c(src)); get32f_4321D_1234: tmp_double.l = bswap_64(as_u64c(src));
if (tmp_double.d >= 1.0) if (tmp_double.d >= 1.0)
sample = 0x7fffffff; sample = 0x7fffffff;
else if (tmp_double.d <= -1.0) else if (tmp_double.d <= -1.0)
sample = 0x80000000; sample = 0x80000000;
else else
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL); sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
goto GET32F_END; goto GET32F_END;
#endif #endif

View file

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

View file

@ -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 snd_rawmidi_close(snd_rawmidi_t *rawmidi)
{ {
int err; int err;
assert(rawmidi); assert(rawmidi);
err = rawmidi->ops->close(rawmidi); err = rawmidi->ops->close(rawmidi);
free(rawmidi->name); free(rawmidi->name);
if (rawmidi->open_func) 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) int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{ {
assert(rawmidi && pfds && revents); assert(rawmidi && pfds && revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
} }
/** /**

View file

@ -344,11 +344,11 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
sprintf(filename, SNDRV_FILE_RAWMIDI, card, device); sprintf(filename, SNDRV_FILE_RAWMIDI, card, device);
__again: __again:
if (attempt++ > 3) { if (attempt++ > 3) {
snd_ctl_close(ctl); snd_ctl_close(ctl);
return -EBUSY; return -EBUSY;
} }
ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice); ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice);
if (ret < 0) { if (ret < 0) {
snd_ctl_close(ctl); snd_ctl_close(ctl);
return ret; return ret;

View file

@ -58,12 +58,12 @@ A typical code would be like below:
// create a new client // create a new client
snd_seq_t *open_client() snd_seq_t *open_client()
{ {
snd_seq_t *handle; snd_seq_t *handle;
int err; int err;
err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0); err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0);
if (err < 0) if (err < 0)
return NULL; return NULL;
snd_seq_set_client_name(handle, "My Client"); snd_seq_set_client_name(handle, "My Client");
return handle; return handle;
} }
\endcode \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. From this time, events from keyboard are automatically sent to this program.
Timestamps will be updated according to the subscribed queue. Timestamps will be updated according to the subscribed queue.
\code \code
MIDI input port (keyboard) MIDI input port (keyboard)
| |
V V
ALSA sequencer - update timestamp ALSA sequencer - update timestamp
| |
V V
application port application port
\endcode \endcode
There is another subscription type for opposite direction: 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 After this connection is established, events will be properly sent
to MIDI output device. to MIDI output device.
\code \code
application port application port
| |
V V
ALSA sequencer - events are scheduled ALSA sequencer - events are scheduled
| |
V V
MIDI output port (WaveTable etc.) MIDI output port (WaveTable etc.)
\endcode \endcode
From the viewpoint of subscription, the examples above are special cases. 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 Thus, filter applications have to manage
only input and output events regardless of receiver/sender addresses. only input and output events regardless of receiver/sender addresses.
\code \code
sequencer port #1 sequencer port #1
| |
V V
ALSA sequencer (scheduled or real-time) ALSA sequencer (scheduled or real-time)
| |
V V
sequencer port #2 sequencer port #2
\endcode \endcode
For the detail about subscription, see the section \ref seq_subs_more. For the detail about subscription, see the section \ref seq_subs_more.
@ -454,11 +454,11 @@ For example, to set the tempo of the queue <code>q</code> to
\code \code
void set_tempo(snd_seq_t *handle, int queue) void set_tempo(snd_seq_t *handle, int queue)
{ {
snd_seq_queue_tempo_t *tempo; snd_seq_queue_tempo_t *tempo;
snd_seq_queue_tempo_alloca(&tempo); snd_seq_queue_tempo_alloca(&tempo);
snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM
snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ
snd_seq_set_queue_tempo(handle, queue, tempo); snd_seq_set_queue_tempo(handle, queue, tempo);
} }
\endcode \endcode
@ -629,19 +629,19 @@ The application port must have capability #SND_SEQ_PORT_CAP_WRITE.
\code \code
void capture_keyboard(snd_seq_t *seq) void capture_keyboard(snd_seq_t *seq)
{ {
snd_seq_addr_t sender, dest; snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs; snd_seq_port_subscribe_t *subs;
sender.client = 64; sender.client = 64;
sender.port = 0; sender.port = 0;
dest.client = 128; dest.client = 128;
dest.port = 0; dest.port = 0;
snd_seq_port_subscribe_alloca(&subs); snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender); snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest); snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_port_subscribe_set_queue(subs, 1); snd_seq_port_subscribe_set_queue(subs, 1);
snd_seq_port_subscribe_set_time_update(subs, 1); snd_seq_port_subscribe_set_time_update(subs, 1);
snd_seq_port_subscribe_set_time_real(subs, 1); snd_seq_port_subscribe_set_time_real(subs, 1);
snd_seq_subscribe_port(seq, subs); snd_seq_subscribe_port(seq, subs);
} }
\endcode \endcode
@ -652,23 +652,23 @@ The application port must have capability #SND_SEQ_PORT_CAP_READ.
\code \code
void subscribe_output(snd_seq_t *seq) void subscribe_output(snd_seq_t *seq)
{ {
snd_seq_addr_t sender, dest; snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs; snd_seq_port_subscribe_t *subs;
sender.client = 128; sender.client = 128;
sender.port = 0; sender.port = 0;
dest.client = 65; dest.client = 65;
dest.port = 1; dest.port = 1;
snd_seq_port_subscribe_alloca(&subs); snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender); snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest); snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_subscribe_port(seq, subs); snd_seq_subscribe_port(seq, subs);
} }
\endcode \endcode
This example can be simplified by using #snd_seq_connect_to() function. This example can be simplified by using #snd_seq_connect_to() function.
\code \code
void subscribe_output(snd_seq_t *seq) void subscribe_output(snd_seq_t *seq)
{ {
snd_seq_connect_to(seq, 0, 65, 1); snd_seq_connect_to(seq, 0, 65, 1);
} }
\endcode \endcode
@ -686,16 +686,16 @@ and the receiver
// ..in the third application (130:0) .. // ..in the third application (130:0) ..
void coupling(snd_seq_t *seq) void coupling(snd_seq_t *seq)
{ {
snd_seq_addr_t sender, dest; snd_seq_addr_t sender, dest;
snd_seq_port_subscribe_t *subs; snd_seq_port_subscribe_t *subs;
sender.client = 128; sender.client = 128;
sender.port = 0; sender.port = 0;
dest.client = 129; dest.client = 129;
dest.port = 0; dest.port = 0;
snd_seq_port_subscribe_alloca(&subs); snd_seq_port_subscribe_alloca(&subs);
snd_seq_port_subscribe_set_sender(subs, &sender); snd_seq_port_subscribe_set_sender(subs, &sender);
snd_seq_port_subscribe_set_dest(subs, &dest); snd_seq_port_subscribe_set_dest(subs, &dest);
snd_seq_subscribe_port(seq, subs); snd_seq_subscribe_port(seq, subs);
} }
\endcode \endcode
@ -729,17 +729,17 @@ The program appears like this:
\code \code
void schedule_event(snd_seq_t *seq) 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_clear(&ev);
snd_seq_ev_set_source(&ev, my_port); snd_seq_ev_set_source(&ev, my_port);
snd_seq_ev_set_subs(&ev); snd_seq_ev_set_subs(&ev);
snd_seq_ev_schedule_tick(&ev, Q, 0, t); snd_seq_ev_schedule_tick(&ev, Q, 0, t);
... // set event type, data, so on.. ... // set event type, data, so on..
snd_seq_event_output(seq, &ev); snd_seq_event_output(seq, &ev);
... ...
snd_seq_drain_output(seq); // if necessary snd_seq_drain_output(seq); // if necessary
} }
\endcode \endcode
Of course, you can use realtime stamp, too. Of course, you can use realtime stamp, too.
@ -754,16 +754,16 @@ The program can be more simplified as follows:
\code \code
void direct_delivery(snd_seq_t *seq) 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_clear(&ev);
snd_seq_ev_set_source(&ev, port); snd_seq_ev_set_source(&ev, port);
snd_seq_ev_set_subs(&ev); snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_direct(&ev); snd_seq_ev_set_direct(&ev);
... // set event type, data, so on.. ... // set event type, data, so on..
snd_seq_event_output(seq, &ev); snd_seq_event_output(seq, &ev);
snd_seq_drain_output(seq); snd_seq_drain_output(seq);
} }
\endcode \endcode
You should flush event soon after output event. You should flush event soon after output event.
@ -778,15 +778,15 @@ after some modification, will appear as following:
\code \code
void event_filter(snd_seq_t *seq, snd_seq_event_t *ev) void event_filter(snd_seq_t *seq, snd_seq_event_t *ev)
{ {
while (snd_seq_event_input(seq, &ev) >= 0) { while (snd_seq_event_input(seq, &ev) >= 0) {
//.. modify input event .. //.. modify input event ..
snd_seq_ev_set_source(ev, my_port); snd_seq_ev_set_source(ev, my_port);
snd_seq_ev_set_subs(ev); snd_seq_ev_set_subs(ev);
snd_seq_ev_set_direct(ev); snd_seq_ev_set_direct(ev);
snd_seq_event_output(seq, ev); snd_seq_event_output(seq, ev);
snd_seq_drain_output(seq); snd_seq_drain_output(seq);
} }
} }
\endcode \endcode
@ -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) int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{ {
assert(seq && pfds && revents); assert(seq && pfds && revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
} }
/** /**

View file

@ -60,7 +60,7 @@ int snd_send_fd(int sock, void *data, size_t len, int fd)
msghdr.msg_name = NULL; msghdr.msg_name = NULL;
msghdr.msg_namelen = 0; msghdr.msg_namelen = 0;
msghdr.msg_iov = &vec; msghdr.msg_iov = &vec;
msghdr.msg_iovlen = 1; msghdr.msg_iovlen = 1;
msghdr.msg_control = cmsg; msghdr.msg_control = cmsg;
msghdr.msg_controllen = cmsg_len; msghdr.msg_controllen = cmsg_len;
msghdr.msg_flags = 0; 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 snd_timer_close(snd_timer_t *timer)
{ {
int err; int err;
assert(timer); assert(timer);
while (!list_empty(&timer->async_handlers)) { while (!list_empty(&timer->async_handlers)) {
snd_async_handler_t *h = list_entry(timer->async_handlers.next, snd_async_handler_t, hlist); snd_async_handler_t *h = list_entry(timer->async_handlers.next, snd_async_handler_t, hlist);
snd_async_del_handler(h); snd_async_del_handler(h);
@ -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) int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{ {
assert(timer && pfds && revents); assert(timer && pfds && revents);
if (nfds == 1) { if (nfds == 1) {
*revents = pfds->revents; *revents = pfds->revents;
return 0; return 0;
} }
return -EINVAL; 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) int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid)
{ {
assert(timer); assert(timer);
if (sig == 0) if (sig == 0)
sig = SIGIO; sig = SIGIO;
if (pid == 0) if (pid == 0)
pid = getpid(); pid = getpid();
return timer->ops->async(timer, sig, pid); return timer->ops->async(timer, sig, pid);

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 snd_timer_query_close(snd_timer_query_t *timer)
{ {
int err; int err;
assert(timer); assert(timer);
err = timer->ops->close(timer); err = timer->ops->close(timer);
if (timer->dl_handle) if (timer->dl_handle)
snd_dlclose(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) int snd_timer_query_next_device(snd_timer_query_t *timer, snd_timer_id_t *tid)
{ {
assert(timer); assert(timer);
assert(tid); assert(tid);
return timer->ops->next_device(timer, tid); return timer->ops->next_device(timer, tid);
} }
@ -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) int snd_timer_query_info(snd_timer_query_t *timer, snd_timer_ginfo_t *info)
#endif #endif
{ {
assert(timer); assert(timer);
assert(info); assert(info);
return timer->ops->info(timer, info); return timer->ops->info(timer, info);
} }
use_default_symbol_version(__snd_timer_query_info, snd_timer_query_info, ALSA_0.9.0); 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) int snd_timer_query_params(snd_timer_query_t *timer, snd_timer_gparams_t *params)
#endif #endif
{ {
assert(timer); assert(timer);
assert(params); assert(params);
return timer->ops->params(timer, params); return timer->ops->params(timer, params);
} }
use_default_symbol_version(__snd_timer_query_params, snd_timer_query_params, ALSA_0.9.0); 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) int snd_timer_query_status(snd_timer_query_t *timer, snd_timer_gstatus_t *status)
#endif #endif
{ {
assert(timer); assert(timer);
assert(status); assert(status);
return timer->ops->status(timer, status); return timer->ops->status(timer, status);
} }
use_default_symbol_version(__snd_timer_query_status, snd_timer_query_status, ALSA_0.9.0); use_default_symbol_version(__snd_timer_query_status, snd_timer_query_status, ALSA_0.9.0);

View file

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

View file

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

View file

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

View file

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

View file

@ -13,8 +13,8 @@
GNU Lesser General Public License for more details. GNU Lesser General Public License for more details.
Authors: Mengdong Lin <mengdong.lin@intel.com> Authors: Mengdong Lin <mengdong.lin@intel.com>
Yao Jin <yao.jin@intel.com> Yao Jin <yao.jin@intel.com>
Liam Girdwood <liam.r.girdwood@linux.intel.com> Liam Girdwood <liam.r.girdwood@linux.intel.com>
*/ */
#include "tplg_local.h" #include "tplg_local.h"
@ -413,7 +413,7 @@ static int write_hex(char *buf, char *str, int width)
long val; long val;
void *p = &val; void *p = &val;
errno = 0; errno = 0;
if (safe_strtol_base(str, &val, 16) < 0) if (safe_strtol_base(str, &val, 16) < 0)
return -EINVAL; return -EINVAL;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -62,9 +62,9 @@
#define SEQUENCE_ELEMENT_TYPE_DEV_DISABLE_ALL 15 #define SEQUENCE_ELEMENT_TYPE_DEV_DISABLE_ALL 15
struct ucm_value { struct ucm_value {
struct list_head list; struct list_head list;
char *name; char *name;
char *data; char *data;
}; };
/* sequence of a component device */ /* sequence of a component device */

View file

@ -251,9 +251,9 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
} }
__again: __again:
if (buffer_size > 0) if (buffer_size > 0)
return -1; return -1;
if (last_bufsize == *bufsize) if (last_bufsize == *bufsize)
*bufsize += 4; *bufsize += 4;
last_bufsize = *bufsize; last_bufsize = *bufsize;
if (*bufsize > latency_max) if (*bufsize > latency_max)
@ -282,8 +282,8 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
snd_pcm_hw_params_get_buffer_size(p_params, &p_size); snd_pcm_hw_params_get_buffer_size(p_params, &p_size);
playback_buffer_size = p_size; playback_buffer_size = p_size;
if (p_psize * 2 < p_size) { if (p_psize * 2 < p_size) {
snd_pcm_hw_params_get_periods_min(p_params, &val, NULL); snd_pcm_hw_params_get_periods_min(p_params, &val, NULL);
if (val > 2) { if (val > 2) {
printf("playback device does not support 2 periods per buffer\n"); printf("playback device does not support 2 periods per buffer\n");
exit(0); exit(0);
} }
@ -291,7 +291,7 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
} }
snd_pcm_hw_params_get_buffer_size(c_params, &c_size); snd_pcm_hw_params_get_buffer_size(c_params, &c_size);
if (c_psize * 2 < c_size) { if (c_psize * 2 < c_size) {
snd_pcm_hw_params_get_periods_min(c_params, &val, NULL); snd_pcm_hw_params_get_periods_min(c_params, &val, NULL);
if (val > 2 ) { if (val > 2 ) {
printf("capture device does not support 2 periods per buffer\n"); printf("capture device does not support 2 periods per buffer\n");
exit(0); exit(0);
@ -537,14 +537,14 @@ void help(void)
"-X,--realtime do a realtime check (buffering)\n" "-X,--realtime do a realtime check (buffering)\n"
"-O,--policy set scheduler policy (RR, FIFO or OTHER)\n" "-O,--policy set scheduler policy (RR, FIFO or OTHER)\n"
); );
printf("Recognized sample formats are:"); printf("Recognized sample formats are:");
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
const char *s = snd_pcm_format_name(k); const char *s = snd_pcm_format_name(k);
if (s) if (s)
printf(" %s", s); printf(" %s", s);
} }
printf("\n\n"); printf("\n\n");
printf( printf(
"Tip #1 (usable latency with large periods, non-blocking mode, good CPU usage,\n" "Tip #1 (usable latency with large periods, non-blocking mode, good CPU usage,\n"
" superb xrun prevention):\n" " superb xrun prevention):\n"
" latency -m 8192 -M 8192 -t 1 -p\n" " latency -m 8192 -M 8192 -t 1 -p\n"
@ -819,7 +819,7 @@ int main(int argc, char *argv[])
else { else {
if (effect) if (effect)
applyeffect(buffer, r); applyeffect(buffer, r);
if (writebuf(phandle, buffer, r, &frames_out) < 0) if (writebuf(phandle, buffer, r, &frames_out) < 0)
ok = 0; ok = 0;
} }
} }

View file

@ -370,8 +370,8 @@ readtrack (void) /* read a track chunk */
old_currtempo = Mf_currtempo; old_currtempo = Mf_currtempo;
old_realtime = Mf_realtime; old_realtime = Mf_realtime;
if (revised_time != tempo_change_time) { if (revised_time != tempo_change_time) {
old_f_realtime = Mf_f_realtime; old_f_realtime = Mf_f_realtime;
old_currtime = save_time; old_currtime = save_time;
} }
delta_secs = mf_ticks2sec (revised_time-old_currtime, Mf_division, save_tempo); delta_secs = mf_ticks2sec (revised_time-old_currtime, Mf_division, save_tempo);
#ifdef DEBUG_TIMES #ifdef DEBUG_TIMES
@ -856,17 +856,17 @@ mf_write_track_chunk (int which_track, FILE *fp)
eputc(laststatus = meta_event); eputc(laststatus = meta_event);
eputc(end_of_track); eputc(end_of_track);
eputc(0); eputc(0);
*/ */
/* It's impossible to know how long the track chunk will be beforehand, /* It's impossible to know how long the track chunk will be beforehand,
so the position of the track length data is kept so that it can so the position of the track length data is kept so that it can
be written after the chunk has been generated */ be written after the chunk has been generated */
place_marker = ftell (fp); place_marker = ftell (fp);
/* This method turned out not to be portable because the /* This method turned out not to be portable because the
parameter returned from ftell is not guaranteed to be parameter returned from ftell is not guaranteed to be
in bytes on every machine */ in bytes on every machine */
/* track.length = place_marker - offset - (long) sizeof(track); */ /* track.length = place_marker - offset - (long) sizeof(track); */
#ifdef DEBUG #ifdef DEBUG

View file

@ -92,30 +92,30 @@ void mix_areas_srv(unsigned int size,
{ {
src_step /= sizeof(*src); src_step /= sizeof(*src);
sum_step /= sizeof(*sum); sum_step /= sizeof(*sum);
while (size-- > 0) { while (size-- > 0) {
atomic_add(sum, *src); atomic_add(sum, *src);
src += src_step; src += src_step;
sum += sum_step; sum += sum_step;
} }
} }
void saturate(unsigned int size, void saturate(unsigned int size,
s16 *dst, const s32 *sum, s16 *dst, const s32 *sum,
unsigned int dst_step, unsigned int sum_step) unsigned int dst_step, unsigned int sum_step)
{ {
dst_step /= sizeof(*dst); dst_step /= sizeof(*dst);
sum_step /= sizeof(*sum); sum_step /= sizeof(*sum);
while (size-- > 0) { while (size-- > 0) {
s32 sample = *sum; s32 sample = *sum;
if (unlikely(sample < -0x8000)) if (unlikely(sample < -0x8000))
*dst = -0x8000; *dst = -0x8000;
else if (unlikely(sample > 0x7fff)) else if (unlikely(sample > 0x7fff))
*dst = 0x7fff; *dst = 0x7fff;
else else
*dst = sample; *dst = sample;
dst += dst_step; dst += dst_step;
sum += sum_step; sum += sum_step;
} }
} }
void mix_areas0(unsigned int size, void mix_areas0(unsigned int size,
@ -226,16 +226,16 @@ int main(int argc, char **argv)
int LOOP = 100; int LOOP = 100;
int i, t; int i, t;
unsigned long long begin, end, diff, diffS, diff0, diff1, diff1_mmx, diff2; unsigned long long begin, end, diff, diffS, diff0, diff1, diff1_mmx, diff2;
double cpu_clock = detect_cpu_clock(); double cpu_clock = detect_cpu_clock();
s16 *dst = malloc(sizeof(*dst) * size); s16 *dst = malloc(sizeof(*dst) * size);
s32 *sum = calloc(size, sizeof(*sum)); s32 *sum = calloc(size, sizeof(*sum));
s16 **srcs = malloc(sizeof(*srcs) * n); s16 **srcs = malloc(sizeof(*srcs) * n);
setscheduler(); setscheduler();
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
printf("CPU clock: %fMhz (UP)\n\n", cpu_clock / 10e5); printf("CPU clock: %fMhz (UP)\n\n", cpu_clock / 10e5);
#else #else
printf("CPU clock: %fMhz (SMP)\n\n", cpu_clock / 10e5); printf("CPU clock: %fMhz (SMP)\n\n", cpu_clock / 10e5);
#endif #endif
if (argc > 3) { if (argc > 3) {
size = atoi(argv[1]); size = atoi(argv[1]);

View file

@ -753,16 +753,16 @@ static void help(void)
"-n,--noresample do not resample\n" "-n,--noresample do not resample\n"
"-e,--pevent enable poll event after each period\n" "-e,--pevent enable poll event after each period\n"
"\n"); "\n");
printf("Recognized sample formats are:"); printf("Recognized sample formats are:");
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
const char *s = snd_pcm_format_name(k); const char *s = snd_pcm_format_name(k);
if (s) if (s)
printf(" %s", s); printf(" %s", s);
} }
printf("\n"); printf("\n");
printf("Recognized transfer methods are:"); printf("Recognized transfer methods are:");
for (k = 0; transfer_methods[k].name; k++) for (k = 0; transfer_methods[k].name; k++)
printf(" %s", transfer_methods[k].name); printf(" %s", transfer_methods[k].name);
printf("\n"); printf("\n");
} }

View file

@ -32,7 +32,7 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
frames = snd_pcm_writei(handle, buffer, sizeof(buffer)); frames = snd_pcm_writei(handle, buffer, sizeof(buffer));
if (frames < 0) if (frames < 0)
frames = snd_pcm_recover(handle, frames, 0); frames = snd_pcm_recover(handle, frames, 0);

View file

@ -166,15 +166,15 @@ static void do_header(int format, int ntracks, int division)
snd_seq_queue_tempo_alloca(&tempo); snd_seq_queue_tempo_alloca(&tempo);
/* ppq must be set before starting the timer */ /* ppq must be set before starting the timer */
if (snd_seq_get_queue_tempo(seq_handle, dest_queue, tempo) < 0) { if (snd_seq_get_queue_tempo(seq_handle, dest_queue, tempo) < 0) {
perror("get_queue_tempo"); perror("get_queue_tempo");
exit(1); exit(1);
} }
if ((slave_ppq = snd_seq_queue_tempo_get_ppq(tempo)) != ppq) { if ((slave_ppq = snd_seq_queue_tempo_get_ppq(tempo)) != ppq) {
snd_seq_queue_tempo_set_ppq(tempo, ppq); snd_seq_queue_tempo_set_ppq(tempo, ppq);
if (snd_seq_set_queue_tempo(seq_handle, dest_queue, tempo) < 0) { if (snd_seq_set_queue_tempo(seq_handle, dest_queue, tempo) < 0) {
perror("set_queue_tempo"); perror("set_queue_tempo");
if (!slave && !shared_queue) if (!slave && !shared_queue)
exit(1); exit(1);
else else
printf("different PPQ %d in SMF from queue PPQ %d\n", ppq, slave_ppq); printf("different PPQ %d in SMF from queue PPQ %d\n", ppq, slave_ppq);
} else } else

View file

@ -108,7 +108,7 @@ void event_sender_filter(snd_seq_t *handle)
} }
void send_event(snd_seq_t *handle, int queue, int client, int port, void send_event(snd_seq_t *handle, int queue, int client, int port,
snd_seq_addr_t *dest, int *time) snd_seq_addr_t *dest, int *time)
{ {
int err; int err;
snd_seq_event_t ev; snd_seq_event_t ev;

View file

@ -162,9 +162,9 @@ int main(int argc, char *argv[])
{"verbose", 0, NULL, HELPID_VERBOSE}, {"verbose", 0, NULL, HELPID_VERBOSE},
{"version", 0, NULL, HELPID_VERSION}, {"version", 0, NULL, HELPID_VERSION},
{NULL, 0, NULL, 0}, {NULL, 0, NULL, 0},
}; };
morehelp = 0; morehelp = 0;
while (1) { while (1) {
int c; int c;
@ -193,10 +193,10 @@ int main(int argc, char *argv[])
morehelp++; morehelp++;
} }
} }
if (morehelp) { if (morehelp) {
help(); help();
return 1; return 1;
} }
if (argc - optind <= 0) { if (argc - optind <= 0) {
fprintf(stderr, "seq: Specify command...\n"); fprintf(stderr, "seq: Specify command...\n");
return 0; return 0;
@ -208,7 +208,7 @@ int main(int argc, char *argv[])
set_name(handle); set_name(handle);
system_info(handle); system_info(handle);
if (!strcmp(argv[optind], "system")) { if (!strcmp(argv[optind], "system")) {
show_system_info(handle); show_system_info(handle);
} else if (!strcmp(argv[optind], "queue")) { } else if (!strcmp(argv[optind], "queue")) {
arg = argc - optind > 1 ? atoi(argv[optind + 1]) : -1; arg = argc - optind > 1 ? atoi(argv[optind + 1]) : -1;

View file

@ -270,7 +270,7 @@ static int add_iec958_elem_set(struct elem_set_trial *trial,
err = snd_ctl_elem_add_iec958(trial->handle, trial->id); err = snd_ctl_elem_add_iec958(trial->handle, trial->id);
if (err < 0) if (err < 0)
return err; return err;
/* /*
* In historical reason, the above API is not allowed to fill all of * In historical reason, the above API is not allowed to fill all of