mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-10 13:30:01 -05:00
Control API encapsulation. Better names for kernel API. Simpler PCM hw_params API. Added missing const.
This commit is contained in:
parent
ccb399f0cd
commit
8f0cb26fdf
71 changed files with 2001 additions and 694 deletions
|
|
@ -24,8 +24,6 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "pcm_local.h"
|
||||
|
||||
static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,5 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include "pcm_local.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef SND_MASK_C
|
||||
#define MASK_INLINE inline
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/poll.h>
|
||||
|
|
@ -248,12 +247,12 @@ int snd_pcm_poll_descriptor(snd_pcm_t *pcm)
|
|||
#define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d
|
||||
#define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d
|
||||
|
||||
char *snd_pcm_stream_names[] = {
|
||||
const char *snd_pcm_stream_names[] = {
|
||||
STREAM(PLAYBACK),
|
||||
STREAM(CAPTURE),
|
||||
};
|
||||
|
||||
char *snd_pcm_state_names[] = {
|
||||
const char *snd_pcm_state_names[] = {
|
||||
STATE(OPEN),
|
||||
STATE(SETUP),
|
||||
STATE(PREPARED),
|
||||
|
|
@ -262,7 +261,7 @@ char *snd_pcm_state_names[] = {
|
|||
STATE(PAUSED),
|
||||
};
|
||||
|
||||
char *snd_pcm_hw_param_names[] = {
|
||||
const char *snd_pcm_hw_param_names[] = {
|
||||
HW_PARAM(ACCESS),
|
||||
HW_PARAM(FORMAT),
|
||||
HW_PARAM(SUBFORMAT),
|
||||
|
|
@ -280,7 +279,7 @@ char *snd_pcm_hw_param_names[] = {
|
|||
HW_PARAM(TICK_TIME),
|
||||
};
|
||||
|
||||
char *snd_pcm_access_names[] = {
|
||||
const char *snd_pcm_access_names[] = {
|
||||
ACCESS(MMAP_INTERLEAVED),
|
||||
ACCESS(MMAP_NONINTERLEAVED),
|
||||
ACCESS(MMAP_COMPLEX),
|
||||
|
|
@ -288,7 +287,7 @@ char *snd_pcm_access_names[] = {
|
|||
ACCESS(RW_NONINTERLEAVED),
|
||||
};
|
||||
|
||||
char *snd_pcm_format_names[] = {
|
||||
const char *snd_pcm_format_names[] = {
|
||||
FORMAT(S8),
|
||||
FORMAT(U8),
|
||||
FORMAT(S16_LE),
|
||||
|
|
@ -317,7 +316,7 @@ char *snd_pcm_format_names[] = {
|
|||
FORMAT(SPECIAL),
|
||||
};
|
||||
|
||||
char *snd_pcm_format_descriptions[] = {
|
||||
const char *snd_pcm_format_descriptions[] = {
|
||||
FORMATD(S8, "Signed 8-bit"),
|
||||
FORMATD(U8, "Unsigned 8-bit"),
|
||||
FORMATD(S16_LE, "Signed 16-bit Little Endian"),
|
||||
|
|
@ -346,25 +345,25 @@ char *snd_pcm_format_descriptions[] = {
|
|||
FORMATD(SPECIAL, "Special"),
|
||||
};
|
||||
|
||||
char *snd_pcm_subformat_names[] = {
|
||||
const char *snd_pcm_subformat_names[] = {
|
||||
SUBFORMAT(STD),
|
||||
};
|
||||
|
||||
char *snd_pcm_subformat_descriptions[] = {
|
||||
const char *snd_pcm_subformat_descriptions[] = {
|
||||
SUBFORMATD(STD, "Standard"),
|
||||
};
|
||||
|
||||
char *snd_pcm_start_mode_names[] = {
|
||||
const char *snd_pcm_start_mode_names[] = {
|
||||
START(EXPLICIT),
|
||||
START(DATA),
|
||||
};
|
||||
|
||||
char *snd_pcm_xrun_mode_names[] = {
|
||||
const char *snd_pcm_xrun_mode_names[] = {
|
||||
XRUN(NONE),
|
||||
XRUN(STOP),
|
||||
};
|
||||
|
||||
char *snd_pcm_tstamp_mode_names[] = {
|
||||
const char *snd_pcm_tstamp_mode_names[] = {
|
||||
TSTAMP(NONE),
|
||||
TSTAMP(MMAP),
|
||||
};
|
||||
|
|
@ -536,15 +535,15 @@ ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, int samples)
|
|||
return samples * pcm->sample_bits / 8;
|
||||
}
|
||||
|
||||
int snd_pcm_open(snd_pcm_t **pcmp, char *name,
|
||||
int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
char *str;
|
||||
const char *str;
|
||||
int err;
|
||||
snd_config_t *pcm_conf, *conf, *type_conf;
|
||||
snd_config_iterator_t i;
|
||||
char *lib = NULL, *open = NULL;
|
||||
int (*open_func)(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
||||
const char *lib = NULL, *open = NULL;
|
||||
int (*open_func)(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
void *h;
|
||||
assert(pcmp && name);
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
|
|
@ -618,7 +618,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
|
|||
continue;
|
||||
}
|
||||
if (strcmp(n->id, "sformat") == 0) {
|
||||
char *f;
|
||||
const char *f;
|
||||
err = snd_config_string_get(n, &f);
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
|
|
@ -652,7 +652,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_adpcm_open(pcmp, name, sformat, spcm, 1);
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
|
|
@ -491,7 +491,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
|
|||
continue;
|
||||
}
|
||||
if (strcmp(n->id, "sformat") == 0) {
|
||||
char *f;
|
||||
const char *f;
|
||||
err = snd_config_string_get(n, &f);
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
|
|
@ -525,7 +525,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_alaw_open(pcmp, name, sformat, spcm, 1);
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_config_foreach(i, conf) {
|
||||
|
|
@ -259,7 +259,7 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_copy_open(pcmp, name, spcm, 1);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ typedef enum _snd_pcm_file_format {
|
|||
typedef struct {
|
||||
snd_pcm_t *slave;
|
||||
int close_slave;
|
||||
char *fname;
|
||||
const char *fname;
|
||||
int fd;
|
||||
int format;
|
||||
snd_pcm_uframes_t appl_ptr;
|
||||
|
|
@ -102,7 +102,7 @@ static int snd_pcm_file_close(snd_pcm_t *pcm)
|
|||
if (file->close_slave)
|
||||
err = snd_pcm_close(file->slave);
|
||||
if (file->fname) {
|
||||
free(file->fname);
|
||||
free((void *)file->fname);
|
||||
close(file->fd);
|
||||
}
|
||||
free(file);
|
||||
|
|
@ -403,7 +403,7 @@ snd_pcm_fast_ops_t snd_pcm_file_fast_ops = {
|
|||
mmap_forward: snd_pcm_file_mmap_forward,
|
||||
};
|
||||
|
||||
int snd_pcm_file_open(snd_pcm_t **pcmp, char *name, char *fname, int fd, char *fmt, snd_pcm_t *slave, int close_slave)
|
||||
int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int fd, const char *fmt, snd_pcm_t *slave, int close_slave)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_file_t *file;
|
||||
|
|
@ -464,11 +464,11 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
char *fname = NULL;
|
||||
char *format = NULL;
|
||||
const char *fname = NULL;
|
||||
const char *format = NULL;
|
||||
long fd = -1;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_t *n = snd_config_entry(i);
|
||||
|
|
@ -526,7 +526,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_file_open(pcmp, name, fname, fd, format, spcm, 1);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
|
|
@ -664,7 +663,7 @@ int snd_pcm_hw_open_device(snd_pcm_t **pcmp, int card, int device, snd_pcm_strea
|
|||
return snd_pcm_hw_open_subdevice(pcmp, card, device, -1, stream, mode);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_open(snd_pcm_t **pcmp, char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
|
||||
int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
int err = snd_pcm_hw_open_subdevice(pcmp, card, device, subdevice, stream, mode);
|
||||
if (err < 0)
|
||||
|
|
@ -679,7 +678,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
{
|
||||
snd_config_iterator_t i;
|
||||
long card = -1, device = 0, subdevice = -1;
|
||||
char *str;
|
||||
const char *str;
|
||||
int err;
|
||||
snd_config_foreach(i, conf) {
|
||||
snd_config_t *n = snd_config_entry(i);
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
|
|
@ -389,7 +389,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
|
|||
continue;
|
||||
}
|
||||
if (strcmp(n->id, "sformat") == 0) {
|
||||
char *f;
|
||||
const char *f;
|
||||
err = snd_config_string_get(n, &f);
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
|
|
@ -422,7 +422,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_linear_open(pcmp, name, sformat, spcm, 1);
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <sys/uio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define _snd_pcm_access_mask _snd_mask
|
||||
#define _snd_pcm_format_mask _snd_mask
|
||||
|
|
@ -167,11 +165,11 @@ struct _snd_pcm {
|
|||
void *private;
|
||||
};
|
||||
|
||||
int snd_pcm_hw_open(snd_pcm_t **pcm, char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_plug_open_hw(snd_pcm_t **pcm, char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, char *socket, char *sname, snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_file_open(snd_pcm_t **pcmp, char *name, char *fname, int fd, char *fmt, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_null_open(snd_pcm_t **pcmp, char *name, snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_hw_open(snd_pcm_t **pcm, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_plug_open_hw(snd_pcm_t **pcm, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *socket, const char *sname, snd_pcm_stream_t stream, int mode);
|
||||
int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int fd, const char *fmt, snd_pcm_t *slave, int close_slave);
|
||||
int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode);
|
||||
|
||||
|
||||
void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void *buf);
|
||||
|
|
|
|||
446
src/pcm/pcm_m4.c
446
src/pcm/pcm_m4.c
|
|
@ -22,6 +22,7 @@
|
|||
#include "pcm_local.h"
|
||||
|
||||
|
||||
|
||||
size_t snd_pcm_access_mask_sizeof()
|
||||
{
|
||||
return sizeof(snd_pcm_access_mask_t);
|
||||
|
|
@ -30,7 +31,7 @@ size_t snd_pcm_access_mask_sizeof()
|
|||
int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
*ptr = malloc(sizeof(snd_pcm_access_mask_t));
|
||||
*ptr = calloc(1, sizeof(snd_pcm_access_mask_t));
|
||||
if (!*ptr)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
|
@ -81,7 +82,7 @@ size_t snd_pcm_format_mask_sizeof()
|
|||
int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
*ptr = malloc(sizeof(snd_pcm_format_mask_t));
|
||||
*ptr = calloc(1, sizeof(snd_pcm_format_mask_t));
|
||||
if (!*ptr)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
|
@ -132,7 +133,7 @@ size_t snd_pcm_subformat_mask_sizeof()
|
|||
int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
*ptr = malloc(sizeof(snd_pcm_subformat_mask_t));
|
||||
*ptr = calloc(1, sizeof(snd_pcm_subformat_mask_t));
|
||||
if (!*ptr)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
|
@ -183,7 +184,7 @@ size_t snd_pcm_hw_params_sizeof()
|
|||
int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
*ptr = malloc(sizeof(snd_pcm_hw_params_t));
|
||||
*ptr = calloc(1, sizeof(snd_pcm_hw_params_t));
|
||||
if (!*ptr)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
|
@ -205,9 +206,14 @@ snd_pcm_access_t snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params)
|
|||
return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_ACCESS, NULL));
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_access_t val)
|
||||
int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_ACCESS, snd_enum_to_int(val), 0);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_ACCESS, snd_enum_to_int(val), 0);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, snd_enum_to_int(val), 0);
|
||||
}
|
||||
|
||||
snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
|
|
@ -220,9 +226,9 @@ snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_pa
|
|||
return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_ACCESS, NULL));
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_access_mask_t *mask)
|
||||
int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask)
|
||||
{
|
||||
return snd_pcm_hw_param_set_mask(pcm, params, mode, SND_PCM_HW_PARAM_ACCESS, (snd_mask_t *) mask);
|
||||
return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_ACCESS, (snd_mask_t *) mask);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -231,9 +237,14 @@ snd_pcm_format_t snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params)
|
|||
return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_FORMAT, NULL));
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_format_t val)
|
||||
int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0);
|
||||
}
|
||||
|
||||
snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
|
|
@ -246,20 +257,25 @@ snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_pa
|
|||
return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_FORMAT, NULL));
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_format_mask_t *mask)
|
||||
int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask)
|
||||
{
|
||||
return snd_pcm_hw_param_set_mask(pcm, params, mode, SND_PCM_HW_PARAM_FORMAT, (snd_mask_t *) mask);
|
||||
return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, (snd_mask_t *) mask);
|
||||
}
|
||||
|
||||
|
||||
int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_SUBFORMAT, snd_enum_to_int(val), 0);
|
||||
}
|
||||
|
||||
snd_pcm_subformat_t snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params)
|
||||
{
|
||||
return snd_int_to_enum(snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_SUBFORMAT, NULL));
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_subformat_t val)
|
||||
int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_SUBFORMAT, snd_enum_to_int(val), 0);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, snd_enum_to_int(val), 0);
|
||||
}
|
||||
|
||||
snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
|
|
@ -272,9 +288,9 @@ snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm
|
|||
return snd_int_to_enum(snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_SUBFORMAT, NULL));
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_subformat_mask_t *mask)
|
||||
int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask)
|
||||
{
|
||||
return snd_pcm_hw_param_set_mask(pcm, params, mode, SND_PCM_HW_PARAM_SUBFORMAT, (snd_mask_t *) mask);
|
||||
return snd_pcm_hw_param_set_mask(pcm, params, SND_TRY, SND_PCM_HW_PARAM_SUBFORMAT, (snd_mask_t *) mask);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -293,24 +309,29 @@ unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *param
|
|||
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_CHANNELS, NULL);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val)
|
||||
int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_CHANNELS, val, 0);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_CHANNELS, val, 0);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val)
|
||||
int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
|
||||
{
|
||||
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, 0);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val)
|
||||
int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
|
||||
{
|
||||
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
|
||||
return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, unsigned int *max)
|
||||
int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_CHANNELS, min, NULL, max, NULL);
|
||||
return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, val, NULL);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_CHANNELS, min, NULL, max, NULL);
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
|
||||
|
|
@ -344,24 +365,29 @@ unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, i
|
|||
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_RATE, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir)
|
||||
int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_RATE, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_RATE, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_RATE, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_RATE, val, dir);
|
||||
return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_RATE, min, mindir, max, maxdir);
|
||||
return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_RATE, min, mindir, max, maxdir);
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
|
||||
|
|
@ -395,24 +421,29 @@ unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *pa
|
|||
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir)
|
||||
int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_TIME, min, mindir, max, maxdir);
|
||||
return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_TIME, min, mindir, max, maxdir);
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
|
||||
|
|
@ -446,32 +477,37 @@ snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_
|
|||
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t val, int dir)
|
||||
int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val, int *dir)
|
||||
int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
|
||||
{
|
||||
unsigned int _val = *val;
|
||||
int err = snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
|
||||
int err = snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
|
||||
*val = _val;
|
||||
return err;
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val, int *dir)
|
||||
int snd_pcm_hw_params_set_period_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
|
||||
{
|
||||
unsigned int _val = *val;
|
||||
int err = snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
|
||||
int err = snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
|
||||
*val = _val;
|
||||
return err;
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir)
|
||||
int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, int *mindir, snd_pcm_uframes_t *max, int *maxdir)
|
||||
{
|
||||
unsigned int _min = *min;
|
||||
unsigned int _max = *max;
|
||||
int err = snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE, &_min, mindir, &_max, maxdir);
|
||||
int err = snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE, &_min, mindir, &_max, maxdir);
|
||||
*min = _min;
|
||||
*max = _max;
|
||||
return err;
|
||||
|
|
@ -492,9 +528,9 @@ snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm
|
|||
return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIOD_SIZE, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode)
|
||||
int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
return snd_pcm_hw_param_set_integer(pcm, params, mode, SND_PCM_HW_PARAM_PERIOD_SIZE);
|
||||
return snd_pcm_hw_param_set_integer(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIOD_SIZE);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -513,24 +549,29 @@ unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params
|
|||
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIODS, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir)
|
||||
int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_PERIODS, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS, val, dir);
|
||||
return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS, min, mindir, max, maxdir);
|
||||
return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS, min, mindir, max, maxdir);
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
|
||||
|
|
@ -548,9 +589,9 @@ unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_param
|
|||
return snd_pcm_hw_param_set_last(pcm, params, SND_PCM_HW_PARAM_PERIODS, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode)
|
||||
int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
return snd_pcm_hw_param_set_integer(pcm, params, mode, SND_PCM_HW_PARAM_PERIODS);
|
||||
return snd_pcm_hw_param_set_integer(pcm, params, SND_TRY, SND_PCM_HW_PARAM_PERIODS);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -569,24 +610,29 @@ unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *pa
|
|||
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_TIME, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir)
|
||||
int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_TIME, min, mindir, max, maxdir);
|
||||
return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_TIME, min, mindir, max, maxdir);
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
|
||||
|
|
@ -620,32 +666,37 @@ snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_
|
|||
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_BUFFER_SIZE, NULL);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t val)
|
||||
int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_SIZE, val, 0);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_BUFFER_SIZE, val, 0);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val)
|
||||
int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, val, 0);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
|
||||
{
|
||||
unsigned int _val = *val;
|
||||
int err = snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
|
||||
int err = snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
|
||||
*val = _val;
|
||||
return err;
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *val)
|
||||
int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
|
||||
{
|
||||
unsigned int _val = *val;
|
||||
int err = snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
|
||||
int err = snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_val, NULL);
|
||||
*val = _val;
|
||||
return err;
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max)
|
||||
int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *min, snd_pcm_uframes_t *max)
|
||||
{
|
||||
unsigned int _min = *min;
|
||||
unsigned int _max = *max;
|
||||
int err = snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_BUFFER_SIZE, &_min, NULL, &_max, NULL);
|
||||
int err = snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_BUFFER_SIZE, &_min, NULL, &_max, NULL);
|
||||
*min = _min;
|
||||
*max = _max;
|
||||
return err;
|
||||
|
|
@ -682,24 +733,29 @@ unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *para
|
|||
return snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_TICK_TIME, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int val, int dir)
|
||||
int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set(pcm, params, mode, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_min(pcm, params, mode, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *val, int *dir)
|
||||
int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_max(pcm, params, mode, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
|
||||
return snd_pcm_hw_param_set_min(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, mode, SND_PCM_HW_PARAM_TICK_TIME, min, mindir, max, maxdir);
|
||||
return snd_pcm_hw_param_set_max(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, val, dir);
|
||||
}
|
||||
|
||||
int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir)
|
||||
{
|
||||
return snd_pcm_hw_param_set_minmax(pcm, params, SND_TRY, SND_PCM_HW_PARAM_TICK_TIME, min, mindir, max, maxdir);
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir)
|
||||
|
|
@ -726,7 +782,7 @@ size_t snd_pcm_sw_params_sizeof()
|
|||
int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
*ptr = malloc(sizeof(snd_pcm_sw_params_t));
|
||||
*ptr = calloc(1, sizeof(snd_pcm_sw_params_t));
|
||||
if (!*ptr)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
|
@ -875,115 +931,6 @@ snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *
|
|||
}
|
||||
|
||||
|
||||
size_t snd_pcm_info_sizeof()
|
||||
{
|
||||
return sizeof(snd_pcm_info_t);
|
||||
}
|
||||
|
||||
int snd_pcm_info_malloc(snd_pcm_info_t **ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
*ptr = malloc(sizeof(snd_pcm_info_t));
|
||||
if (!*ptr)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void snd_pcm_info_free(snd_pcm_info_t *obj)
|
||||
{
|
||||
free(obj);
|
||||
}
|
||||
|
||||
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src)
|
||||
{
|
||||
assert(dst && src);
|
||||
*dst = *src;
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->device;
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->subdevice;
|
||||
}
|
||||
|
||||
snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return snd_int_to_enum(obj->stream);
|
||||
}
|
||||
|
||||
int snd_pcm_info_get_card(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->card;
|
||||
}
|
||||
|
||||
const char * snd_pcm_info_get_id(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->id;
|
||||
}
|
||||
|
||||
const char * snd_pcm_info_get_name(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->name;
|
||||
}
|
||||
|
||||
const char * snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->subname;
|
||||
}
|
||||
|
||||
snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return snd_int_to_enum(obj->dev_class);
|
||||
}
|
||||
|
||||
snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return snd_int_to_enum(obj->dev_subclass);
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->subdevices_count;
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->subdevices_avail;
|
||||
}
|
||||
|
||||
void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val)
|
||||
{
|
||||
assert(obj);
|
||||
obj->device = val;
|
||||
}
|
||||
|
||||
void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val)
|
||||
{
|
||||
assert(obj);
|
||||
obj->subdevice = val;
|
||||
}
|
||||
|
||||
void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val)
|
||||
{
|
||||
assert(obj);
|
||||
obj->stream = snd_enum_to_int(val);
|
||||
}
|
||||
|
||||
size_t snd_pcm_status_sizeof()
|
||||
{
|
||||
return sizeof(snd_pcm_status_t);
|
||||
|
|
@ -992,7 +939,7 @@ size_t snd_pcm_status_sizeof()
|
|||
int snd_pcm_status_malloc(snd_pcm_status_t **ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
*ptr = malloc(sizeof(snd_pcm_status_t));
|
||||
*ptr = calloc(1, sizeof(snd_pcm_status_t));
|
||||
if (!*ptr)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
|
|
@ -1045,3 +992,112 @@ snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj)
|
|||
return obj->avail_max;
|
||||
}
|
||||
|
||||
size_t snd_pcm_info_sizeof()
|
||||
{
|
||||
return sizeof(snd_pcm_info_t);
|
||||
}
|
||||
|
||||
int snd_pcm_info_malloc(snd_pcm_info_t **ptr)
|
||||
{
|
||||
assert(ptr);
|
||||
*ptr = calloc(1, sizeof(snd_pcm_info_t));
|
||||
if (!*ptr)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void snd_pcm_info_free(snd_pcm_info_t *obj)
|
||||
{
|
||||
free(obj);
|
||||
}
|
||||
|
||||
void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src)
|
||||
{
|
||||
assert(dst && src);
|
||||
*dst = *src;
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->device;
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->subdevice;
|
||||
}
|
||||
|
||||
snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return snd_int_to_enum(obj->stream);
|
||||
}
|
||||
|
||||
int snd_pcm_info_get_card(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->card;
|
||||
}
|
||||
|
||||
const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->id;
|
||||
}
|
||||
|
||||
const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->name;
|
||||
}
|
||||
|
||||
const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->subname;
|
||||
}
|
||||
|
||||
snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return snd_int_to_enum(obj->dev_class);
|
||||
}
|
||||
|
||||
snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return snd_int_to_enum(obj->dev_subclass);
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->subdevices_count;
|
||||
}
|
||||
|
||||
unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj)
|
||||
{
|
||||
assert(obj);
|
||||
return obj->subdevices_avail;
|
||||
}
|
||||
|
||||
void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val)
|
||||
{
|
||||
assert(obj);
|
||||
obj->device = val;
|
||||
}
|
||||
|
||||
void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val)
|
||||
{
|
||||
assert(obj);
|
||||
obj->subdevice = val;
|
||||
}
|
||||
|
||||
void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val)
|
||||
{
|
||||
assert(obj);
|
||||
obj->stream = snd_enum_to_int(val);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <byteswap.h>
|
||||
#include "pcm_local.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/shm.h>
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
|
|
@ -506,7 +506,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
|
|||
continue;
|
||||
}
|
||||
if (strcmp(n->id, "sformat") == 0) {
|
||||
char *f;
|
||||
const char *f;
|
||||
err = snd_config_string_get(n, &f);
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
|
|
@ -540,7 +540,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_mulaw_open(pcmp, name, sformat, spcm, 1);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include "pcm_local.h"
|
||||
|
||||
|
|
@ -664,7 +663,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
idx = 0;
|
||||
snd_config_foreach(i, slave) {
|
||||
snd_config_t *m = snd_config_entry(i);
|
||||
char *name = NULL;
|
||||
const char *name = NULL;
|
||||
long channels = -1;
|
||||
slaves_id[idx] = m->id;
|
||||
snd_config_foreach(j, m) {
|
||||
|
|
@ -712,7 +711,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
long schannel = -1;
|
||||
int slave = -1;
|
||||
long val;
|
||||
char *str;
|
||||
const char *str;
|
||||
cchannel = strtol(m->id, 0, 10);
|
||||
if (cchannel < 0) {
|
||||
ERR("Invalid channel number: %s", m->id);
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ snd_pcm_fast_ops_t snd_pcm_null_fast_ops = {
|
|||
mmap_forward: snd_pcm_null_mmap_forward,
|
||||
};
|
||||
|
||||
int snd_pcm_null_open(snd_pcm_t **pcmp, char *name, snd_pcm_stream_t stream, int mode)
|
||||
int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_null_t *null;
|
||||
|
|
|
|||
|
|
@ -902,7 +902,7 @@ void snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
|
|||
min = snd_pcm_hw_param_get_min(src, var, &mindir);
|
||||
max = snd_pcm_hw_param_get_max(src, var, &maxdir);
|
||||
snd_pcm_hw_param_set_near_minmax(pcm, params, var,
|
||||
min, &mindir, max, &maxdir);
|
||||
min, &mindir, max, &maxdir);
|
||||
}
|
||||
|
||||
/* ---- end of refinement functions ---- */
|
||||
|
|
@ -968,14 +968,6 @@ int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
|
|||
return params->msbits;
|
||||
}
|
||||
|
||||
/* Return info for configuration space defined by PARAMS */
|
||||
int snd_pcm_hw_params_get_flags(const snd_pcm_hw_params_t *params)
|
||||
{
|
||||
if (params->info == ~0U)
|
||||
return -EINVAL;
|
||||
return params->info;
|
||||
}
|
||||
|
||||
/* Return fifo size for configuration space defined by PARAMS */
|
||||
int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -574,8 +574,8 @@ static int snd_pcm_plug_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
if (!(clt_params.format == slv_params.format &&
|
||||
clt_params.channels == slv_params.channels &&
|
||||
clt_params.rate == slv_params.rate &&
|
||||
snd_pcm_hw_params_set_access(slave, &sparams, SND_TEST,
|
||||
clt_params.access) >= 0)) {
|
||||
snd_pcm_hw_params_test_access(slave, &sparams,
|
||||
clt_params.access) >= 0)) {
|
||||
slv_params.access = snd_pcm_hw_params_set_access_first(slave, &sparams);
|
||||
err = snd_pcm_plug_insert_plugins(pcm, &clt_params, &slv_params);
|
||||
if (err < 0)
|
||||
|
|
@ -646,7 +646,7 @@ snd_pcm_ops_t snd_pcm_plug_ops = {
|
|||
};
|
||||
|
||||
int snd_pcm_plug_open(snd_pcm_t **pcmp,
|
||||
char *name,
|
||||
const char *name,
|
||||
snd_pcm_route_ttable_entry_t *ttable,
|
||||
unsigned int tt_ssize,
|
||||
unsigned int tt_cused, unsigned int tt_sused,
|
||||
|
|
@ -688,7 +688,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_plug_open_hw(snd_pcm_t **pcmp, char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
|
||||
int snd_pcm_plug_open_hw(snd_pcm_t **pcmp, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_pcm_t *slave;
|
||||
int err;
|
||||
|
|
@ -700,12 +700,12 @@ int snd_pcm_plug_open_hw(snd_pcm_t **pcmp, char *name, int card, int device, int
|
|||
|
||||
#define MAX_CHANNELS 32
|
||||
|
||||
int _snd_pcm_plug_open(snd_pcm_t **pcmp, char *name,
|
||||
int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_config_t *tt = NULL;
|
||||
|
|
@ -755,7 +755,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_plug_open(pcmp, name, ttable, MAX_CHANNELS, cused, sused, spcm, 1);
|
||||
|
|
|
|||
|
|
@ -622,7 +622,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
|
|
@ -644,7 +644,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
|
|||
continue;
|
||||
}
|
||||
if (strcmp(n->id, "sformat") == 0) {
|
||||
char *f;
|
||||
const char *f;
|
||||
err = snd_config_string_get(n, &f);
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
|
|
@ -685,7 +685,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_rate_open(pcmp, name, sformat, srate, spcm, 1);
|
||||
|
|
|
|||
|
|
@ -883,7 +883,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
int err;
|
||||
snd_pcm_t *spcm;
|
||||
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
|
||||
|
|
@ -908,7 +908,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
|||
continue;
|
||||
}
|
||||
if (strcmp(n->id, "sformat") == 0) {
|
||||
char *f;
|
||||
const char *f;
|
||||
err = snd_config_string_get(n, &f);
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
|
|
@ -963,7 +963,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
|
|||
if (!sname)
|
||||
return -ENOMEM;
|
||||
err = snd_pcm_open(&spcm, sname, stream, mode);
|
||||
free(sname);
|
||||
free((void *) sname);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = snd_pcm_route_open(pcmp, name, sformat, schannels,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/poll.h>
|
||||
|
|
@ -1181,7 +1180,7 @@ snd_pcm_fast_ops_t snd_pcm_share_fast_ops = {
|
|||
mmap_forward: snd_pcm_share_mmap_forward,
|
||||
};
|
||||
|
||||
int snd_pcm_share_open(snd_pcm_t **pcmp, char *name, char *sname,
|
||||
int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
||||
snd_pcm_format_t sformat, int srate,
|
||||
unsigned int schannels_count,
|
||||
unsigned int channels_count, int *channels_map,
|
||||
|
|
@ -1363,7 +1362,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *sname = NULL;
|
||||
const char *sname = NULL;
|
||||
snd_config_t *binding = NULL;
|
||||
int err;
|
||||
unsigned int idx;
|
||||
|
|
@ -1391,7 +1390,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
continue;
|
||||
}
|
||||
if (strcmp(n->id, "sformat") == 0) {
|
||||
char *f;
|
||||
const char *f;
|
||||
err = snd_config_string_get(n, &f);
|
||||
if (err < 0) {
|
||||
ERR("Invalid type for %s", n->id);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/shm.h>
|
||||
|
|
@ -564,7 +563,7 @@ static int make_inet_socket(const char *host, int port)
|
|||
}
|
||||
#endif
|
||||
|
||||
int snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, char *socket, char *sname, snd_pcm_stream_t stream, int mode)
|
||||
int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *socket, const char *sname, snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_shm_t *shm = NULL;
|
||||
|
|
@ -721,11 +720,11 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
|
|||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_iterator_t i;
|
||||
char *server = NULL;
|
||||
char *sname = NULL;
|
||||
const char *server = NULL;
|
||||
const char *sname = NULL;
|
||||
snd_config_t *sconfig;
|
||||
char *host = NULL;
|
||||
char *socket = NULL;
|
||||
const char *host = NULL;
|
||||
const char *socket = NULL;
|
||||
long port = -1;
|
||||
int err;
|
||||
int local;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue